Hi If I do "chuck time.ck" then "chuck + shaker.ck" I hear the shaker ticking along after a while. If I then do "chuck + change_bpm.ck" the time is speeded up but the shaker goes silent. 1) Why does it take a while before the first shaker is played, and why isn't it always the same amount of time? 2) Why does the shaker stop playing when I update the bpm? As you might guess I suspect this to be something with static data. I know "static" means "static" so if they can't be updated like this, would the way to go be to send the bpm update as yet another event? -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions public class Time { int bpm; static dur quarter; static dur eight; static dur sixteenth; static Event q; 10 => bpm; fun void setTime() { 1::minute/this.bpm => this.quarter; this.quarter/2 => this.eight; this.quarter/4 => this.sixteenth; } fun void sendTime() { while(true){ this.q.broadcast(); <<<"q.broadcast", now>>>; this.quarter => now; } } } Time T; 80 => T.bpm; T.setTime(); T.sendTime(); Time T; 4::T.quarter - (now % 4::T.quarter) => now; Shakers inst => dac; [0,2,3,1,4,2,6,3,4,4] @=> int mel[]; for (0=>int i; ; i++) { <<<"shaker">>>; std.mtof( 60 + mel[i%mel.cap()] ) => inst.freq; inst.noteOn( 0.5 ); T.q => now; } Time T; 200 => T.bpm; T.setTime();
Hey there, 1) How long is it taking for the first shaker to be played? At 80bpm the tempo sync ("4::T.quarter - (now % 4::T.quarter) => now;") can last between about 0 and 3 seconds... though anything longer (or shorter!) than that is probably something weird going on. 2) Unless Im misunderstanding static data members, this looks like a bug in chuck to me. I tested out your code and got the same results. Actually, simply instantiating the Time class in change_bpm.ck was enough to stop the shakers. Furthermore, removing shakers.ck causes a seg fault in chuck, which leads me to believe that something related to the static data members is incorrectly being deallocated during instantiation and/or destruction of objects. That might explain the segfault and also why the shakers shred stops receiving events. I dont know that part of the code though so I cant tell whats going on exactly. spencer On Jun 18, 2006, at 3:54 PM, Atte André Jensen wrote:
Hi
If I do "chuck time.ck" then "chuck + shaker.ck" I hear the shaker ticking along after a while. If I then do "chuck + change_bpm.ck" the time is speeded up but the shaker goes silent.
1) Why does it take a while before the first shaker is played, and why isn't it always the same amount of time? 2) Why does the shaker stop playing when I update the bpm?
As you might guess I suspect this to be something with static data. I know "static" means "static" so if they can't be updated like this, would the way to go be to send the bpm update as yet another event?
-- peace, love & harmony Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/ compositions public class Time { int bpm;
static dur quarter; static dur eight; static dur sixteenth;
static Event q;
10 => bpm;
fun void setTime() { 1::minute/this.bpm => this.quarter; this.quarter/2 => this.eight; this.quarter/4 => this.sixteenth; }
fun void sendTime() { while(true){ this.q.broadcast(); <<<"q.broadcast", now>>>; this.quarter => now; } } }
Time T;
80 => T.bpm; T.setTime(); T.sendTime(); Time T; 4::T.quarter - (now % 4::T.quarter) => now;
Shakers inst => dac; [0,2,3,1,4,2,6,3,4,4] @=> int mel[]; for (0=>int i; ; i++) { <<<"shaker">>>; std.mtof( 60 + mel[i%mel.cap()] ) => inst.freq; inst.noteOn( 0.5 ); T.q => now; } Time T;
200 => T.bpm; T.setTime();_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Spencer Salazar wrote:
Hey there, 1) How long is it taking for the first shaker to be played? At 80bpm the tempo sync ("4::T.quarter - (now % 4::T.quarter) => now;") can last between about 0 and 3 seconds... though anything longer (or shorter!) than that is probably something weird going on.
I've messed around with it, and I'm pretty sure that the cause was: 1) the fact that the sound was played before waiting on a quarternote 2) 4::T.quarter - (now % 4::T.quarter) => now;
2) Unless Im misunderstanding static data members, this looks like a bug in chuck to me.
Ok, let's hope the developers voice their oppinion... -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
participants (2)
-
Atte André Jensen
-
Spencer Salazar