首页 > 解决方案 > 使用 Overtone 从磁盘读取声音文件?

问题描述

我想使用 Overtone 从磁盘播放更长的连续音频文件。

我知道 Overtone 有将样本加载到内存中的功能,但鉴于这些文件会很长而且很大(可能是几个小时),这不是我想要使用的方法。

SuperCollider - Overtone 用作其音频引擎 - 但是,也有另一种加载和流式传输文件的方法,即使用 DiskInOvertone 似乎也有,但我无法找到(文档github)相应的Buffer.cueSoundFile()功能。

Overtone有cueSoundFile吗?我还有其他方法可以使用吗?

标签: clojuresupercolliderovertone

解决方案


cueSoundFile 是等效的 osc 消息 /b_read 的一个更高级的术语,您可以在 Overtone 中找到overtone.sc.buffer/buffer-cue.

作为一个 5 秒的演示,它从磁盘播放一个 2 通道文件。

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

还有磁盘输入文档(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

推荐阅读