Hi
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
Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk
http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
// ---------------------------------------------------
// ring_element
// ---------------------------------------------------
class ring_element{
int date;
float freq;
}
// ---------------------------------------------------
// ring
// ---------------------------------------------------
class ring{
4 => int size;
1000 => int max_size;
ring_element container[max_size];
int counter;
fun int is_full(){
1 => int result;
for(0=>int i; i
Atte André Jensen wrote:
I'm wrestling with some mostly conceptual problems that I'd like to get some feedback on.
Unfortunately no one replied. Fortunately I've been thinking like a mad man. And I came up with the following extremely simple solution. Events to the rescue. I rewrite my current instrument functions to wait for an event, provide overload functions that accepts length, sporks the function, waits for length amount of time and broadcast events. Didn't try with audio, but it's so simple it's gotta work. Any comments are welcome! -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions fun void in1(float dynamic, dur length){ Event in1_off; spork ~ in1(dynamic, in1_off); length => now; in1_off.broadcast(); 10::second => now; } fun void in1(float dynamic, Event off){ <<<"in1 on", dynamic>>>; off => now; <<<"in1 off",dynamic>>>; 1::second => now; <<<"in1, 1 second after off",dynamic>>>; } fun void in2(float dynamic, dur length){ Event in2_off; spork ~ in2(dynamic, in2_off); length => now; in2_off.broadcast(); 10::second => now; } fun void in2(float dynamic, Event off){ <<<"in2 on",dynamic>>>; off => now; <<<"in2 off",dynamic>>>; 2::second => now; <<<"in2, 2 seconds after off",dynamic>>>; } Event in1_off, in2_off; spork ~ in1(1,in1_off); spork ~ in2(.9,in2_off); spork ~ in1(.6, 1::second); spork ~ in2(.1, 2::second); 200::ms => now; in1_off.broadcast(); 1::week => now;
participants (1)
-
Atte André Jensen