From 35281d6604444624e6a54e1ce3981cad9a241086 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sun, 7 Apr 2019 16:45:28 +0100 Subject: [PATCH] added - stereo toy examples as tests and explanations for buf* objects --- .../HelpSource/Classes/FluidBufHPSS.schelp | 32 ++++++++++++++++++ .../Classes/FluidBufNoveltySlice.schelp | 30 ++++++++++++++++- .../Classes/FluidBufOnsetSlice.schelp | 27 +++++++++++++++ .../HelpSource/Classes/FluidBufSines.schelp | 33 ++++++++++++++++++- .../Classes/FluidBufTransientSlice.schelp | 28 ++++++++++++++++ .../Classes/FluidBufTransients.schelp | 32 ++++++++++++++++++ 6 files changed, 180 insertions(+), 2 deletions(-) diff --git a/release-packaging/HelpSource/Classes/FluidBufHPSS.schelp b/release-packaging/HelpSource/Classes/FluidBufHPSS.schelp index 59cd518..9f766ba 100644 --- a/release-packaging/HelpSource/Classes/FluidBufHPSS.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufHPSS.schelp @@ -163,3 +163,35 @@ e.play; //still nullsumming {PlayBuf.ar(1,c.bufnum) + PlayBuf.ar(1,d.bufnum) + PlayBuf.ar(1,e.bufnum) - PlayBuf.ar(1,b.bufnum,doneAction:2)}.play; :: + +STRONG::A stereo buffer example.:: +CODE:: + +// load two very different files +( +b = Buffer.read(s,File.realpath(FluidBufHPSS.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-SA-UprightPianoPedalWide.wav"); +c = Buffer.read(s,File.realpath(FluidBufHPSS.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav"); +) + +// composite one on left one on right as test signals +FluidBufCompose.process(s, c, numFrames:b.numFrames, startFrame:555000,destStartChan:1, destination:b) +b.play + +// create 2 new buffers as destinations +d = Buffer.new(s); +e = Buffer.new(s); + +//run the process on them +( +Routine{ + t = Main.elapsedTime; + FluidBufHPSS.process(s, b, harmonic: d, percussive:e); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +//listen: stereo preserved! +d.play +e.play +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufNoveltySlice.schelp b/release-packaging/HelpSource/Classes/FluidBufNoveltySlice.schelp index 6c25cc3..cae5673 100644 --- a/release-packaging/HelpSource/Classes/FluidBufNoveltySlice.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufNoveltySlice.schelp @@ -132,4 +132,32 @@ c.query; // So in the second settings (filterSize = 4), we smooth the novelty line a little, which allows us to catch small differences that are not jittery. It also corrects the ending cutting by the same trick: the averaging of the sharp pick is sliding up, crossing the threshold slightly earlier. // If we smooth too much, like the third settings (filterSize = 8), we start to loose precision. Have fun with different values of theshold then will allow you to find the perfect segment for your signal. -:: \ No newline at end of file +:: + +STRONG::A stereo buffer example.:: +CODE:: + +// make a stereo buffer +b = Buffer.alloc(s,88200,2); + +// add some stereo clicks and listen to them +((0..3)*22050+11025).do({|item,index| b.set(item+(index%2), 1.0)}); +b.play + +// create a new buffer as destinations +c = Buffer.new(s); + +//run the process on them +( +// with basic params +Routine{ + t = Main.elapsedTime; + FluidBufNoveltySlice.process(s,b.bufnum, indices: c.bufnum, threshold:0.6); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +// list the indicies of detected attacks - the two input channels have been summed +c.getn(0,c.numFrames,{|item|item.postln;}) +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufOnsetSlice.schelp b/release-packaging/HelpSource/Classes/FluidBufOnsetSlice.schelp index ddcbcb4..ee001e7 100644 --- a/release-packaging/HelpSource/Classes/FluidBufOnsetSlice.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufOnsetSlice.schelp @@ -113,3 +113,30 @@ c.query; ) :: +STRONG::A stereo buffer example.:: +CODE:: + +// make a stereo buffer +b = Buffer.alloc(s,88200,2); + +// add some stereo clicks and listen to them +((0..3)*22050+11025).do({|item,index| b.set(item+(index%2), 1.0)}) +b.play + +// create a new buffer as destinations +c = Buffer.new(s); + +//run the process on them +( +// with basic params +Routine{ + t = Main.elapsedTime; + FluidBufOnsetSlice.process(s,b, indices: c, threshold:0.1); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +// list the indicies of detected attacks - the two input channels have been summed +c.getn(0,c.numFrames,{|item|item.postln;}) +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufSines.schelp b/release-packaging/HelpSource/Classes/FluidBufSines.schelp index 348571b..a359f29 100644 --- a/release-packaging/HelpSource/Classes/FluidBufSines.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufSines.schelp @@ -101,4 +101,35 @@ d.play; //nullsumming tests {(PlayBuf.ar(1, c.bufnum)) + (PlayBuf.ar(1,d.bufnum)) - (PlayBuf.ar(1,b.bufnum,doneAction:2))}.play :: - \ No newline at end of file + +STRONG::A stereo buffer example.:: +CODE:: + +// load two very different files +( +b = Buffer.read(s,File.realpath(FluidBufSines.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-SA-UprightPianoPedalWide.wav"); +c = Buffer.read(s,File.realpath(FluidBufSines.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav"); +) + +// composite one on left one on right as test signals +FluidBufCompose.process(s, c, numFrames:b.numFrames, startFrame:555000,destStartChan:1, destination:b) +b.play + +// create 2 new buffers as destinations +d = Buffer.new(s); +e = Buffer.new(s); + +//run the process on them +( +Routine{ + t = Main.elapsedTime; + FluidBufSines.process(s, b, sines: d, residual:e, threshold:0.3); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +//listen: stereo preserved! +d.play +e.play +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufTransientSlice.schelp b/release-packaging/HelpSource/Classes/FluidBufTransientSlice.schelp index 40a7400..bb4b871 100644 --- a/release-packaging/HelpSource/Classes/FluidBufTransientSlice.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufTransientSlice.schelp @@ -116,3 +116,31 @@ Routine{ }.play ) :: + +STRONG::A stereo buffer example.:: +CODE:: + +// make a stereo buffer +b = Buffer.alloc(s,88200,2); + +// add some stereo clicks and listen to them +((0..3)*22050+11025).do({|item,index| b.set(item+(index%2), 1.0)}) +b.play + +// create a new buffer as destinations +c = Buffer.new(s); + +//run the process on them +( +// with basic params +Routine{ + t = Main.elapsedTime; + FluidBufTransientSlice.process(s,b, indices: c, threshFwd: 1.2); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +// list the indicies of detected attacks - the two input channels have been summed +c.getn(0,c.numFrames,{|item|item.postln;}) +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufTransients.schelp b/release-packaging/HelpSource/Classes/FluidBufTransients.schelp index 9556e34..8255d56 100644 --- a/release-packaging/HelpSource/Classes/FluidBufTransients.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufTransients.schelp @@ -114,3 +114,35 @@ Routine{ }.play ) :: + +STRONG::A stereo buffer example.:: +CODE:: + +// load two very different files +( +b = Buffer.read(s,File.realpath(FluidBufTransients.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav"); +c = Buffer.read(s,File.realpath(FluidBufTransients.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav"); +) + +// composite one on left one on right as test signals +FluidBufCompose.process(s, c, numFrames:b.numFrames, startFrame:555000, destStartChan:1, destination:b) +b.play + +// create 2 new buffers as destinations +d = Buffer.new(s); +e = Buffer.new(s); + +//run the process on them +( +Routine{ + t = Main.elapsedTime; + FluidBufTransients.process(s, b, transients: d, residual:e, threshFwd:1.2, debounce:40); + s.sync; + (Main.elapsedTime - t).postln; +}.play +) + +//listen: stereo preserved! +d.play +e.play +::