Dataset from individual sounds? (SC)

Ah right, got you.

Possibly slightly easier to do with SoundFile.collect, here’s an example of making a big concatenated buffer from this post.

s.boot
(
~files=SoundFile.collect("/Users/owen/dev/flucoma-core/Resources/AudioFiles/*");
~frames = ~files.collect{|f| f.numFrames}; 
~totalFrames = ~frames.sum; 
~buf = Buffer.alloc(s, ~totalFrames);
~frameCount = 0; 
~files.do{|f|
	~buf.readChannel(f.path, bufStartFrame:~frameCount, channels:[0]);
	~frameCount = ~frameCount + f.numFrames; 
};
)

If you wanted to keep hold of the list of ‘index’ times, you just do a cumulative sum of the ~frames list as well.

~frames.reduce{|a, b|var old = a.asArray; old ++ (b + old.last)}
2 Likes