Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27th July 2006, 12:53 AM
Darkon's Avatar
Darkon Offline
Registered User
 
Join Date: Jul 2004
Location: Finland
Age: 26
Posts: 76
How to play MIDI files [emu10k1]

I didn't found anything like "How to setup midi output (as in .mid files) in linux" so I kinda wrote my own once I got my system working. It does need a bit of tweaking... Since awesfx works only for emu10k1 driver, and I have an Audigy2 card, this guide works only for cards covered by the emu10k1 driver.

First, soundcard driver is loaded and sound is working fine. Usually it does... But you can't play midi files, because the soundcard doesn't have any midi instruments loaded. This can be seen with the command cat /proc/asound/card0/wavetableD1

Code:
Device: Emu10k1
Ports: 4
Addresses: 17:0 17:1 17:2 17:3
Use Counter: 0
Max Voices: 64
Allocated Voices: 0
Memory Size: 134217728
Memory Available: 134176768
Allocated Blocks: 2
SoundFonts: 0
Instruments: 0
Samples: 0
Locked Instruments: 0
Locked Samples: 0
The instruments, samples and all that usually come in certain files, called soundfonts. These can be found on the driver cd that came with your soundcard (please tell me there's a website that has soundfonts). On my case, there was a file called "CT4MGM.SF2" on the cd, and it was just what I needed. Take a copy of it to your HD, no need to use the cd longer than necessary.

Then, you have the soundfont file, or even couple of them. But what to do with it? The soundfont must be installed to the soundcard's memory (which is empty after every reboot). Use yum to install a utility called awesfx, and try loading the soundfont.

Code:
Loading single file:
# asfxload /path/to/soundfont.sf2

Got multiple soundfonts? Load the rest with the -N switch. (meaning incremental loading)
# asfxload -N /path/to/second-soundfont.sf2
# asfxload -N /path/to/more-soundfonts.sf2
Now midi should be set up on the cards end. There's still software to tweak.cat /proc/asound/card0/wavetableD1 shows some numbers now:

Code:
Device: Emu10k1
Ports: 4
Addresses: 17:0 17:1 17:2 17:3
Use Counter: 0
Max Voices: 64
Allocated Voices: 0
Memory Size: 134217728
Memory Available: 130154814
Allocated Blocks: 490
SoundFonts: 1
Instruments: 3560
Samples: 488
Locked Instruments: 3560
Locked Samples: 488
Before you can play midi files, you have to know the output ports. aplaymidi -l prints available ports nicely.

Code:
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 16:0    Audigy MPU-401 #2                Audigy MPU-401 (UART)
 16:32   Audigy MPU-401 #2                Audigy MPU-401 #2
 17:0    Emu10k1 WaveTable                Emu10k1 Port 0
 17:1    Emu10k1 WaveTable                Emu10k1 Port 1
 17:2    Emu10k1 WaveTable                Emu10k1 Port 2
 17:3    Emu10k1 WaveTable                Emu10k1 Port 3
Great, there are the wavetable outputs, let's try them. aplaymidi -p 17:0 song.mid should work. But this is really awkward to use, isn't it? Luckily ALSA_OUTPUT_PORTS variable exists. You can use it like this:

Code:
$ export ALSA_OUTPUT_PORTS="17:0 17:1 17:2 17:3"
$ aplaymidi song.mid
You might want to put that variable to your .bashrc or somewhere where it gets loaded always. And to get the soundfont installed at boot, put the line(s) you used to load the .sf2 file to /etc/rc.local

Theoretically, now all midi players using ALSA should be able to output some funky midi tunes. I don't have many applications to test this, but atleast aplaymidi and OpenTTD work fine.

Filesystem paths and midi output ports may vary on your system. Comments, notes, or feedback appreciated.
__________________
*typetypetype* - My Smolt profile
Reply With Quote
  #2  
Old 27th July 2006, 01:11 AM
Reisswolf's Avatar
Reisswolf Offline
Registered User
 
Join Date: May 2006
Posts: 333
That's nice, but isn't

# yum install timidity++

a much easier way to solve the same problem? That worked for me.
Reply With Quote
  #3  
Old 27th July 2006, 09:10 AM
Darkon's Avatar
Darkon Offline
Registered User
 
Join Date: Jul 2004
Location: Finland
Age: 26
Posts: 76
Yes, that works too. But timidity is a software player, and it uses quite amount of cpu time to do it's job. My way let's the soundcard do the job. Besides, not all applications use timidity to play midi.
__________________
*typetypetype* - My Smolt profile
Reply With Quote
  #4  
Old 27th July 2006, 11:55 AM
martin.sourada's Avatar
martin.sourada Offline
Registered User
 
Join Date: Jul 2006
Location: EU, Czech Republic, Chrudim
Age: 25
Posts: 841
Splendid. I have too Audigy 2 and midi works now for me too. Nice tutorial. Before I tried to use timidity and though it played midis it was software synthesizer and I have low-end machine (Athlon 900MHz) so it didn't played continually and the sound... Hardware synthesizer is much better and if you have good sound font bank, it is splendid. However, I don't know what you mean by that: "
You might want to put that variable to your .bashrc or somewhere where it gets loaded always." Also I would like to know, if somebody knows, what gui applications use that hardware synthesize?
__________________
Fëannatar

Your freedom ends where others' starts.
It's the same with software => promote GPL.

Registered Linux User: #431562
My blog: Martin's Chronicles

Echo Icon Theme: homepage

Nodoka: homepage

Fedora Core future enhancements?

JID: martin.sourada AT jabber.cz
Reply With Quote
  #5  
Old 27th July 2006, 02:25 PM
Darkon's Avatar
Darkon Offline
Registered User
 
Join Date: Jul 2004
Location: Finland
Age: 26
Posts: 76
Just open ~/.bashrc file in gedit (or other editor of your choice) and add the export line there. My complete .bashrc:

Code:
# .bashrc

# User specific aliases and functions

ALSA_OUTPUT_PORTS="17:0 17:1 17:2 17:3"
export ALSA_OUTPUT_PORTS

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi
Now the output ports are always set. You have to log out and back in for that to take effect though.
__________________
*typetypetype* - My Smolt profile
Reply With Quote
  #6  
Old 27th July 2006, 02:30 PM
martin.sourada's Avatar
martin.sourada Offline
Registered User
 
Join Date: Jul 2006
Location: EU, Czech Republic, Chrudim
Age: 25
Posts: 841
Thanks. I understand now.
__________________
Fëannatar

Your freedom ends where others' starts.
It's the same with software => promote GPL.

Registered Linux User: #431562
My blog: Martin's Chronicles

Echo Icon Theme: homepage

Nodoka: homepage

Fedora Core future enhancements?

JID: martin.sourada AT jabber.cz
Reply With Quote
  #7  
Old 12th September 2006, 05:39 PM
uth Offline
Registered User
 
Join Date: Jun 2006
Posts: 117
timidity is a great tool for users who don't have soundcards with wavetable capabilities.

If you do have wavetable capabilities, then timidity will only chew up CPU cycles doing something your soundcard can do natively with almost no CPU overhead.

Also, timidity will give lower sound quality. It uses the sound patches from the Gravis Ultrasound soundcards. These cards were top of the line for 1994 technology. They had 1mb memory tops for playing instrument sounds, so the patch quality is scaled down accordingly. Today's wavetable cards sound quality is limited only by total system ram.

One of my pet peeves was that in the past many programs doing MIDI on Linux only supported timidity. At least now with ALSA, timidity can run on an alsa port, and programs written the right way can choose between timidity, wavetable or external midi synths by setting only the ALSA_OUTPUT_PORTS accordingly.
Reply With Quote
  #8  
Old 12th September 2006, 09:14 PM
Reisswolf's Avatar
Reisswolf Offline
Registered User
 
Join Date: May 2006
Posts: 333
I am really interested in setting up my sound card to play MIDI, but I am stumbling even on the first step. When I type cat /proc/asound/card0/wavetableD1 I get the following:

bash: cd: /proc/asound/card0/wavetableD1: No such file or directory

My system has two card directories in asound: card0 and card1. Neither of them has a file called wavetableD1. I even tried to "find" and "locate" this file on my computer, but no result was returned.

Do I have to create the file manually?
Reply With Quote
  #9  
Old 13th September 2006, 08:13 PM
uth Offline
Registered User
 
Join Date: Jun 2006
Posts: 117
Quote:
Originally Posted by Reisswolf
I am really interested in setting up my sound card to play MIDI, but I am stumbling even on the first step. When I type cat /proc/asound/card0/wavetableD1 I get the following:

bash: cd: /proc/asound/card0/wavetableD1: No such file or directory

My system has two card directories in asound: card0 and card1. Neither of them has a file called wavetableD1. I even tried to "find" and "locate" this file on my computer, but no result was returned.

Do I have to create the file manually?
What kind of card is it? Not all cards have wavetable capabilities

I didn't have to create any files.
Reply With Quote
  #10  
Old 18th October 2006, 10:33 AM
linmix's Avatar
linmix Offline
Registered User
 
Join Date: Jan 2005
Posts: 626
Same problem here; it's an onboard AC'97 soundcard. Any chance it might work?
Haven't found any .sf2 files on the driver cd, so probably not much chance...

edit: name as reported by volume control preferences is:
NVidia CK (Alsa Mixer)
It is also specified as
nVidia Corporation MCP2S AC'97 Audio Controller
and
Intel ICH
__________________
You can find out what book a person needs by asking the question, "Do you want to be a Muggle or a Wizard?"

(1) If they answer "Wizard", then you give them RUTE.
(2) If they answer "Muggle", then you give them "Linux for Dummies."
(3) If they answer "What's a Muggle?", then you give them "Harry Potter".

Last edited by linmix; 18th October 2006 at 11:54 AM.
Reply With Quote
  #11  
Old 18th October 2006, 10:48 AM
linmix's Avatar
linmix Offline
Registered User
 
Join Date: Jan 2005
Posts: 626
Quote:
Originally Posted by Reisswolf
That's nice, but isn't

# yum install timidity++

a much easier way to solve the same problem? That worked for me.
I tried that but it came up empty. Then I checked RPM Search and it tells me timidity should be in core. I've got core enabled and still nothing, and I don't really want to start downloading a bunch of rmp's to see if I can solve the dependency problems. What repo config will get me timidity?
__________________
You can find out what book a person needs by asking the question, "Do you want to be a Muggle or a Wizard?"

(1) If they answer "Wizard", then you give them RUTE.
(2) If they answer "Muggle", then you give them "Linux for Dummies."
(3) If they answer "What's a Muggle?", then you give them "Harry Potter".
Reply With Quote
  #12  
Old 18th October 2006, 04:35 PM
Darkon's Avatar
Darkon Offline
Registered User
 
Join Date: Jul 2004
Location: Finland
Age: 26
Posts: 76
Quote:
Originally Posted by Reisswolf
bash: cd: /proc/asound/card0/wavetableD1: No such file or directory
As said above, not all soundcards can do that. And, the path might vary on your system.

Quote:
Originally Posted by linmix
Same problem here; it's an onboard AC'97 soundcard. Any chance it might work?
My experience from onboard cards isn't really good. But if it has wavetable capabilities, the setup should be the same. Also, note that awesfx supports only emu10k1 chips, and your card might have built-in soundfonts.
__________________
*typetypetype* - My Smolt profile
Reply With Quote
  #13  
Old 5th November 2006, 11:33 PM
stuuu Offline
Registered User
 
Join Date: May 2006
Location: UK
Posts: 12
Thanks!
I've been looking for this for ages until I accidentally stumbled apon it just now.
Reply With Quote
  #14  
Old 6th April 2007, 03:57 PM
maarvarq Offline
Registered User
 
Join Date: Feb 2006
Age: 52
Posts: 25
MIDI instruments

I've followed the advice on this thread, and thanks it all works great (except that I have to open a terminal to get the bash shell to run to set up the wavetable file) and I can play my own midis back, but most of the time I can't play midis I've downloaded. Is this because I don't have the right instrument(s) loaded? I have 904 loaded, but they'd all be pianos and organs I guess. Is there a way to tell what instruments a particular midi needs, or is the problem soemthing else?
Reply With Quote
  #15  
Old 9th August 2007, 02:59 PM
bAer`- Offline
Registered User
 
Join Date: Dec 2006
Posts: 7
Thanks alot, workes great. It even plays with guitar pro 4 in Wine. Good thing, now i'll hardly ever need windows hehe
Reply With Quote
Reply

Tags
emu10k1, files, midi, play

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any way to get MIDI files to play? Iodmys Using Fedora 14 19th December 2012 12:35 AM
I can't install timidity or pmidi to play midi files yersin Using Fedora 4 2nd December 2008 05:56 AM
Midi files won't play, timidity won't start Fibonacci Using Fedora 5 21st August 2006 11:39 PM


Current GMT-time: 13:40 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat