a slightly improved (buf)audiotransport help which is fun to play with

nix
Pierre Alexandre Tremblay 6 years ago
parent d30bd372de
commit dc73287280

@ -44,6 +44,19 @@ RETURNS::
EXAMPLES::
code::
//the mouse X axis interpolates between the two sinewaves
//didactic - the mouse X axis interpolates between the two sinewaves
{FluidAudioTransport.ar(SinOsc.ar(220,mul: 0.1),SinOsc.ar(440,mul: 0.02),MouseX.kr())}.play;
//richer with complex spectra
//load 2 files
(
b = Buffer.read(s,File.realpath(FluidAudioTransport.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-CEL-GlitchyMusicBoxMelo.wav");
c = Buffer.read(s,File.realpath(FluidAudioTransport.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-CF-ChurchBells.wav");
)
//listen to them
b.play
c.play
//stereo cross!
{FluidAudioTransport.ar(PlayBuf.ar(2,b,loop: 1),PlayBuf.ar(2,c,loop: 1),MouseX.kr())}.play;
::

@ -75,7 +75,8 @@ private:: synth, server
EXAMPLES::
code::
//Make 2 sources to be interpolated
//Didactic:
//Make 2 sinewave sources to be interpolated
(
b = Buffer.loadCollection(s, FloatArray.fill(44100, {|a|(a / pi).sin * 0.1}));
c = Buffer.loadCollection(s, FloatArray.fill(44100, {|a|(a / pi / 2).sin * 0.02}));
@ -89,4 +90,20 @@ FluidBufAudioTransport.process(s,b,source2:c,destination:d,interpolation:0.5,act
b.play
c.play
d.play
// more interesting sources: two cardboard bowing gestures
(
b = Buffer.read(s,File.realpath(FluidBufAudioTransport.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Green-Box641.wav");
c = Buffer.read(s,File.realpath(FluidBufAudioTransport.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Green-Box639.wav");
d = Buffer.new
)
// listen to the source
b.play
c.play
// process and listen
FluidBufAudioTransport.process(s,b,source2:c,destination:d,interpolation:0.5,action:{"Ding".postln})
d.play
// try various interpolation factors (0.1 and 0.9 are quite good
::

Loading…
Cancel
Save