audiojs / audio

Class for high-level audio manipulations [NOT MAINTAINED]
MIT License
240 stars 9 forks source link

Streaming #23

Closed dy closed 7 years ago

dy commented 7 years ago

The API draft is looking good, there is streaming issue.

  1. Should we provide partially loaded data, like HTMLMediaElement, or we work only with completely loaded buffer? I would opt for the second, because we can stream in later by audio.write(stream).
  2. audio.write(stream, offset) method can take streams as input, technically it can detect the type of stream. But how shoud we stream out? audio.read(offset, duration) returns buffer.
    1. Should we extend it to take type param so that audio.read(offset, duration, {type: 'stream'}) returns node stream, {type: 'function'} returns reader and {type: 'pull'}...
    2. Or we can pass {samplesPerFrame: 1024} which can return reader function, which can be used by stream later?
    3. We can provide audio.pull, audio.stream methods for according streams.
dy commented 7 years ago

Ok, pull/stream methods are ok.