[LAD] Kobo II: Another song WIP

David Olofson david at olofson.net
Sun Nov 6 02:47:35 UTC 2011

Figured this might be of some interest to someone around here - and either 
way, it's all done on Linux, and it will be released on Linux. ;-)

(Original announcement post at the end!)

The whole game engine will probably go Free/Open Source eventually; older 
versions of parts of it already are. The synth engine will be JACKified and 
open sourced as soon as I get around to it! Going to support JACK in the game 
as well, as I use it on my devsystem all the time anyway.

No idea if anyone will ever understand or care for this strange beast of a 
sound engine, but anyway... :-D For your amusement, here's the "lead synth" 
used for the theme and some other melodic features in the song:

CuteSaw(P V=1)
	!P0 sp, +P sp, w saw, p P, a 0, !er .05, !vib 0, !tvib .01
.rt	wg (V + a - .001) {
		sp (vib * 6 + rand .01)
		12 {	-sp vib, +p (P - p * .8), +a (V - a * er), d 5 }
		12 {	+sp vib, +p (P - p * .8), +a (V - a * er), d 5 }
		+vib (tvib - vib * .1)
	a 0, d 5
	1(NV) {
		V NV
		if NV {
			vib .005, tvib .005, er .05, wake rt
		} else {
			tvib .02, er .02
	2(NP) { P (P0 + NP), p P }

Yeah, I was in a neurotically minimalistic kind of mood when I designed that 
language... But, it Works For Me(TM)! Less typing ==> quicker editing. ;-)

(The original version of ChipSound, with a more assembly-like scripting 
language, was less than 2000 lines of C code. It's slightly below 4500 lines 
now, compiler included.)

When playing a note, a voice with its own VM is started, and set to run this 
script. The VM runs in unison with the voice, alternating between audio 
processing and code execution. Thus, timing is sub-sample accurate, allowing 
the implementation of hardsync, granular synthesis and the like without 
specific engine support.

Timing commands can deal in milliseconds or musical ticks, making it easy to 
implement rhythm effects, or even writing the music in the same language, as 
I've done here.

Voices (microthreads) are arranged in a tree structure, where each voice can 
spawn any number of sub-voices it needs. Messages can be sent to these voices 
(broadcast or single voice), allowing full real time control.

Oscillators currently available are wavetable (mipmapping, Hermite 
interpolating, arbitrary waveform length sampleplayers) and "SID style" S&H 
noise. It's possible to use arbitrary sampled sounds and waveforms, but so far 
I've only been using the pre-defined sine, triangle, saw and square waveforms, 
and the noise generator.


	Kobo II: Another song WIP
	"Yesterday, I started playing around with a basic
	drum loop made from sound effects from the game.
	The usual text editor + ChipSound exercise, using
	only basic waveforms. I sort of got caught in the
	groove, and came up with this: [...]"

Full story:

Direct download:

//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
|   http://consulting.olofson.net          http://olofsonarcade.com   |

More information about the Linux-audio-dev mailing list