From 8302eefdb88b2d3fab7c371556c2c8f889c5ff70 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Wed, 5 Sep 2018 10:53:14 +0100 Subject: [PATCH] updated FDNMF test code, helpfile-in-progress and class description (and filename) corrected FDSTFTPass class description and helpfile corrected FDGain helpfile --- fdNMF/tests.scd | 9 ++-- .../fdGain/HelpSource/Classes/FDGain.schelp | 22 +++----- .../fdNMF/HelpSource/Classes/FDNMF.schelp | 3 +- .../fdNMF/classes/{fdfNMF.sc => fdNMF.sc} | 2 - .../HelpSource/Classes/FDSTFTPass.schelp | 51 ++++++++++++++++++- .../fdSTFTPass/classes/fdSTFTPass.sc | 4 +- 6 files changed, 64 insertions(+), 27 deletions(-) rename release-packaging/fdNMF/classes/{fdfNMF.sc => fdNMF.sc} (96%) diff --git a/fdNMF/tests.scd b/fdNMF/tests.scd index 0005add..5ec91f7 100644 --- a/fdNMF/tests.scd +++ b/fdNMF/tests.scd @@ -17,7 +17,7 @@ y = Buffer.new(s); // without sources r = Routine{ t = Main.elapsedTime; - FDNMF.nmf(s,b,0,-1,0,-1,nil,x,0,y,0,5,100,~frame_size,~hop_size,~fft_size); + FDNMF.nmf(s,b,0,-1,0,-1,nil,x,0,y,0,5,100,0,~frame_size,~hop_size,~fft_size); s.sync; (Main.elapsedTime - t).postln; }.play @@ -27,7 +27,7 @@ r = Routine{ ( r = Routine{ t = Main.elapsedTime; - FDNMF.nmf(s,b, 0,-1,0,-1,c,nil,0,nil,0,5,100,~frame_size,~hop_size,~fft_size); + FDNMF.nmf(s,b, 0,-1,0,-1,c,nil,0,nil,0,5,100,0,~frame_size,~hop_size,~fft_size); s.sync; (Main.elapsedTime - t).postln; }.play @@ -78,6 +78,7 @@ c.plot;x.plot; y.plot; // test with stereo input Buffer.freeAll(s) +b.play ( b = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav"); @@ -92,12 +93,12 @@ y = Buffer.new(s); ( r = Routine{ t = Main.elapsedTime; - FDNMF.nmf(s,b,0,-1,0,-1,c,x,0,y,0,5,100,~frame_size,~hop_size,~fft_size); + FDNMF.nmf(s,b,0,-1,0,-1,c,x,0,y,0,5,100,0,~frame_size,~hop_size,~fft_size); s.sync; (Main.elapsedTime - t).postln; }.play ) -{PlayBuf.ar(10,c.bufnum,doneAction:2)[2].dup}.play +{PlayBuf.ar(10,c.bufnum,doneAction:2)[9].dup}.play c.getn(0, 10, {|x|x.postln}) diff --git a/release-packaging/fdGain/HelpSource/Classes/FDGain.schelp b/release-packaging/fdGain/HelpSource/Classes/FDGain.schelp index d930062..32338c1 100644 --- a/release-packaging/fdGain/HelpSource/Classes/FDGain.schelp +++ b/release-packaging/fdGain/HelpSource/Classes/FDGain.schelp @@ -1,5 +1,5 @@ class:: FDGain -summary:: Real-Time Gain Changer +summary:: Real-Time Buffered Gain Changer categories:: UGens>Algebraic related::Classes/UnaryOpFunction @@ -15,21 +15,13 @@ ARGUMENT:: in The input to be processed ARGUMENT:: frameSize - The size of the real-time i/o buffer. It will add that much latency to the signal. + The size of the real-time i/o buffer, in samples. It will add that much latency to the signal. This is not modulatable. ARGUMENT:: gain Audio or control rate change of the gain. -returns:: nothing - -INSTANCEMETHODS:: - -METHOD:: checkInputs - This makes sure the value and phase inputs are both at audio rate. - returns:: - A slap on the wrist, should it not be the case. - + Same as input, delayed by the windowSize, multiplied by the gain factor. EXAMPLES:: Summing with the inverse (gain of -1) with a delay of the latency gives us CPU-expensive silence. @@ -38,9 +30,9 @@ EXAMPLES:: :: Varying the gain at audio rate. code:: - { FDGain.ar(PinkNoise.ar(0.1), gain:LFSaw.ar(1)) }.play + { FDGain.ar(PinkNoise.ar(0.1), gain:LFTri.ar(1)) }.play :: - Varying the gain at comtrol rate. + Varying the gain at comtrol rate, in beautiful stereo. code:: - { FDGain.ar(PinkNoise.ar(0.1), gain:LFSaw.kr(0.5)) }.play - :: \ No newline at end of file + { FDGain.ar(SinOsc.ar([222,333],mul:0.1), gain:LFTri.kr([0.5,0.7])) }.play + :: diff --git a/release-packaging/fdNMF/HelpSource/Classes/FDNMF.schelp b/release-packaging/fdNMF/HelpSource/Classes/FDNMF.schelp index 7f6eb54..171b28f 100644 --- a/release-packaging/fdNMF/HelpSource/Classes/FDNMF.schelp +++ b/release-packaging/fdNMF/HelpSource/Classes/FDNMF.schelp @@ -79,7 +79,6 @@ INSTANCEMETHODS:: EXAMPLES:: code:: - b = Buffer.read(s,"../../AudioFiles/01-mix.wav".resolveRelative); -thisProcess.nowExecutingPath + b = Buffer.read(s,"../../../AudioFiles/01-mix.wav".resolveRelative); b.play :: \ No newline at end of file diff --git a/release-packaging/fdNMF/classes/fdfNMF.sc b/release-packaging/fdNMF/classes/fdNMF.sc similarity index 96% rename from release-packaging/fdNMF/classes/fdfNMF.sc rename to release-packaging/fdNMF/classes/fdNMF.sc index 0509938..4e48775 100644 --- a/release-packaging/fdNMF/classes/fdfNMF.sc +++ b/release-packaging/fdNMF/classes/fdNMF.sc @@ -6,8 +6,6 @@ FDNMF { if(srcBuf.bufnum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw}; - dstBuf.bufnum.postln; - server.sendMsg(\cmd, \BufNMF, srcBuf.bufnum, startAt, nFrames, startChan, nChans, if(dstBuf.isNil, -1, {dstBuf.bufnum}), diff --git a/release-packaging/fdSTFTPass/HelpSource/Classes/FDSTFTPass.schelp b/release-packaging/fdSTFTPass/HelpSource/Classes/FDSTFTPass.schelp index fc74486..2db83d7 100644 --- a/release-packaging/fdSTFTPass/HelpSource/Classes/FDSTFTPass.schelp +++ b/release-packaging/fdSTFTPass/HelpSource/Classes/FDSTFTPass.schelp @@ -1,2 +1,49 @@ -//Ar modulator -{FDSTFTPass.ar(SinOsc.ar(440),1024,256,2048)}.play +TITLE:: FDSTFTPass +summary:: Real-Time FFT/IFFT return trip. +categories:: UGens>Algebraic +related:: Classes/UnaryOpFunction + +DESCRIPTION:: +A sanity test for the FluCoMa Real-Time Client FFT/IFFT Wrapper footnote::This was made possible thanks to the FluCoMa project (http://www.flucoma.org/) funded by the European Research Council (https://erc.europa.eu/) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 725899).:: + + +CLASSMETHODS:: + +METHOD:: ar + The audio rate version of the object. + +ARGUMENT:: in + The input to be passed-through + +ARGUMENT:: windowSize + The size of the buffered window to be analysed, in samples. It will add that much latency to the signal. This is not modulatable. + +ARGUMENT:: hopSize + How much the buffered window moves forward, in samples. This is not modulatable. + +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. This is not modulatable. + +returns:: + Same as input, delayed by the windowSize. + + +EXAMPLES:: + +code:: + Summing with the inverse (gain of -1) with a delay of the latency gives us CPU-expensive silence. + code:: + { var source = PinkNoise.ar(0.1); DelayN.ar(source, delaytime:1024/s.sampleRate, mul: -1) + FDSTFTPass.ar(source, 1024, 256, 1024); }.play + :: + Larger, oversampled, FFT + code:: + { FDSTFTPass.ar(PinkNoise.ar(0.1), 2048, 128, 8192) }.play + :: + Stereo Input Tests. + code:: + { FDSTFTPass.ar([SinOsc.ar(222,mul: 0.1), PinkNoise.ar(Decay.ar(Impulse.ar(0.666,mul: 0.1), 0.5))], fftSize:1024)}.play + :: + Stereo Parameter Tests. + code:: + { FDSTFTPass.ar(SinOsc.ar(222,mul: 0.1), [1024,8192],256,8192)}.play + :: diff --git a/release-packaging/fdSTFTPass/classes/fdSTFTPass.sc b/release-packaging/fdSTFTPass/classes/fdSTFTPass.sc index c4a3e8e..3b9d7ff 100644 --- a/release-packaging/fdSTFTPass/classes/fdSTFTPass.sc +++ b/release-packaging/fdSTFTPass/classes/fdSTFTPass.sc @@ -1,5 +1,5 @@ FDSTFTPass : UGen { - *ar { arg in = 0, windowsize=1024, hopsize=256, fftsize=windowsize; - ^this.multiNew('audio', in.asAudioRateInput(this),windowsize, hopsize, fftsize) + *ar { arg in = 0, windowSize= 1024, hopSize= 256, fftSize= -1; + ^this.multiNew('audio', in.asAudioRateInput(this),windowSize, hopSize, fftSize) } }