openMSX & timidity? (Emulation MSX Forum)MSX Resource Center               
              
English Nederlands Espa�ol Portugu�s Russian         
 News
   Frontpage
  News archive
  News topics

 Resources
   MSX Forum
  Articles
  Reviews
  Fair reports
  Photo shoots
  Fairs and meetings
  Polls
  Links
  Search

 Software
   Downloads
  Webshop

 MRC
   Who we are
  Join our team
  Donate
  Policies
  Contact us
  Link to Us
  Statistics

 Search
 
  

  

 Login
 

Username

Password




Don't you have an account yet? Become an MSX-friend and register an account now!.


 Statistics
 

There are 35 guests and 2 MSX friends online

You are an anonymous user.
 

MSX Forum


MSX Forum

Emulation - openMSX & timidity?

Author

openMSX & timidity?

Sousuke
online
msx freak
Posts: 154
Posted: April 29 2007, 04:00   
Hi!

As the topic already says... is it possible to pipe the midi-data to an alsa-sequencer? Like timidity?

Sousuke
manuel
msx guru
Posts: 3545
Posted: April 29 2007, 12:30   
AFAIK Timidity can't interpret raw midi data, only MIDI files. Which is different... But I don't know much from MIDI, so maybe someone else can explain it better.
Gilneas2
msx freak
Posts: 177
Posted: April 29 2007, 12:31   
Have you experimented with it a bit?
Is all the audio played when using A1GT of midi form? Or do you need to play something specific?

The manual has a paragraph about midi, I tried something like this:
set midi-out-logfilename ~/openmsx.mid
plug msx-midi-out midi-out-logger

But it gives an error saying
plug: plug failed: Error opening log file

Even after I made the file.
I think it's expecting a node file the same as /dev/midi, but I don't have a /dev/midi and no idea what it's specifics need to be.

On Google I hear something like "mknod midi c 14 2" (as root, in a dir readable by openmsx user), and probably a "chmod o+rw midi", but this gives me the same error as before
manuel
msx guru
Posts: 3545
Posted: April 29 2007, 13:13   
I've experimented a bit now, and I actually managed to get the MIDI sound heard

I was using FluidSynth, which is a MIDI soft synthesizer that can take just MIDI events. (That is what is logged. You are NOT logging to a MIDI file! What is logged are just the MIDI events that would have been sent to a MIDI device. A standard MIDI file has timing information, but these events occur real time!)

I created a named pipe:
$ mkfifo /tmp/pipe

Then in openMSX I did:
set midi-out-logfilename /tmp/pipe
plug msx-midi-out midi-out-logger
(at this point openMSX hangs, because no one is reading the pipe)

Then I started fluidsynth like this:
$ fluidsynth -o midi.driver=oss -o midi.oss.device=/tmp/pipe
(at this point openMSX continues, because fluidsynth is connected to the pipe)
Note: I also specified a sound font, the one that came with my sound card (8mbgmsfx.sf2)

I ran MoonLight Saga and the MIDI sound was audible

(Note: for some reason I didn't get it working with the alsa and alsa_seq driver of fluidsynth...)
Sousuke
online
msx freak
Posts: 154
Posted: April 29 2007, 16:57   
The fluidsynth method seems to work, thx manuel!

About timidity... it can also be run as an ALSA sequencer (option "-iA" ), so it's not just a midi file player.
Therefore I thought of piping the midi events to it. I've also experimented a bit with this idea, and it seems to work!
1. Start timidity in ALSA sequencer mode
2. I've loaded the virtual midi driver (snd_virmidi). The device nodes are placed in "/dev/snd/midiC1D#". There are 4 virtual devices, replace # with desired device.
3. Use "aconnect" to connect the virtual device's output to timidity's input.
4. Set midi logger to one of these devices, and start logging
5. Enjoy

Unfortunately I'm still looking for a neat soundfont (fluidsynth) or for a nice patch (timidity). Sounds horrible till now...
Gilneas2
msx freak
Posts: 177
Posted: April 29 2007, 18:46   
Good to hear you got it working.
Not so much for me, (I have no /dev/snd/seq, and a named pipe for openmsx also gives the error I had before (i.e. and it doesn't hang))
but that's alright.

I have two 250MB soundfonts called crisis_gm18 and crisis_gm26. they don't really work for game music though, I pretty much hardly ever use them. I prefer my "4gmgsmt.sf2" from Creative SB Live. (it's only 4MB)

A few years ago I went through dozens of crap soundfonts from several internet sites. It's really a tough search. (don't shy away from p2p for it)
manuel
msx guru
Posts: 3545
Posted: April 29 2007, 19:20   
Gilneas2, I'm a bit surprised you got those errors. If you join us on IRC, we could try to find out what's causing them. Clearly, for some reason openMSX can't get files opened... but why?? Other logging works fine? LIke printer or RS-232 output logging?

Sousuke: I tried with the -iA option, but I didn't understand it completely and I couldn't find helpful docs. Thanks for finding out how it works!

By the way, with the soundfont I mentioned it also sounds a lot worse than on my real MT-32... Mapping seems to be a bit different or so.
Sousuke
online
msx freak
Posts: 154
Posted: April 30 2007, 12:38   
Gilneas2:
Quote:

I have no /dev/snd/seq

Hmm, no /dev/snd/seq? Did you include ALSA sequencer into your kernel (either built-in or compiled as module)? Seems to me like that's missing.

manuel:
Quote:

I tried with the -iA option, but I didn't understand it completely and I couldn't find helpful docs.

timidity has the possibility, to act as a ALSA sequencer client. It registers itself as a sequencer device and wait's for incoming MIDI events, just like a real device.
If I'm not mistaken, ALSA does not expose their sequencer devices as device nodes anymore. (hence the sequencer ports)
So... timidity *could* interpret these events and output nice sounds. The connection between openMSX and ALSA's sequencer port (to timidity) is missing.

Seems that ALSA's virtual midi device is especially made for this. This virtual device registers itself in ALSA's sequencer, and exposes itself as device nodes. (/dev/snd/midiC?D?, C = card #, D = device #)
Now it's just a matter of connecting these two points, and voila...

Btw, fluidsynth could also be used this way. So you don't have to create an named pipe. Perhaps this is a nice alternative?

Quote:

By the way, with the soundfont I mentioned it also sounds a lot worse than on my real MT-32... Mapping seems to be a bit different or so.

I've read here that the standard MT-32 soundbank is indeed arranged different from the Geneal MIDI one.
Try this soundfont. Perhaps it'll sound a bit better? That's a rearranged CTM8GM soundfont

Quote:

Thanks for finding out how it works!

No prob


Does there exist a soundfont, which is similar to MT-32's? Or are they proprietary? Aaaah, I want to hear, how it sounds on a MT-32
Cuz the mp3's at adriano's translation page aren't downloadable now, without the login datas...
manuel
msx guru
Posts: 3545
Posted: April 30 2007, 14:21   
Um, I don't have any of those virmidi ALSA modules on my system... WHere do they come from?

Anyway, M.L.S. sounds already better with that other soundfont. A problem is that some instruments 'hang' (also happens on a real machine with real MT-32)... Also, after GAME OVER, the game seems to crash when pressing space. THat's a bit odd and could be an emulation bug or so.
AuroraMSX

msx master
Posts: 1262
Posted: May 01 2007, 20:41   
Gilneas2: Check if the sequencer module for your sound card is loaded:
lsmod | grep snd-seq
You may need to load the sequencer module manually
modprobe snd-seq
or put it in /etc/modules (or where ever your distro likes to have its modules to be loaded on boot time). Make sure you load the modules specific to your sound card before loading snd-seq...

I have the following /etc/modules:
snd_cs46xx
snd_bt87x
snd-seq
the cs46xx is my sound card, the bt87x the 'sound card' of my tv-tuner card. I need to put them here and in this order to make sure that the kernel loads them in this order, so I don't end up with the tv-card as my primary sound card I guess snd-seq could be squeezed in between the two other modules, but definitely after the snd_cs46x!
Sousuke
online
msx freak
Posts: 154
Posted: May 01 2007, 21:14   
manuel:
The virmidi module should be included in the kernel.
In mine (vanilla, 2.6.20.3), it's located at: Device Drivers -> Sound -> ALSA -> Generic Devices -> Virtual MIDI soundcard.
manuel
msx guru
Posts: 3545
Posted: May 01 2007, 21:24   
Ah, I do have it. But it's not loaded by default
 
 







(c) 1994 - 2008 MSX Resource Center Foundation. MSX is a trademark of MSX Licensing Corporation.