From f2c28d730e752b67119f2f945bb816ef490fa9af Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Tue, 7 Jul 2020 10:23:08 +0100 Subject: [PATCH] sorting help of RTkmeans and audiotransport --- .../Classes/FluidAudioTransport.schelp | 13 ++++---- .../Classes/FluidBufAudioTransport.schelp | 11 +++---- .../HelpSource/Classes/FluidKMeans.schelp | 33 +++++++++++-------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp b/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp index b8099e6..f8a64b9 100644 --- a/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp +++ b/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp @@ -28,18 +28,19 @@ ARGUMENT:: bandwidth Someone tell me ARGUMENT:: windowSize -The size of the processing window (kr) + The window size in samples. As HPSS 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 processing hop size (kr). Default = windowSize / 2 + The window hop size in samples. As HPSS relies on spectral frames, we need to move the window forward. It can be any size but low overlap may create audible artefacts. The -1 default value will default to half of windowSize (overlap of 2). ARGUMENT:: fftSize -The processing FFT size (kr). Default = windowSize - -ARGUMENT:: maxFFTSize -The maximum FFT size for processing + 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 than the window size provides interpolation in frequency. The -1 default value will use the next power of 2 equal or above the windowSize. + ARGUMENT:: maxFFTSize + How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. +RETURNS:: + An audio stream with the interpolated spectrum of the inputs. EXAMPLES:: code:: diff --git a/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp b/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp index 6177727..8c2c37d 100644 --- a/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp @@ -57,24 +57,21 @@ ARGUMENT:: bandwidth Someone tell me ARGUMENT:: windowSize -The size of the processing window (kr) + The window size. As spectral differencing 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 processing hop size (kr). Default = windowSize / 2 + The window hop 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 windowSize (overlap of 2). ARGUMENT:: fftSize -The processing FFT size (kr). Default = windowSize + 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 use the next power of 2 equal or above the highest of windowSize and (bandwidth - 1) * 2. ARGUMENT:: action -Function to run when processing complete, taking the destination buffer as its argument + A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [destination] as an argument. INSTANCEMETHODS:: private:: synth, server -METHOD:: cancel -cancel processing on the server - EXAMPLES:: code:: diff --git a/release-packaging/HelpSource/Classes/FluidKMeans.schelp b/release-packaging/HelpSource/Classes/FluidKMeans.schelp index ef970a4..d43d54c 100644 --- a/release-packaging/HelpSource/Classes/FluidKMeans.schelp +++ b/release-packaging/HelpSource/Classes/FluidKMeans.schelp @@ -153,10 +153,15 @@ w.front; ( ~ib = Bus.audio(s); // input bus must be audio (for now) ~ob = Bus.control(s); //output bus can be kr +~tempPoint = Buffer.alloc(s,1,2); ~inpPoint = Buffer.alloc(s,2); ~outPoint = Buffer.alloc(s,1); ) +~tempPoint.getn(0,2,{|x|x.post}) + +~inpPoint.getn(0,2,{|x|x.post}) + //We make two Synths. One, before FluidKMeans, generates a random point and sends //a trigger to query. The second, after FluidKMeans, gives us the predicted cluster //triggering upadtes from the outBus ( @@ -164,12 +169,13 @@ w.front; ~kmeans.inBus_(~ib).outBus_(~ob).inBuffer_(~inpPoint).outBuffer_(~outPoint); //pitching { - var trig = Impulse.ar(10); - var point = [WhiteNoise.kr,WhiteNoise.kr]; - BufWr.kr(point[0],~inpPoint,0); - BufWr.kr(point[1],~inpPoint,1); - Poll.kr(T2K.kr(trig),point,[\pointX,\pointY]); - Out.ar(~ib.index,[trig]); + var trig = Impulse.kr(1); + var point = WhiteNoise.kr(1.dup); + var copied; + BufWr.kr(point,~tempPoint,0); + Poll.kr(trig, point, [\pointX,\pointY]); + copied = Done.kr(FluidBufFlatten.kr(~tempPoint, ~inpPoint, trig: trig)); + Out.ar(~ib.index,K2A.ar(copied > Delay1.kr(copied))); }.play(~kmeans.synth,addAction:\addBefore); //catching { @@ -183,14 +189,13 @@ w.front; ~kmeans.inBus_(~ib).outBus_(~ob).inBuffer_(~inpPoint).outBuffer_(~outPoint); //pitching { - var count,trig,point; - trig = Impulse.ar(MouseX.kr(0,1).exprange(0.5,1000)); - count = Stepper.ar(trig,0,0,3); - point = Latch.ar(WhiteNoise.ar([0.1,0.1],[count.div(2)-0.5,count.mod(2)-0.5]),trig); - BufWr.kr(point[0],~inpPoint,0);//annoying but triggered bufcompose or some other sort of entry here. (imagine having 20 mfccs here) - BufWr.kr(point[1],~inpPoint,1); - // Poll.kr(T2K.kr(trig),point,[\pointX,\pointY]); - Out.ar(~ib.index,[trig]); + var count, trig, point, copied; + trig = Impulse.kr(MouseX.kr(0,1).exprange(0.5,1000).poll); + count = Stepper.kr(trig,0,0,3); + point = Latch.kr(WhiteNoise.ar([0.1,0.1],[count.div(2)-0.5,count.mod(2)-0.5]),trig); + BufWr.kr(point,~tempPoint,0); + copied = Done.kr(FluidBufFlatten.kr(~tempPoint, ~inpPoint, trig: trig)); + Out.ar(~ib.index,K2A.ar(copied > Delay1.kr(copied))); trig*0.1; }.play(~kmeans.synth,addAction:\addBefore); //catching