Version 1.0 (more or less)
Foot-friendly, stage-ready sample player
Copyright (C) Jean Zundel jzu@free.fr 2010-2011
The slampler is a sample player designed for the Linksys NSLU2 running GNU/Linux, but it works on any ALSA-based architecture. It is licensed under the GNU GPL v3.
http://jzu.blog.free.fr/index.php?tag/Slampler
Just type make
and you're done. You'll need libasound2 and libpthread
libraries (+devel), and gcc.
Running it as root allows to use the Slug's LEDs.
This program needs an USB joystick - or something similar - to operate
in "production mode". For testing purposes, another thread reads STDIN and
scans characters you can map with samples. It currently manages up to eight
samples per bank, but there's room for expansion. You will need to tinker with
#define
s to map the physical controls with the soft switches.
The -d
option ouputs debug messages, ALSA errors and joystick events.
The /data
directory should contain NBANKS (3 by default) directories
containing NSMPLS (5 by default) samples which will be read in
alphabetical order (case-sensitive), allowing a fixed sample/switch
mapping.
An optional /etc/slampler.conf
will be read if it exists. Current parameters
include the ALSA device used, and the numbers of banks and samples. You can
edit a copy of the slampler.conf.sample file which comes with this archive.
Once you're all set, you want to edit /etc/inittab
to insert this line:
sl:23:respawn:/[PATH_TO]/slampler
(obviously replacing [PATH_TO]
with its actual path)
which will ensure that init(8)
restarts the program when it is stopped.
telinit q
will re-read the inittab file.
Mounting the /
filesystem read-only prevents data corruption, but you have to
create ramdisks for /tmp
and /var/run
directories in /etc/fstab
.
/dev/sda2 / ext3 ro 0 0
(...)
none /tmp ramfs size=512k 0 0
none /var/run ramfs size=512k 0 0
The datamount
process is optional. Running it requires this line in
/etc/inittab
:
dt:23:respawn:/[PATH_TO]/datamount
Activating eth0 mysteriously fails with readonly filesystems, so
this kludge in /etc/rc.local
temporarily switches to rw
,
ifconfig
s eth0, then switches back to ro
.
mount /dev/sda2 / -o rw,remount
ifconfig eth0 192.168.0.106
sleep 1 # Yes, you really need it. Whatever.
mount /dev/sda2 / -o ro,remount
Debian is perfect for programming/compiling/debugging, but another distro might be more adequate for everyday use. See OpenEmbedded and others.
Almost any USB audio interface will do. These el cheapo ($3 on eBay)
C-Sound/3D Sound dongles, however, should be avoided, unless you
like hiss and rumble. Mine registers in dmesg with a line containing
idVendor=0c76, idProduct=1607
. Currently, I use an ART USB Phono
Plus with good results - I have yet to give the Behringer UFO202
($27) a try.
Using a memory stick containing the samples is not as trivial as it seems. If you plug it directly in one of the Slug's USB internal ports, it will be detected before the boot USB key and the system will hang. Autofs doesn't help us very much here since the directory is already used by the running process, which has been started by inittab - even when stopping/restarting the process.
This is why datamount has been written, which detects insertion or removal of
the device and (u)mount
s it accordingly, restarting the slampler
process.