Reading a sound file from the disk with Overtone?

197 Views Asked by At

I would like to use Overtone to play a longer continuous audio file from disk.

I know Overtone has facilities for loading in samples into memory, but seeing as these files will be long and large (possibly on the order of hours), this is not the method I want to use.

SuperCollider - which Overtone uses as its audio engine - however, also has another way to load and stream files, namely using DiskIn, which Overtone also seems to have, but I wasn't able to find (docs, github) a corresponding Buffer.cueSoundFile() function.

Does Overtone have cueSoundFile at all? Is there another way I can use?

1

There are 1 best solutions below

1
On BEST ANSWER

cueSoundFile is a fancier term for the equivalent osc message /b_read which you'll find in Overtone as overtone.sc.buffer/buffer-cue.

As a 5 second demo, this plays a 2-channel file from disk.

(demo (disk-in 2 (buffer-cue "~/Music/10mb.wav")))

And the doc for disk-in (SC DiskIn)

user=> (doc disk-in)
-------------------------
overtone.live/disk-in
([numChannels bufnum loop])

  stream audio in from disk file

  [numChannels :none, bufnum :none, loop 0]

  numChannels - Number of channels in the incoming
                audio.
  bufnum      - Id of buffer
  loop        - Soundfile will loop if 1 otherwise
                not.

  Continuously play a longer soundfile from disk. This
  requires a buffer to be preloaded with one buffer size of
  sound. If loop is set to 1, the soundfile will loop.

  Categories: InOut, Buffer
  Rates: [ :ar ]
  Default rate: :ar