Hey!
is there a way to use the SoundFileView with a Buffer instead of reading a file from disk? So basically writing in real time to the SoundFileView, or at least once the recording is done, loading the buffer to the SoundFileView.
( // make a simple SoundFileView
y = Window.screenBounds.height - 120;
w = Window.new("soundfile test", Rect(200, y, 740, 100)).alwaysOnTop_(true);
w.front;
a = SoundFileView.new(w, Rect(20,20, 700, 60));
f = Buffer.alloc(s, s.sampleRate * 5.0, 2);
f.read("path"); //instead of a File from disk, loading the recorded buffer here
a.soundfile = f; // set soundfile
a.read(0, f.numFrames); // read in the entire file.
a.refresh; // refresh to display the file.
)
(
SynthDef(\record, {
var sig, amp;
sig = Impulse.ar(10) ! 2;
RecordBuf.ar(sig, f, doneAction: Done.freeSelf, loop: 0);
}).play;
)
I also tried to write the SynthDef(\record) to disk, and then reload it into the FileView, but when I do so I get the following error:
ERROR: Qt: Invalid beginning and/or duration.
The saved file doesnt have information about its length. An suggestions? I used the code from examples. But this way seems more complicated though
Thank you