Cabbage Logo
Back to Cabbage Site

Individually they both run, but not together

I’m working on a clock that can trigger other events using channels. Everything appears to work, I can get my clock pulse to work and I can get the clock gate to work, but I can’t get them to work together. As far as I can tell, it is something to do with ‘schedulek’ because I can have one statement with it, but not two, and no matter how I arrange them it will only ever schedule the second event, the first just seems to get lost.

If you run the program as is, the ClockListener instr will print out only the clock pulse. Then if you comment out line 51 (the second call using ‘schedulek’), and it will now print out the clock gate. They both seem to work, but not together.

Trigger.csd (3.4 KB)

Interesting issue here. When reading the code the first thing that worries me is the turnoff. Could this be turning off all instance of instrument 4? If you add a fractional part to instrument number, i.e.,:

schedulek 4.0, 0, -1, kClockGate, "led2", "clockgate"
schedulek 4.1, 0, -1, (1/kr), "led", "clock"

it behaves like this:

kClock: 1.000000 kGate: 1.000000 at: 2.381333
kClock: 0.000000 kGate: 1.000000 at: 2.382000
kClock: 0.000000 kGate: 0.000000 at: 2.881333
kClock: 1.000000 kGate: 1.000000 at: 3.381333
kClock: 0.000000 kGate: 1.000000 at: 3.382000
kClock: 0.000000 kGate: 0.000000 at: 3.881333
kClock: 1.000000 kGate: 1.000000 at: 4.381333
kClock: 0.000000 kGate: 1.000000 at: 4.382000

Huh… didn’t know the fractional part was required. But, yes, that is correct in the output. I’ll have to read up on these scoreline/event opcodes. Do you know if there is something that discusses the differences between the different scheduling opcodes? Their differences don’t seem to that much, mostly in how each uses strings.

No, I think they all do pretty much the same thing. I’ve always preferring the syntax of the event opcodes, but miss the trigger that comes with the schedkwhen opcode. Like many things in Csound, I think they were all added at different times by different people. I’ve toyed with a cabbageEvent opcode, with trigger and better support for strings, but I’m afraid I might be taking the whole opcode thing a little far :rofl:

1 Like