Dear users,
I have recorded sound as in code 1. Now I am trying to record sound as in code 2 using Pbind. However, the result of code 2 does not contain any audio data. Also, when I record sound from code 2 using the record function in the server menu and using the record button in the server window evoked using ```s.makeGui``, no data is recorded. What are my mistakes? I appreciate your feedback and help.
// code 1:
(
s.waitForBoot{
var title, file;
title = "configured";
file = thisProcess.nowExecutingPath.dirname +/+ title ++ ".wav";
SynthDef(\alarm, { |freq = 440|
var signal, filter, env;
env = Env.perc(0.01, 0.25).kr;
signal = BrownNoise.ar * env;
filter = { |source, freq = 440, bwr = 0.001, amp = 1|
Resonz.ar(source, freq, bwr, amp)
};
signal = filter.(signal, freq, 0.001, 9);
FreeSelf.kr(TDelay.kr(env, 3));
signal = filter.(signal, freq, 0.5);
OffsetOut.ar(0, signal)
}
).add;
s.recHeaderFormat = "wav";
s.prepareForRecord(file, numChannels: 1);
s.sync; // without this line, an error occurs.
s.record;
[2, 5, 10].do{
|i, idx|
var freq = (i + 60 + (12 * 2) - 1).midicps,
rls = [0.2, 0.2, 3];
s.sendBundle(0.2, ["/s_new", "alarm", -1, 0, 1, "freq", freq]);
rls[idx].wait;
};
s.stopRecording;
file.openOS;
Platform.case(
\osx, { ("open -a Audacity" + file.quote).unixCmd; },
\windows, { ("start" + "".quote
+ "C:/Program Files (x86)/audacity/Audacity.exe".quote
+ file.quote).unixCmd;}
);
}
)
code 2:
//
(
s.waitForBoot{
var title, file, duration;
title = "configured";
file = thisProcess.nowExecutingPath.dirname +/+ title ++ ".wav";
duration = 5;
SynthDef(\alarm, { |freq = 440|
var signal, filter, env;
env = Env.perc(0.01, 0.25).kr;
signal = BrownNoise.ar * env;
filter = { |source, freq = 440, bwr = 0.001, amp = 1|
Resonz.ar(source, freq, bwr, amp)
};
signal = filter.(signal, freq, 0.001, 9);
FreeSelf.kr(TDelay.kr(env, 3));
signal = filter.(signal, freq, 0.5);
OffsetOut.ar(0, signal)
}
).add;
s.sync; ; // without this line, an error occurs.
Pbind(
\instrument, \alarm,
\freq, Pseq([2, 5, 10] + 83).midicps,
\dur, Pseq([0.2, 0.2, 3])
).record(file, "wav", "float", 1, duration);
duration.wait;
file.openOS;
Platform.case(
\osx, { ("open -a Audacity" + file.quote).unixCmd; },
\windows, { ("start" + "".quote
+ "C:/Program Files (x86)/audacity/Audacity.exe".quote
+ file.quote).unixCmd;}
);
}
)