Hi,
I have a strange problem when evaluating SC code:
Although the code does not seem to have any errors, it does not evaluate (on the first try).
But when I evaluate it 3-5 times it works.
This is the Code I tried:
(
b = Buffer.alloc(s, s.sampleRate * 1.0, 1);
c = Buffer.alloc(s, s.sampleRate * 1.0, 1);
)
(
SynthDef(\playback1, { arg out = 0, buf, startTime = 1, rate = 1, amp = 0.1, att = 0.005, rel = 0.1;
var src = PlayBuf.ar(1, buf, rate, startPos: startTime * SampleRate.ir);
var env = EnvGen.ar(Env.perc(att, rel), doneAction: 2) * amp;
Out.ar(out, src * env)
}).add;
Pbindef(\x,
\instrument, \playback1,
\buf, b,
\out, Pseq([0, 1], inf),
\dur, 0.2,
\rate, 1,
\amp, 0.5,
\rel, 0.5,
\startTime, Pseg([Pwhite(0, 0.5, 10), Pn(0)])
).play;
Pbindef(\y,
\instrument, \playback1,
\buf, c,
\out, Pseq([0, 1], inf),
\dur, 0.2,
\rate, 1,
\amp, 0.5,
\rel, 0.5,
\startTime, Pwhite(0.0, 0.05)
).play
)
By evaluating the SynthDef the following ERROR appears:
ERROR: syntax error, unexpected ',', expecting end of file
in interpreted text
line 1 char 2:
0, 1], inf),
^
\dur, 0.2,
-----------------------------------
ERROR: Command line parse failed
-> nil
ERROR: syntax error, unexpected ',', expecting end of file
in interpreted text
line 1 char 2:
0, 1], inf),
^
\dur, 0.2,
-----------------------------------
ERROR: Command line parse failed
-> nil
-> Pbindef('y', 'instrument', 'playback1', 'buf', Buffer.new, 'out', Pseq([ 0, 1 ], inf), 'dur', 0.2, 'rate', 1, 'amp', 0.5, 'rel', 0.5, 'startTime', Pwhite(0.0, 0.05))
And after 3 times the Code works properly (As you can see in the last line, it got evaluated).
It seems, that this is a Problem with Windows, since the Code Works every time on Mac and Linux.
I recognized this strange behaviour several times with my Laptop, also on other blocks of code.
I use Windows 11 64 bit and SuperCollider 3.13.0.
hopefully someone can help me as it is very confusing for me when the evaluation works “on a wing and a prayer”.