Last week I added native multichannel audio output support to UADE. UADE stands for Unix Amiga Delitracker Emulator which is an audio player for old Amiga demo music and game tunes. It is based on a clever client server concept, where the clients (= player frontends) communicate via inter-process communication with the server. The server uses the UAE Amiga emulator to emulate an A500, which executes a native Amiga software that uses Eagleplayer plugins to play the tunes. Finally, Eagleplayer plugins cover over 150+ different audio formats including many exotic custom formats.
Now, all Amigas had four separate 8 bit audio channels which were downmixed to stereo inside the PAULA sound chip. Moreover, old Amiga models before A1200 had an inbuilt static tone-shaping low-pass filter at 4.5 or 5 KHz and an optional LED low-pass filter at 3.3 KHz. These filters were applied to the stereo mix. Of course, the UAE emulator does the same as the hardware: audio output is a stereo mix which is optionally filtered (can be enabled/disabled). The resulting stereo stream is finally sent to the UADE frontend(s). E.g.
uade123 frontend can store the stream as two channel wav file.
And that’s the problem: from the mixing and mastering perspective an already downmixed stereo wav file is of course much worse compared to a multichannel wav file. Wouldn’t it be great if one could stream the contents of the original four PAULA channels before they are downmixed to stereo ? Exactly this was what I needed and so I started to study and modify the original UADE source code. The result is a modified UADE 2.13 version with a new
uade123 command line option
--quadmode. The filters still can be applied, but in quad mode they are applied to each channel separately.
The quad mode audio output stream can either directly be played via soundcard (libao), or saved into a multichannel wav/au file. If the sound system provides multiple hardware channels, media players can usually replay the multichannel file directly. If it’s a stereo setup, most players are able to downmix the four channels to stereo – with different results, though.
If you want to mix a tune: most modern DAW’s can load multichannel wav files. E.g. Cockos Reaper, Logic and so on. I used Reaper 4 and it’s surround mixer for a quick sound check. Reaper can also automatically split up multichannel files into separate mono channel files. If your DAW doesn’t support that, you can use the included
split_quad.sh script which does the same. You have to install
Debian package for Ubuntu Mint 15 64:
# from source (Linux Debian Systems)
sudo apt-get install libao-dev
sha1sum -c uade_2.13q.tar.bz2.sha1
tar -xjf uade_2.13q.tar.bz2
# optional sound test, plays demo song
sudo make install
hash -r # only if bash can not find uade123
# optional regression test,
# all checksums should be different
# If test fails, enter correct data dir in test_quad.sh.
# e.g.: UADE2_DATA_DIR="/usr/local/share/uade2"
# From Debian package (only Ubuntu Mint 15 64 !)
sha1sum -c uade_2.13q_amd64.deb.sha1
sudo dpkg -i uade_2.13q_amd64.deb
hash -r # only if bash can not find uade123
# generate multichannel wav file
uade123 --quadmode --filter=none -f output.wav AHX.Cruisin
# split multichannel file into four mono channel files
# Have fun
AUDIO REPLAY HINTS
If audio replay crackles or is kind of slow check the used ao driver, first. For that have a look at
/etc/libao.config. If default driver is “alsa” try “pulse” instead. For detailed information remove the “quiet” option and optionally add “debug” option.
Regarding multichannel replay: if you have problems with direct four channel replay (e.g. channels are not hearable, or very quiet, or left/right is wrong), then try to render to file using
uade123 --quadmode -f out.wav and replay this file using mplayer or any other media player. There’s a
split_quad.sh script included for splitting up the four channel wav file into four mono channel wav files. IMPORTANT: you have to install “sox”, first.
Always remember that all Amiga tunes are actually stereo tunes. Means: the original composers created and mixed them for plain stereo replay. Moreover, most Amigas were connected to crappy monitor-inbuilt speakers, or other crappy little desktop speakers. Means: the usual audio setup didn’t have a wide stereo stage, it was actually more mono than stereo. Now, if you replay such tunes using a quad or surround setup it can sound pretty odd. Especially there is much more channel separation. To fix this, you can e.g. use a surround mixer or auto stereo downmixer or further post processing fx whatever. BTW: the same problem occurs if you replay old Amiga tunes via headphones or a hifi stereo setup. Nonetheless: the strong channel separation can also be pretty charming, because nothing masks and every detail is hearable. For remixers only: remember, good surround mixes should be stereo compatible, good stereo mixes should be mono compatible.
Multichannel channel assignment under Linux and in general is a mess. There are so many factors/components: libao, audio drivers, different multimedia players and so on. Each component handles multichannel audio order slightly different: some players just omit channels 3+4, others play them but treat them as center channels etc. and thus distort the original stereo image. Then, if you don’t have a real multichannel soundcard, stereo downmix is handled differently and so on. I tried several combinations as described in libao documentation, but each matrix had it’s disadvantages. It turned out that omitting any specific matrix seems to be the best solution. A really suitable surround matrix for correct Amiga stereo imaging (L=1+3, R=2+4) doesn’t exist anyway, though classic quadraphonic matrix L,R,BL,BR and matrix L,R,CL,CR are theoretically useable. Funny: it turned out, that Windows Media Player did the best job regarding multichannel stereo summing. It was the only player that did it correctly.
It’s theoretically possible to set libao options via uade123 command line. E.g.:
uade123 --ao-option=matrix:"L,R,CL,CR". Probem is: somehow it didn’t have any effect ?