Play random excerpts from a sound file

When you read a sound file into a buffer~ with a read or replace message, the exact amount of time that that operation will take is unknowable, but the buffer~ will send a bang out of its right outlet when the file has been completely loaded into RAM. When you load a file, you should wait for that bang before proceeding.

This patch uses that bang to get information about the duration of the file (the size of the buffer), and uses that information to set the maximum value for a set of random objects that will be used to choose random starting points within the buffer. A metro object regularly chooses four random starting points within the buffer and sends those times in start messages to four play~ objects.

So, the bang from buffer~ triggers the duration info from info~, which is used as the maximum for random, which limits the range of possible starting points for play~.

Chapter: