MIDI on Nokia770 with TimidityWhile recent Nokia phones handle Midi-Files quite well, so far the support on N770 was missing.
Here is how to get them played.
Requirements
- get my binaries for Timidity timidity-2.10.4_N770bin.tar.gz [This is an older version of timidity, but runs much faster than 2.13.0, see here:
timidity++2.13.0_N770bin.tar.gz ]
- you need some Instruments to play your MIDIs, definitely NOT a huge footprint, so I recommend 2MBGMGS.SF2 (usually shipped with some soundcards) or take some small .pat files for single instruments (see timidity.cfg)
- and of course: some midi-Files of your choice.
- xterm ... as there is no GUI so far (besides "ncurses")
InstallingUnpack the binary (
tar -zxvf timidity++2.13.0_N770bin.tar.gz) to for example
/user/home. This will create a subfolder
timidity.
Place
2MBGMGS.SF2 and you MIDI-Files in the same folder for the moment.
As timidity will look for its config in
/etc/timitidy.cfg , place there
a link:
ln -s /home/user/timidity/timidity.cfg /etc/timidity.cfg
For convenience, you may also want to place a link to timidity somewhere to your path.
UsingIn the timidity-folder enter
./timidity -in *.midAfter a few seconds, it will start playing. Otherwise, check the path in timitity.cfg.
With the ncurses interface (-in) you can use the hardkey arrows for midi volume, etc.
Use 'q' to quit, 'n' for the next song. Sufficient interfacing and nostalgic as using timidity first time back in the 90th.
Why MIDI?
Well, there is already a text editor and python on the N770... So, if you want to create ringtones on the road, have a look at
MMA (Musical MIDI Accompaniment). You can basically script some tunes, it has more than 50 presets for auto accompaniment.
Well, rather "Band in the Pocket" than "Band in a Box" ;-)
In brief: Download and extract (
tar -zxvf mma-bin-0.20.tar.gz) , no need to install it, simply
cd mma-bin-0.20 and run
/var/lib/install/usr/bin/python2.4/python mma -gThis takes a while as it updates the MMA library. Now you can "re-compile" any of the demo songs in order to verify it works:
python mma ./egs/lyrics/twinkle.mma
UPDATE...After just finishing with the first version of this post (2.13.0 of Timidity++), I decided to give an older version a try (2.10.4). This was a complete success. Some options had a different format, so the timidity.cfg also incorporates some slight changes. Additionally, I changed timidity.h in order to use some slow CPU defaults and removed some Tracker-Formats. The binary is now way smaller. The part below the line is for later reference - maybe the newer Timidity will improve.
Performance issue...Latest versions of Timidity seem to be a bit slow due to higher standards in playback quality. However, I remembered that I was using it back in the old times on a 100MHz system.
It is crucial for playback on the N770 to disable many of the new features, see
timidity.cfg for this:
opt EFresamp=d #disable resampling
opt EFvlpf=d #disable VLPF
opt EFreverb=d #disable reverb
opt EFchorus=d #disable chorus
opt EFdelay=d #disable delay
#opt no-anti-alias #disable sample anti-aliasing
opt EWPVSETOZ #disable all Midi Controls
opt p16a #default to 32 voices with auto reduction
opt s32kHz #default sample frequency to 32kHz
opt fast-decay #fast decay notes
opt output-mono # MM: Speaker of N770...
Please add Comments to this Post if you found out additional options.
Also see
http://timidity.sourceforge.net/ for more infos on Timidity.
The ncurses-Interface can in principle be used (add
-in to the command line options), but this slows down and your MIDI-files might sound choppy.
The slow startup is probably due to the unpacking of the Soundfonts (.sf2). If you know a 1MB GeneralMIDI set (either .pat-Files or a .sf2), please post here a link. Also, an older and simpler version of timidity might perform better.
Some comments on compilingThe 770 uses the ALSA sound system
Nokia770-51:/home/user/timidity# cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.9rc2 (Thu Mar 24 10:33:39 2005 UTC).
However, it returned me finally some errors on the device, probably some version conflict with libasound. The Enlightened sound daemon seems to be available as well, so use the esd-option:
./configure --enable-interface=ncurses --enable-audio=esd
Afterwards, compiling in the scratchbox (ARM/QEMU target) was straightforward.