supriya-project/supriya

EventPattern playing at about half speed

macduff111 opened this issue · 3 comments

Discussed in #360

Running the code below I expect it to generate 4 notes in series, each a second long as set by the delta and duration keys , however they are each about 2 secs long.

@synthdef()
def test(gate=1,freq=440):
	env=Linen.kr(gate,0.01,1.0,0.01,done_action=DoneAction.FREE_SYNTH)
	osc=SinOsc.ar(frequency=freq)
	out=env*osc
	Out.ar(bus=0,source=out)

pattern=EventPattern(
	freq=SequencePattern([440,880],2),
	delta=1,
	duration=1,
	synthdef=test)

Timing's not quite the same as with SuperCollider.

1.0 duration is a whole note.

The default clock (Clock.default() will get it for you) defaults to 120BPM. That's 2 beats per second, making 4 beats (4/4) take 2 seconds.

If you don't want to adjust your durations and deltas, you can just bump the tempo on the clock.

See: https://josiahwolfoberholtzer.com/supriya/api/supriya/clocks/bases.html#supriya.clocks.bases.BaseClock.change

Clock.default.change(beats_per_minute=240) probably gets you the tempo you want.

ah ok, that makes sense. many thanks

oh, and that should be brackets after default ie Clock.default().change(beats_per_minute=240)