i would like to find the onsets in an audio buffer as a list of timestamps. i see there is a thread about this from last year, but the proposed code doesn’t work for me on SC 3.11.2 / macOS, failing with:
Execution warning: Class 'Deferred' not found
ERROR: Message 'new' not understood.
RECEIVER:
nil
ARGS:
PATH: /Users/ahihi/SyncBig/sc/onsets.scd
CALL STACK:
DoesNotUnderstandError:reportError
arg this = <instance of DoesNotUnderstandError>
Nil:handleError
arg this = nil
arg error = <instance of DoesNotUnderstandError>
Thread:handleError
arg this = <instance of Thread>
arg error = <instance of DoesNotUnderstandError>
Thread:handleError
arg this = <instance of Routine>
arg error = <instance of DoesNotUnderstandError>
Object:throw
arg this = <instance of DoesNotUnderstandError>
Object:doesNotUnderstand
arg this = nil
arg selector = 'new'
arg args = [*0]
OfflineProcessRun:init
arg this = <instance of OfflineProcessRun>
arg parent = <instance of OfflineProcess>
arg inFileOrTime = "/Users/ahihi/SyncBig/sc/test..."
arg inArgs = nil
OfflineProcess:process
arg this = <instance of OfflineProcess>
arg fileOrTime = "/Users/ahihi/SyncBig/sc/test..."
< closed FunctionDef >
var path = "/Users/ahihi/SyncBig/sc/test..."
Routine:prStart
arg this = <instance of Routine>
arg inval = 221.40721391499
^^ The preceding error dump is for ERROR: Message 'new' not understood.
RECEIVER: nil
so i’m wondering if anyone knows a working approach.
looks like you don’t have the required “OfflineProcess” quark installed!
Quarks.install(“https://github.com/scztt/OfflineProcess.quark”)
no, this is after successfully installing the quark.
i am able to create the OfflineProcess object, but the error occurs when calling .process
.
hmmm looks like Scztt’s quark has a dependency - might want to hunt through his other quarks for a class called “Deferred” @Scztt ?
Yep he’s got a quark called “Deferred” guessing that’s it.
A lot of cool (and readable!) stuff in Scztt’s github btw!!
ah, that was it! thanks after installing Deferred and also https://github.com/scztt/Log.quark it now works.
@pulusound Have you done something else for working with this Quark? Can you share the exact code that you are running ?
I’m trying to run the Quark’s example but it is only returning nil
on the .resultFile
method:
(Currently this Quark is also installing Log and Defered by the default. I am on mac os and Sc 3.11.2.)
(
~inFile = "/Users/fsc/Downloads/STE-039 a.wav";
~proc = OfflineProcess();
// Audio-rate process - produces an audio file of equal length to the input
~proc.putAr(\compress, {
|input|
Compander.ar(input, input, 0.2, 1, 1 / 30);
});
// Control-rate process - produces an audio file of control-rate signal
~proc.putAr(\amplitude, {
|input|
Amplitude.kr(input);
});
// Triggered process. Output should be of the form [trigger, [a, b, c....]]
// Whenever the value at trigger crosses from non-positive to positive, the subsequent values (i.e. a, b, c)
// are recorded.
~proc.putTrig(\peaks, {
|input, time, delay=10|
var amp, peakAmp, reset, peakTime, timeSincePeak, newPeak, recordTrig;
reset = LocalIn.kr(1);
amp = Amplitude.kr(input);
peakAmp = RunningMax.kr(amp, reset);
newPeak = Changed.kr(peakAmp);
Poll.kr(newPeak, peakAmp, "peak");
peakTime = Latch.kr(time, newPeak);
timeSincePeak = Sweep.kr(newPeak);
recordTrig = Trig.kr((timeSincePeak > delay), 0.001);
LocalOut.kr(recordTrig);
[recordTrig, [peakTime, peakAmp]]
});
~proc.outputPath = "~/Desktop/".standardizePath;
~run1 = ~proc.process(~inFile);
)
// Get results:
~run1.resultFile(\compress).postln;
~run1.resultFile(\amplitude).postln;
~run1.resultData(\peaks).postln;
When the class library is compiling I am getting the following warning:
WARNING: SCDoc: OfflineProcess has no categories!