The API draft is looking good, there is streaming issue.
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).
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.
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'}...
Or we can pass {samplesPerFrame: 1024} which can return reader function, which can be used by stream later?
We can provide audio.pull, audio.stream methods for according streams.
The API draft is looking good, there is streaming issue.
audio.write(stream)
.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.type
param so thataudio.read(offset, duration, {type: 'stream'})
returns node stream,{type: 'function'}
returns reader and{type: 'pull'}
...{samplesPerFrame: 1024}
which can return reader function, which can be used by stream later?audio.pull
,audio.stream
methods for according streams.