[linux-audio-dev] Simple music sequencer/sample player (drummmachine?)

David Olofson david at olofson.net
Thu Jan 4 14:47:40 UTC 2007

On Thursday 04 January 2007 00:32, kind king knight wrote:
> Those programs are to complicated. I need a toy to learn from it (it
> should be simple, but written using good techniques). I tough more
> about something like Hammerhead (
> http://www.threechords.com/hammerhead/ ), or 
> even something easier (no gui, one soucefile).

Well, it's not a single file, it's got a very minimalistic tracker 
style GUI, and it's using SDL, but it does what it does in about the 
simplest but (hopefully) correct way:

	http://olofson.net/mixed.html		(DT-42)

> >/dev/dsp represents a deprecated interface. 
> >moreover, what happens when someone wants to route the output of
> >your 
> >cool, modified mod player through FreqTweak or jack_convolve?
> Like I said,  want to learn from it, so I don't need a complicated
> soundserver support (but I don't say that I won't ever use it).

Well, either way, DT-42 uses the SDL audio API. (Which is a lot easier 
to deal with than OSS or ALSA.) Like JACK and any other serious audio 
API, this API is callback based.

There are some remaining, interesting issues that need fixing.

For example, quantization during real time recording (which has to 
deal with arbitrary audio latency) doesn't really do what it's 
supposed to. It always rounds down, because the looping 
implementation isn't safe with recording with "negative delays". (To 
push a note forward, you'd have to run ahead of the sequencer, 
looking for loop commands and stuff, or you could end up putting the 
note some place the sequencer will actually never go.)

Another issue is the locking of the sequencer that is done when the 
GUI messes with things. To make it totaly real time safe, one has to 
use a different approach. As it is, you might end up with the GUI 
having a "hickup" while holding the lock that prevents the real time 
thread from running...

Figuring out how to do these things properly might be a good 
exercise. ;-)

> If there isn't such program, then maybe someone could write it for
> me :D.

Way ahead of you...! :-D I wrote DT-42 almost exactly a year ago.

//David Olofson - Programmer, Composer, Open Source Advocate

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'

More information about the Linux-audio-dev mailing list