From 156a86418ccfedf9ef404fc629456325e395e0b8 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sat, 30 Mar 2019 16:58:22 +0000 Subject: [PATCH] corrected typos and added bail in class definition for maxFFTSize modulatable --- release-packaging/Classes/FluidHPSS.sc | 13 ++++++++++++- release-packaging/Classes/FluidNMFMatch.sc | 8 ++++---- release-packaging/Classes/FluidOnsetSlice.sc | 6 ++++++ release-packaging/Classes/FluidSTFTPass.sc | 6 ++++++ release-packaging/Classes/FluidSines.sc | 7 ++++++- release-packaging/Classes/FluidSpectralShape.sc | 8 ++++---- .../HelpSource/Classes/FluidHPSS.schelp | 8 ++++---- .../HelpSource/Classes/FluidNMFMatch.schelp | 4 ++-- .../HelpSource/Classes/FluidOnsetSlice.schelp | 2 +- .../HelpSource/Classes/FluidSTFTPass.schelp | 2 +- .../HelpSource/Classes/FluidSines.schelp | 2 +- .../HelpSource/Classes/FluidSpectralShape.schelp | 8 ++++---- 12 files changed, 51 insertions(+), 23 deletions(-) diff --git a/release-packaging/Classes/FluidHPSS.sc b/release-packaging/Classes/FluidHPSS.sc index 62c1c81..be5bfb6 100644 --- a/release-packaging/Classes/FluidHPSS.sc +++ b/release-packaging/Classes/FluidHPSS.sc @@ -11,5 +11,16 @@ FluidHPSS : MultiOutUGen { ]; ^channels } - checkInputs { ^this.checkNInputs(1) } + checkInputs { + if(inputs.at(15).rate != 'scalar') { + ^(": maxFFTSize cannot be modulated."); + }; + if(inputs.at(16).rate != 'scalar') { + ^(": maxHFlitSize cannot be modulated."); + }; + if(inputs.at(17).rate != 'scalar') { + ^(": maxPFiltSize cannot be modulated."); + }; + ^this.checkValidInputs; + } } diff --git a/release-packaging/Classes/FluidNMFMatch.sc b/release-packaging/Classes/FluidNMFMatch.sc index b7845aa..80e91fd 100644 --- a/release-packaging/Classes/FluidNMFMatch.sc +++ b/release-packaging/Classes/FluidNMFMatch.sc @@ -1,7 +1,7 @@ FluidNMFMatch : MultiOutUGen { *kr { arg in = 0, dictBufNum, maxRank = 1, nIter = 10, winSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384; - ^this.multiNew('control', in, dictBufNum, maxRank, nIter, winSize, hopSize, fftSize, maxFFTSize); + ^this.multiNew('control', in.asAudioRateInput(this), dictBufNum, maxRank, nIter, winSize, hopSize, fftSize, maxFFTSize); } init {arg ...theInputs; @@ -10,9 +10,9 @@ FluidNMFMatch : MultiOutUGen { } checkInputs { - if (inputs.at(0).rate != 'audio', { - ^(" input 0 is not audio rate"); - }); + if(inputs.at(7).rate != 'scalar') { + ^(": maxFFTSize cannot be modulated."); + }; ^this.checkValidInputs; } } diff --git a/release-packaging/Classes/FluidOnsetSlice.sc b/release-packaging/Classes/FluidOnsetSlice.sc index d507838..d969808 100644 --- a/release-packaging/Classes/FluidOnsetSlice.sc +++ b/release-packaging/Classes/FluidOnsetSlice.sc @@ -2,4 +2,10 @@ FluidOnsetSlice : UGen { *ar { arg in = 0, function = 0, thresh = 0.5, debounce = 2, filtSize = 5, frameDelta = 0, winSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384; ^this.multiNew('audio', in.asAudioRateInput(this), function, thresh, debounce, filtSize, winSize, hopSize, frameDelta, fftSize, maxFFTSize) } + checkInputs { + if(inputs.at(9).rate != 'scalar') { + ^(": maxFFTSize cannot be modulated."); + }; + ^this.checkValidInputs; + } } diff --git a/release-packaging/Classes/FluidSTFTPass.sc b/release-packaging/Classes/FluidSTFTPass.sc index dc7fd49..caa0005 100644 --- a/release-packaging/Classes/FluidSTFTPass.sc +++ b/release-packaging/Classes/FluidSTFTPass.sc @@ -2,4 +2,10 @@ FluidSTFTPass : UGen { *ar { arg in = 0, winSize= 1024, hopSize= -1, fftSize= -1, maxFFTSize = 16384; ^this.multiNew('audio', in.asAudioRateInput(this), winSize, hopSize, fftSize, maxFFTSize) } + checkInputs { + if(inputs.at(4).rate != 'scalar') { + ^": maxFFTSize cannot be modulated."; + }; + ^this.checkValidInputs + } } diff --git a/release-packaging/Classes/FluidSines.sc b/release-packaging/Classes/FluidSines.sc index b9a327f..384e68d 100644 --- a/release-packaging/Classes/FluidSines.sc +++ b/release-packaging/Classes/FluidSines.sc @@ -10,5 +10,10 @@ FluidSines : MultiOutUGen { ]; ^channels } - checkInputs { ^this.checkNInputs(1) } + checkInputs { + if(inputs.at(9).rate != 'scalar') { + ^(": maxFFTSize cannot be modulated."); + }; + ^this.checkNInputs(1) + } } diff --git a/release-packaging/Classes/FluidSpectralShape.sc b/release-packaging/Classes/FluidSpectralShape.sc index 9b4edb5..216ea7c 100644 --- a/release-packaging/Classes/FluidSpectralShape.sc +++ b/release-packaging/Classes/FluidSpectralShape.sc @@ -1,7 +1,7 @@ FluidSpectralShape : MultiOutUGen { *kr { arg in = 0, winSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384; - ^this.multiNew('control', in, winSize, hopSize, fftSize, maxFFTSize); + ^this.multiNew('control', in.asAudioRateInput(this), winSize, hopSize, fftSize, maxFFTSize); } init {arg ...theInputs; @@ -10,9 +10,9 @@ FluidSpectralShape : MultiOutUGen { } checkInputs { - if (inputs.at(0).rate != 'audio', { - ^(" input 0 is not audio rate"); - }); + if(inputs.at(4).rate != 'scalar') { + ^(": maxFFTSize cannot be modulated."); + }; ^this.checkValidInputs; } } diff --git a/release-packaging/HelpSource/Classes/FluidHPSS.schelp b/release-packaging/HelpSource/Classes/FluidHPSS.schelp index 9d5e3ff..1c25d29 100644 --- a/release-packaging/HelpSource/Classes/FluidHPSS.schelp +++ b/release-packaging/HelpSource/Classes/FluidHPSS.schelp @@ -76,13 +76,13 @@ 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 -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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. ARGUMENT::maxHFlitSize - How large can the harmonic filter be modulated to (hFiltSize), by allocating memory at instantiation time. This is not modulatable. + How large can the harmonic filter be modulated to (hFiltSize), by allocating memory at instantiation time. This cannot be modulated. ARGUMENT:: maxPFiltSize - How large can the percussive filter be modulated to (pFiltSize), by allocating memory at instantiation time. This is not modulatable. + How large can the percussive filter be modulated to (pFiltSize), by allocating memory at instantiation time. This cannot be modulated. RETURNS:: @@ -102,7 +102,7 @@ CODE:: b = Buffer.read(s,File.realpath(FluidHPSS.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav"); // run with basic parameters (left is harmonic, right is percussive) -{FluidHPSS.ar(PlayBuf.ar(1,b.bufnum,loop:1))}.play +{FluidHPSS.ar(PlayBuf.ar(1,b.bufnum,loop:1),maxFFTSize:LFNoise0.kr())}.play // run in mode 1 {FluidHPSS.ar(PlayBuf.ar(1,b.bufnum,loop:1),17,51,1,0.05,40,0.1,-40)}.play diff --git a/release-packaging/HelpSource/Classes/FluidNMFMatch.schelp b/release-packaging/HelpSource/Classes/FluidNMFMatch.schelp index a026525..4d7f1e7 100644 --- a/release-packaging/HelpSource/Classes/FluidNMFMatch.schelp +++ b/release-packaging/HelpSource/Classes/FluidNMFMatch.schelp @@ -29,7 +29,7 @@ ARGUMENT:: dictBufNum The server index of the buffer containing the different dictionaries that the input signal will be matched against. Dictionaries must be STRONG::(fft size / 2) + 1:: frames. If the buffer has more than STRONG::maxRank:: channels, the excess will be ignored. ARGUMENT::maxRank - The maximum number of elements the NMF algorithm will try to divide the spectrogram of the source in. This dictates the number of output channelsfor the ugen. This is not modulatable. + The maximum number of elements the NMF algorithm will try to divide the spectrogram of the source in. This dictates the number of output channelsfor the ugen. This cannot be modulated. ARGUMENT:: nIter The NMF process is iterative, trying to converge to the smallest error in its factorisation. The number of iterations will decide how many times it tries to adjust its estimates. Higher numbers here will be more CPU intensive, lower numbers will be more unpredictable in quality. @@ -44,7 +44,7 @@ ARGUMENT:: fftSize The 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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. RETURNS:: A multichannel kr output, giving for each dictionary component the activation amount. diff --git a/release-packaging/HelpSource/Classes/FluidOnsetSlice.schelp b/release-packaging/HelpSource/Classes/FluidOnsetSlice.schelp index b7a4533..68c260f 100644 --- a/release-packaging/HelpSource/Classes/FluidOnsetSlice.schelp +++ b/release-packaging/HelpSource/Classes/FluidOnsetSlice.schelp @@ -53,7 +53,7 @@ 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 -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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. RETURNS:: An audio stream with impulses at detected transients. The latency between the input and the output is winSize. diff --git a/release-packaging/HelpSource/Classes/FluidSTFTPass.schelp b/release-packaging/HelpSource/Classes/FluidSTFTPass.schelp index 9ccf7bf..2a29a35 100644 --- a/release-packaging/HelpSource/Classes/FluidSTFTPass.schelp +++ b/release-packaging/HelpSource/Classes/FluidSTFTPass.schelp @@ -26,7 +26,7 @@ ARGUMENT:: fftSize How large will the FFT be, zero-padding the buffer to the right size, which should be bigger than the windowSize argument, bigger than 4 samples, and should be a power of 2. This is a way to oversample the FFT for extra 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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. RETURNS:: diff --git a/release-packaging/HelpSource/Classes/FluidSines.schelp b/release-packaging/HelpSource/Classes/FluidSines.schelp index 753d1c5..f7cfbd6 100644 --- a/release-packaging/HelpSource/Classes/FluidSines.schelp +++ b/release-packaging/HelpSource/Classes/FluidSines.schelp @@ -46,7 +46,7 @@ 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 -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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. 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) + winSize) samples. diff --git a/release-packaging/HelpSource/Classes/FluidSpectralShape.schelp b/release-packaging/HelpSource/Classes/FluidSpectralShape.schelp index 5a95735..190c147 100644 --- a/release-packaging/HelpSource/Classes/FluidSpectralShape.schelp +++ b/release-packaging/HelpSource/Classes/FluidSpectralShape.schelp @@ -10,13 +10,13 @@ The descriptors are: LIST:: ##the four first statistical moments (https://en.wikipedia.org/wiki/Moment_(mathematics)), more commonly known as: LIST:: - ## the spectral centroid (1) in spectral bin. This is the point that splits the spectrum in 2 halves of equal energy. It is the weighted average. + ## the spectral centroid (1) in spectral bin. This is the point that splits the spectrum in 2 halves of equal energy. It is the weighted average (histogram). ## the spectral spread (2) in spectral bin. This is the standard deviation of the statistical curve, or the average of the distance to the centroid. - ## the normalised skewness (3) as ratio. This indicates how tilted is the statistical curve. If it is below the bin representing half-Nyquist, it is positive. + ## the normalised skewness (3) as ratio. This indicates how tilted is the statistical curve in relation to the middle of the spectral frame, i.e. the half-Nyquist. If it is below the bin representing half-Nyquist, it is positive. ## the normalised kurtosis (4) as ratio. This indicates how focused is the statistical curve. If it is peaky, it is high. :: ## the rolloff (5) in bin number. This indicates the bin under which 95% of the energy is included. - ## the flatness (6) in dB. This is the ratio of geometric mean to the arithmetic mean. It yields a measure on how noisy a signal is. + ## the flatness (6) in dB. This is the ratio of geometric mean to the arithmetic mean of amplitude. It yields a very approfimate measure on how noisy a signal is. ## the crest (7) in dB. This is the ratio of the loudest amplitude over the RMS of the whole frame. A high number is an indication of a loud peak emerging. The drawings in Peeters 2003 (http://recherche.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf) are useful, as are the commented examples below. For the mathematically-inclined reader, the tutorials and code offered here (https://www.audiocontentanalysis.org/) are interesting to further the understanding. @@ -42,7 +42,7 @@ 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 -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. + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. RETURNS:: A control stream with the seven spectral shape descriptors. The latency is winSize.