[chuck-users] instrument design considerations
Atte André Jensen
atte.jensen at gmail.com
Tue Jul 11 17:56:13 EDT 2006
I'm wrestling with some mostly conceptual problems that I'd like to get
some feedback on. I hope some of you people take the time to discuss
this with me. It's not about chuck bugs, it's not about
how-do-i-use-this-chuck-construct, it's about how I get my brain dead
brain around a design problem for something that I really would like to
do in chuck.
Long story short: I'd like to be able to record sniplets of midi into
chuck and grow it (by performing various transformations). For this to
work my instruments need to work with noteon/noteoff, since that's what
gonna happen with midiin.
Currently I have a really simple, well working way of doing instruments
by making each instrument a static member function of an Instruments
class. Each function (might) take a length parameter indicating how long
the instrument should sound before going into it's release phase.
From a coding point of view I prefer my current instrument definition,
but if it should work with midi I need to make instruments work with
noteon/off. I'd like to be able to use the same instrument from both
code and midi. Another issue with midi is that it should be polyphonic.
First question: How are you guys handling this? Anyone recorded midi
sniplets into chuck for processing?
Attached is an (bit messy) attempt at this design. It's suffering from
the CPU-eating problem that Ge advised about a couple of days ago
(could/should be fixed, don't care at this point). There's currently
also no support for "length-driven" use, but that would be easy, simply
by having a play function that calls noteOn(), waits a few::ms and calls
noteOff(). The reason for the four classes (monoInstrument,
polyInstrument, mono_sine and poly_sine) is that I'd like to have as
much of the book keeping as possible in the super classes, so basically
only noise making is happening in sub classes. Actually I'd like to only
have to write the mono_sine (or similar for other instruments) class.
Second question: Would it be possible to get rid of poly_sine, or at
least the repetitive (for other instruments) code in functions on(),
off() and kill()? Main reason it's there is that the voices are not
known in any of the other classes. Could that be changed?
Supposed I actually get this thing going, I'm gonna set chuck to record
to some data structure, probably an object. This is happening in one
shred. But then I'd like to a) grow (permutate) and b) use this data
structure in other shreds.
Third question: But how is that gonna be possible? The recorded-to
instance is not known outside the scope of the recording shred :-(
Static class? Possible, but inelegant.
Sorry for the loong post.
Any feedback is highly appreciated!
peace, love & harmony
http://www.atte.dk | quartet: http://www.anagrammer.dk
http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the chuck-users