classes definitions, and skeletons of helpfiles/testfiles for (buf)mfcc and (buf)melbands
parent
0fb414af7d
commit
e125ad692a
@ -0,0 +1,25 @@
|
|||||||
|
FluidBufMFCC{
|
||||||
|
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoefs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, winSize = 1024, hopSize = -1, fftSize = -1, action;
|
||||||
|
|
||||||
|
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
features = features.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
|
server = server ? Server.default;
|
||||||
|
|
||||||
|
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||||
|
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||||
|
// same goes to maxNumCoefs, which is passed numCoefs in this case
|
||||||
|
|
||||||
|
forkIfNeeded{
|
||||||
|
server.sendMsg(\cmd, \BufMFCC, source, startFrame, numFrames, startChan, numChans, features, numCoefs, numBands, minFreq, maxFreq, numCoefs, winSize, hopSize, fftSize, maxFFTSize);
|
||||||
|
server.sync;
|
||||||
|
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||||
|
action.value(features);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
FluidBufMelBands{
|
||||||
|
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, winSize = 1024, hopSize = -1, fftSize = -1, action;
|
||||||
|
|
||||||
|
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
features = features.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
|
server = server ? Server.default;
|
||||||
|
|
||||||
|
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||||
|
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||||
|
// same for maxNumBands which is passed numBands
|
||||||
|
|
||||||
|
forkIfNeeded{
|
||||||
|
server.sendMsg(\cmd, \BufMelBands, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, winSize, hopSize, fftSize, maxFFTSize);
|
||||||
|
server.sync;
|
||||||
|
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||||
|
action.value(features);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
FluidMFCC : MultiOutUGen {
|
||||||
|
|
||||||
|
*kr { arg in = 0, numCoefs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, maxNumCoefs = 40, winSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||||
|
^this.multiNew('control', in.asAudioRateInput(this), numCoefs, numBands, minFreq, maxFreq, maxNumCoefs, winSize, hopSize, fftSize, maxFFTSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
init {arg ...theInputs;
|
||||||
|
inputs = theInputs;
|
||||||
|
^this.initOutputs(inputs.at(5),rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkInputs {
|
||||||
|
if(inputs.at(5).rate != 'scalar') {
|
||||||
|
^(": maxNumCoefs cannot be modulated.");
|
||||||
|
};
|
||||||
|
if(inputs.at(9).rate != 'scalar') {
|
||||||
|
^(": maxFFTSize cannot be modulated.");
|
||||||
|
};^this.checkValidInputs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
FluidMelBands : MultiOutUGen {
|
||||||
|
|
||||||
|
*kr { arg in = 0, numBands = 40, minFreq = 20, maxFreq = 20000, maxNumBands = 40, winSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||||
|
^this.multiNew('control', in.asAudioRateInput(this), numBands, minFreq, maxFreq, maxNumBands, winSize, hopSize, fftSize, maxFFTSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
init {arg ...theInputs;
|
||||||
|
inputs = theInputs;
|
||||||
|
^this.initOutputs(inputs.at(4),rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkInputs {
|
||||||
|
if(inputs.at(4).rate != 'scalar') {
|
||||||
|
^(": maxNumCoefs cannot be modulated.");
|
||||||
|
};
|
||||||
|
if(inputs.at(8).rate != 'scalar') {
|
||||||
|
^(": maxFFTSize cannot be modulated.");
|
||||||
|
};^this.checkValidInputs;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue