From bc12dc2d1082da0f97b45ba08e1a937a7fe33be1 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Wed, 8 Jan 2020 09:56:16 +0000 Subject: [PATCH] now first macro (concat) working --- .../buffer_compositing/bufcomposemacros.scd | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/release-packaging/ignore/Examples/buffer_compositing/bufcomposemacros.scd b/release-packaging/ignore/Examples/buffer_compositing/bufcomposemacros.scd index 59a875a..6beddcd 100644 --- a/release-packaging/ignore/Examples/buffer_compositing/bufcomposemacros.scd +++ b/release-packaging/ignore/Examples/buffer_compositing/bufcomposemacros.scd @@ -1,28 +1,42 @@ -// + FluidBufCompose { - - ~concat = { - arg x; - x.postln; - } -// } - -~concat.value("ilove 10") - - - - ~concat = { - arg x; - if(x.class != Array, {"Error".postln;}, { - for (0,x.size - 1, {arg i; - x[i].postln; - }); - }); - } -// } - -~concat.value("ilove 10") - -~concat.value(b) - - -///// +// (re)set the source buffers +( +~low = Buffer.sendCollection(s, (Signal.sineFill(4410, Array.fill(3,0) ++ 1))); +~mid = Buffer.sendCollection(s, (Signal.sineFill(4410, Array.fill(12,0) ++ 1))); +~high = Buffer.sendCollection(s, (Signal.sineFill(4410, Array.fill(48,0) ++ 1))); +~piano = Buffer.read(s,File.realpath(FluidBufCompose.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-SA-UprightPianoPedalWide.wav",0,4410); +) + +// draw the buffers to see what happened +( +~low.plot; +~mid.plot; +~high.plot; +~piano.plot; +) + +// define the concatenation macro +( +~concat = { + arg x; + if(x.class != Array, + { + "Error - Needs an array as argument".postln; + }, { + Routine{ + for (1,x.size - 1, { + arg i; + FluidBufCompose.process(s,x[i],destination:x[0], destStartFrame:x[0].numFrames); + }); + "Done!".postln; + }.play; + } + ); +} +) +//test various combinations of concat +~concat.value([~low,~mid]) +~concat.value([~mid,~low,~high]) +~concat.value([~mid,~piano,~low]) +~concat.value([~mid,~piano]) + +~mid.query \ No newline at end of file