From ca09d43cdf4f97d6dcd7b1b26fe34bef3f4b5065 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Mon, 11 Mar 2019 11:39:58 +0000 Subject: [PATCH] FluidSines updated (help + defaults) --- release-packaging/Classes/FluidSines.sc | 6 +++--- .../HelpSource/Classes/FluidSines.schelp | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/release-packaging/Classes/FluidSines.sc b/release-packaging/Classes/FluidSines.sc index 9df0f7a..b9a327f 100644 --- a/release-packaging/Classes/FluidSines.sc +++ b/release-packaging/Classes/FluidSines.sc @@ -1,6 +1,6 @@ FluidSines : MultiOutUGen { - *ar { arg in = 0, bandwidth = 76, thresh = 0.7, minTrackLen = 15, magWeight = 0.1, freqWeight = 1.0, winSize= 2048, hopSize= 512, fftSize= 8192, maxFFTSize=16384; - ^this.multiNew('audio', in.asAudioRateInput(this), bandwidth, thresh, minTrackLen, magWeight,freqWeight ,winSize, hopSize, fftSize, maxFFTSize) + *ar { arg in = 0, bw = 76, thresh = 0.7, minTrackLen = 15, magWeight = 0.1, freqWeight = 1.0, winSize= 1024, hopSize= -1, fftSize= -1, maxFFTSize=16384; + ^this.multiNew('audio', in.asAudioRateInput(this), bw, thresh, minTrackLen, magWeight, freqWeight ,winSize, hopSize, fftSize, maxFFTSize) } init { arg ... theInputs; inputs = theInputs; @@ -11,4 +11,4 @@ FluidSines : MultiOutUGen { ^channels } checkInputs { ^this.checkNInputs(1) } -} \ No newline at end of file +} diff --git a/release-packaging/HelpSource/Classes/FluidSines.schelp b/release-packaging/HelpSource/Classes/FluidSines.schelp index 29ca490..753d1c5 100644 --- a/release-packaging/HelpSource/Classes/FluidSines.schelp +++ b/release-packaging/HelpSource/Classes/FluidSines.schelp @@ -21,7 +21,7 @@ METHOD:: ar ARGUMENT:: in The input to be processed -ARGUMENT:: bandwidth +ARGUMENT:: bw The width in bins of the fragment of the fft window that is considered a normal deviation for a potential continuous sinusoidal track. It has an effect on CPU cost: the widest is more accurate but more computationally expensive. ARGUMENT:: thresh @@ -40,14 +40,16 @@ ARGUMENT:: winSize The window size. As sinusoidal estimation relies on spectral frames, we need to decide what precision we give it spectrally and temporally, in line with Gabor Uncertainty principles. http://www.subsurfwiki.org/wiki/Gabor_uncertainty ARGUMENT:: hopSize - The window hope size. As sinusoidal estimation relies on spectral frames, we need to move the window forward. It can be any size but low overlap will create audible artefacts. + The window hope size. As sinusoidal estimation relies on spectral frames, we need to move the window forward. It can be any size but low overlap will create audible artefacts. The -1 default value will default to half of winSize (overlap of 2). ARGUMENT:: fftSize - The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision. + The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision. The -1 default value will default to windowSize. +ARGUMENT:: maxFFTSize + How large can the FFT be, by allocating memory at instantiation time. This is not modulatable. RETURNS:: - An array of two audio streams: [0] is the harmonic part extracted, [1] is the rest. The latency between the input and the output is (( hopSize * minTrackLen) + windowSize) samples. + An array of two audio streams: [0] is the harmonic part extracted, [1] is the rest. The latency between the input and the output is (( hopSize * minTrackLen) + winSize) samples. EXAMPLES:: @@ -56,13 +58,13 @@ CODE:: // load some audio to play b = Buffer.read(s,File.realpath(FluidSines.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav"); -// run with basic parameters - left is sinusoidal model, right is residual -{FluidSines.ar(PlayBuf.ar(1,b.bufnum,loop:1))}.play +// run with large parameters - left is sinusoidal model, right is residual +{FluidSines.ar(PlayBuf.ar(1,b.bufnum,loop:1),thresh: 0.2, minTrackLen: 2, winSize: 2048, fftSize: 8192)}.play // interactive parameters with a narrower bandwidth -{FluidSines.ar(PlayBuf.ar(1,b.bufnum,loop:1),30,MouseX.kr(),5)}.play +{FluidSines.ar(PlayBuf.ar(1,b.bufnum,loop:1),30,MouseX.kr(), 5, winSize: 1000, hopSize: 200, fftSize: 4096)}.play -// null test (the process add a latency of (( hopSize * minTrackLen) + windowSize) samples -{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidSines.ar(sig).sum - DelayN.ar(sig, 1, ((( 512 * 15) + 2048)/ s.sampleRate))]}.play +// null test (the process add a latency of (( hopSize * minTrackLen) + winSize) samples +{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidSines.ar(sig).sum - DelayN.ar(sig, 1, ((( 512 * 15) + 1024)/ s.sampleRate))]}.play :: \ No newline at end of file