[chuck-users] polyphony (what happens after note off)? was: Killing thread from without

Hans Aberg haberg at math.su.se
Sun Apr 26 15:44:08 EDT 2009

On 26 Apr 2009, at 20:15, Kassen wrote:

> I'm pasting a edit of the last version Hans send to the list based on
> this strategy below.

Thank you. I have been focusing on implementing octave shifts,  
transpositions, and different tuning systems, but I add a copy here of  
what I currently have. The playing area has been extended with a few  
keys, and some bug fixing.

The caps lock is a octave up shift, as to extend the keyboard when  

The left shift key plus a key on the number row sets an octave shift;  
key 4 = middle octave, though written as 0.

The option key plus a playing key center the tuning frequency on that  
key. For reference, the key next to the left shift key always plays  
the tuning frequency (currently 440 Hz).

The left shift key plus a key on the two rows closest to it sets  
various tuning systems, with increasing minor second m from left to  

It is interesting to play C# Db, and listen to the changes. E12 should  
have no beats, of course.

> the basic strategy is starting a few voices, hopefully a amount our
> cpu can take. When a new key is pressed it will be assigned to the
> voice that already had that voice linked to it. If no such voice is
> found it'll take the voice that's not currently playing and gone
> longest since the last note off. When all voices are currently playing
> it'll steal the one that has gone longest since the last note on.
> No sporking and probably no garbage (I didn't verify the second part
> of that claim).
> There are likely some issues with this; while the strategy should be
> sound I wrote this quite quickly.

So its good with input on voices.

> I also changed the indentation style
> after getting confused about a "else" in the main loop.

I use a fairly common, more compact C/C++ style.

I also avoid using tabs, instead using two spaces, which are  
expressive enough. Unix tabs are traditionally set at 8 spaces, which  
is too much, and there seems to be no good way to avoid it set at that  
in various circumstances.

> This is
> roughly the strategy hardware synths take; the amount of cpu used
> should be more or less static, clearly something more advanced is in
> order when we need to run several instruments on the same computer but
> I took this setup to be meant for a solo instrument.

I haven't had any problems with CPU overload in the code in the  
attached code. I have tried it for extended periods of time.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: diatonic.ck
Type: application/octet-stream
Size: 8321 bytes
Desc: not available
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090426/f08d9a7b/attachment-0001.obj>
-------------- next part --------------

More information about the chuck-users mailing list