Posts Tagged ‘midi’

Playing midi with audacious & AMidi plugin

I use the audacious player with AMidi plugin for playing midi files (and most audio files). There are two choices of backends – Timidity and Fluidsynth. I used to use the Timidity backend but found that lately the playback keeps skipping with my soundfonts, so I switched to the Fluidsynth backend and it’s much better now.


Read Full Post »

I’ve added a custom file browser and playlist function to my pyGTK MIDI player. The file browser is more lightweight and read files faster than the GTK FileChooser widget on the Nokia Internet tablet. The GUI is nothing fancy but it works.

Download playmus version 0.2

I don’t think I’ll try to determine the MIDI song length. It’s too much trouble to do for a simple player app.

Along the way, I learnt how to use the GTK Tree widgets to do the list boxes, and I think they are one of the more powerful frameworks in the GTK suite (they can do much more than just simple list boxes), but for simple list boxes there’s a lot of setup to do. Perhaps I should start writing higher-level abstractions to make it easier to create simple GUI programs.

Read Full Post »

Timidity problems solved

I figured out what’s wrong with my timidity patches. That shrill noise in some of my midis came from a whistle in the drum patches that has been looped in the eawpats config files. Removing the loop setting solved the problem. I think I’ll stick with eawpats since freepats is missing quite a number of instruments.

Read Full Post »

playmus screenshotWrote my first PyGTK program for my Nokia 770. It’s a simple GUI midi player that uses the PyGame module. It works pretty well, although while testing the app PyGame sometimes couldn’t initialise and the only option is to reboot my device. But my final round testing seems to be quite stable. Python rocks on the Nokia 770!

Download playmus.py

I’m thinking of putting in other stuff like song repeat, fade out, perhaps a progress bar (if I can find out the midi file length, coz PyGame doesn’t have that API) or even a song shuffle feature.

Read Full Post »

Now that I’ve figured out how to play midi using pygame on my Nokia 770, I’ve been tearing my hair out the last couple of days trying to make pygame midi work on my Ubuntu box, so that I can do some development with it. I just couldn’t get any sound out my pygame script.

Actually timidity and pygame WILL co-exist happily out of the box, but with a caveat – you will have to use the lowest common denominator, which is SDL_mixer’s timidity implementation. That means none of those fancy options like reverb or soundfonts, and using GUS patches only. Both timidity and Ubuntu’s build of libSDL_mixer will look in /etc/timidity/timidity.cfg, so there is a conflict there. However, I need my soundfont, as neither freepats nor eawpats will all play my midi files properly.

Here’s how I make them co-exist. First edit /etc/timidity/timidity.cfg to work with pygame (I just source /etc/timidity/freepats.cfg). Then configure timidity to start as an ALSA server (which I’m already doing). Set TIM_ALSASEQ=true and add “-c [location of bigger and better timidity.cfg]” to the TIM_ALSASEQPARAMS settings. Restart the timidity server using “sudo /etc/init.d/timidity force-reload” (restart doesn’t work for me).

This will cause pygame to use the settings in /etc/timidity/timidity.cfg, and timidity and other programs such as KMid and Audacious (with the AMidi plugin) to use both config files. I’m not sure how the GUS patches will interact with the soundfont, but so far it seems to work well.

I’m still less than satisfied with freepats or eawpats though. Missing instruments, weird chirping sounds, etc. Anyone knows of a more complete set? Or perhaps it’s an SDL problem?

Or perhaps the SDL folks should consider updating to the current timidity instead.

Read Full Post »

Midi on my Nokia 770

When I got my Nokia 770, I’ve always wanted to have midi playback. It’s funny that something that came out of Nokia couldn’t play midi files when all their phones could.

It has been reported that timidity compiles for the Nokia 770, but the binary that’s floating around on the Web doesn’t work for me, and funny no one else ever bothered to build and distribute a port. well, I’m too lazy to download and set up the Maemo development environment and mess about with cross-compilation. So what am I to do?

There is another way. I already have Python 2.5 installed, which comes with PyGame and which is supposed to support midi. I’m not sure if libSDL_mixer came on board or with Python or with something else I installed, but it’s there on my device and I read that PyGame actually uses it for midi playback. It contains some really ancient version of timidity (read: no SoundFont support for you!). So I got some GUS instrument patches instead, set up timidity.cfg (it must be in /usr/local/lib/timidity/timidity.cfg), wrote a little Python script and yay it works! ^_^

It’s not that perfect though. I threw a few midis at it. It can’t read some of them, not sure why. For some others, at some point there would be a shrill noise in the background (is that a particular instrument or just the player being overloaded/screwing up?) It does seem to work the CPU quite a bit though. But I could play some files all the way through, not bad.

Need some more testing, perhaps other instrument patches might work better, but I’m quite happy to have found a solution without doing all that cross-compilation stuff. I may post more details and instructions if it turns out well. ^_^

Update: I think it’s instrument patches that are causing those funny sounds, perhaps something in the drumset. I switched to the standard freepats instruments and it works much better now – I still get funny noises with some midi files but they are not that long shrill I get earlier. And it plays everything I threw at it. Earlier on I used the instrument set from the libsdl website. I’m sticking to the larger freepats instruments now – you can put them on the media card so don’t have to worry so much about storage. Perhaps someone who knows what’s happening can advise me how to improve the playback quality.

Read Full Post »