examples: folder iteration and 2 passes now working fine

nix
Pierre Alexandre Tremblay 7 years ago
parent ab6103d984
commit 050c80286f

@ -2,7 +2,7 @@
( (
var fileNames; var fileNames;
c = [0]; c = [];
FileDialog.new({|selection| FileDialog.new({|selection|
var total, totaldur = 0, maxchans = 0; var total, totaldur = 0, maxchans = 0;
@ -16,14 +16,11 @@ FileDialog.new({|selection|
SoundFile.use(fp.asAbsolutePath , { SoundFile.use(fp.asAbsolutePath , {
arg file; arg file;
var dur = file.numFrames; var dur = file.numFrames;
c = c.add(dur); c = c.add(totaldur);
totaldur = totaldur + dur; totaldur = totaldur + dur;
maxchans = maxchans.max(file.numChannels); maxchans = maxchans.max(file.numChannels);
}); });
}); });
c.postln;
totaldur.postln;
maxchans.postln;
Routine{ Routine{
b = Buffer.alloc(s,totaldur,maxchans); b = Buffer.alloc(s,totaldur,maxchans);
s.sync; s.sync;
@ -42,4 +39,7 @@ b.plot
c.postln c.postln
b.play b.play
{PlayBuf.ar(1,b.bufnum,startPos:c[740])}.play
Buffer.freeAll Buffer.freeAll

@ -36,3 +36,5 @@ FileDialog.new({|selection|
b.plot b.plot
c.postln c.postln
b.play b.play
{PlayBuf.ar(1,b.bufnum,startPos:c[740])}.play

Loading…
Cancel
Save