Click to See Complete Forum and Search --> : Audio-Midi infrastructure in Linux - How to?


micro
11-09-2005, 08:47 PM
My recent testing of Suse 10.0 was very pleasing. I found not only common applications that I would search for and most probably compile, but also a good list of audio/midi applications. Some are:
Rosegarden
MusE
Lmms
Jack (Audio-sequencer-sound server)
Timidity (Midi to wave converter-player)
Noteedit
Qjackctl (frontend for Jack)
Fluidsynth (software midi sequencer)
QSynth (frontend for Fluidsynth)
Lilypond (ok, this I had to find and install).
Many sound samples-banks.

Now, my prime difficulty is to make Jack, Fluidsynth and Timidity to run successfully, that is connect with Alsa correctly, set up midi ports, load sound banks, "see" the hardware midi, make all these available to the programs etc.

Since I haven't managed to do so, Rosegarden, MusE and Lmms do not run correctly and I know I lose a lot since they would help me in my main occupation.

Is there a site (or a friend here) with step by step instructions on how to bring the needed infrastructure up and finally use my linux box in music? As I just saw, it is not that easy.

bwkaz
11-10-2005, 07:47 PM
Hmm. I believe timidity is used for software-MIDI, not hardware-MIDI. If you have MIDI capabilities on your sound card, it may be MPU-401 compatible, in which case you would just do this as root:

/sbin/modprobe snd-mpu401 port=0x330 irq=5

(At least, I think that worked for me. I haven't tried it yet though.)

Then, a /dev/snd/midiC?D? device file should have been created for you (numbers will be in place of the 2 question marks).

I think most MIDI-playing programs that use Alsa should support that file. If not (if they want /dev/snd/seq instead), then snd-opl3-synth may work, depending on your sound card.

Also, while JACK looks like it'd be nifty, I don't believe it's necessary, especially for MIDI. I believe it's for PCM sound (/dev/dsp, etc.).

(In fact, I haven't done much with hardware MIDI, even though I believe my card supports it. I just installed timidity and did it in software. Most of this is guessing.)

ehawk
11-11-2005, 12:06 AM
I just used synaptic to install timidity and freepats (an sound bank extension to timidity which makes for much richer sound, I think). Seems to work great. I would think you should be able to install timidity and freepats via YAST.

micro
11-11-2005, 05:28 PM
My already loaded sound modules are:
snd_ens1371 23136 1
gameport 14600 1 snd_ens1371
snd_rawmidi 24864 2 snd_seq_midi,snd_ens1371
snd_seq_device 8588 3 snd_seq_midi,snd_seq,snd_rawmidi
snd_ac97_codec 90876 1 snd_ens1371
snd_pcm_oss 59168 0
snd_mixer_oss 18944 1 snd_pcm_oss
snd_seq_midi 9760 0
snd_seq_midi_event 6784 1 snd_seq_midi
snd_seq 51984 2 snd_seq_midi,snd_seq_midi_event
soundcore 9184 1 snd
snd_page_alloc 10632 1 snd_pcm
snd_ac97_bus 2432 1 snd_ac97_codec

/dev/snd/midiC0D0 already exists.
The command "cat /dev/snd/midiC0D0" does not do much, but it does not return any error.

Timidity works fine. if I say "timidity -iA &", I daemonize it and Alsa can use it as a device. Not that I solved everything but it's a start. I will search for freepats. Thanks ehawk.

My problem is Jack. Muse needs Jack to work, and Rosegarden is happier when Jack is up. But actually using needs more than just bringing Jack up.
A command like this daemonizes it: jackd -d alsa -d hw -r 44100 -p 2048 -n 2
But even so, Muse opens but complains and using Jack does not produce sound.

Considering advanced sound setup in Linux, I am a complete newbie.

micro
11-14-2005, 04:25 PM
I found a way at last.
First, we stop the sound servers that use Alsa, like Arts or EsounD.
(we go to the control centers and disable sound)

Second we call jackd:
jackd -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0
-D stands for full duplex
-C is the capturing alsa device
-P is the playback alsa device.

Third, we call the control centers and configure e.g. Arts to use the Jack server and NOT Alsa.

Fourth, we configure applications like XMMS to use Jack or Arts.

Fifth, we call Qsynth (that uses Fluidsynth) and load a "sound font" type sound bank. Careful though, there is a possibility that a sound bank does not produce sound, but other banks will. I will investigate this issue.

Sixth, we call timidity to play a midi file, including the "-Oj" option and it works.

Seventh, we run MusE, create a midi part, go to the Midi setup menu and find that the sound bank can be seen and used. If we import a midi file replacing everything and set up the devices correctly, Jack will redirect all midi data to Fluidsynth.

Jack is a sound server. All applications using it in the same time will work

How to make this work for ever? The proposed sound setup requires Jack to work all the time. We could enter the jackd command in a file called ~/.jackrc, but there are applications that do not call jack automatically.

My solution would be to include this line in /etc/rc.d/rc.local:
su username -c ' jackd -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0'
replacing the username with the main user in our Linux box.

But there has to be a smarter way.

micro
11-14-2005, 08:15 PM
I thought of a way to start jackd once for each user, but I have some difficulties.
If we put in /etc/profile the command:
--------------------------------------------
test -z "$(ps -u $USER | grep jackd)" && \
jackd --silent -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0 &
-------------------------------------------------------------------------
Then jack will start but there is a problem. We have to hit enter in order to use the terminal. Jack does not have an internal command to go to the background completely and does not behave well starting and going to the backround.

I tried another syntax:
------------------------------------------
if [[ -z "$(ps -u $USER | grep jackd)" ]]
then jackd --silent -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0 &
else echo Jack Server for user $USER already running
fi
---------------------------------------------------------
Well, in this syntax I am luckier. In 50% of the tries, I get a command line without having to press enter. Is there a proven method for 100% success?

micro
11-23-2005, 08:57 PM
Ok. It took a while but I made a page to help and explain music-sound issues in Unix-compatible OSes. Among other things, I also mention the Jack issue and some scripts to make work easier.

It is called ComposeMe, under my GNU/Linux page. Tell me whether it is helpful.

ladoga
11-24-2005, 10:17 PM
Nice page you have there.

I got stuck on reading the Borg section and forgot about the work tomorrow.
Oh... time to go to bed.

micro
11-25-2005, 08:58 AM
Thanks about the Borg page :)
I really needed to write something about them.