AudioBufferSourceNode outputs silence when AudioBuffer.copyToChannel(content) is called after ABSN.buffer = buffer and before ABSN.start() is called
Categories
(Core :: Web Audio, defect, P3)
Tracking
()
People
(Reporter: guest271314, Assigned: padenot)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome)
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Linux i686; rv:80.0) Gecko/20100101 Firefox/80.0
Steps to reproduce:
Create N files of length 512 containing raw PCM s16le 2ch 44100Hz.
Upload files using <input type="file" multiple>
Convert file to Float32Array
Set Float#2Array to AudioBuffer using copyToChannel() or getChannelData(index).set()
start() AudioBufferSourceNode
Actual results:
No audio is output.
Expected results:
Audio should be output.
Chromium 86 outputs audio for copyToChannel() and getChannelData(index).set().
Reporter | ||
Comment 1•4 years ago
|
||
Reporter | ||
Comment 2•4 years ago
|
||
There is no guarantee the FileList
from <input type="file">
will be sorted numerically. To eliminate the possibility of the files being set as Float32Array
s in reverse or arbitrary order tested sorting the FileList
or converting FileList
to Array
then sorting which does not output audio either.
The audio does play using AudioWorkletProcessor
.
Reporter | ||
Comment 3•4 years ago
|
||
The problem appears to be that
AudioBuffer.copytoChannel(Float32Array, 0)
is executed after
AudioBufferSourceNode.buffer = AudioBuffer
Reporter | ||
Comment 4•4 years ago
|
||
Per the specification should not the "acquire the contents of an AudioBuffer operation" algorithm take place only when start()
is called, at which time copyToChannel()
has already been called and start()
has not previously been called?
- When AudioBufferSourceNode.start is called, it acquires the contents of the node’s buffer. If the operation fails, nothing is played.
- When the buffer of an AudioBufferSourceNode is set and AudioBufferSourceNode.start has been previously called, the setter acquires the content of the AudioBuffer. If the operation fails, nothing is played.
Specification issue https://github.com/WebAudio/web-audio-api/issues/2227
Reporter | ||
Comment 5•4 years ago
|
||
Just happened to come across this issue while creating a workaround for an issue with a different API. Am not sure if Nightly behaviour is correct or not per the specification because the specification is not clear from perspective here.
Per the Web Audio API specification should content from copyToChannel()
be output with this code
buffer.copyToChannel(result[0], 0, 0);
buffer.copyToChannel(result[1], 1, 0);
console.log(result[0].every((f, i) => f === buffer.getChannelData(0)[i]), result[1].every((f, i) => f === buffer.getChannelData(1)[i]));
source.buffer = buffer;
and conversely not with this code
source.buffer = buffer;
buffer.copyToChannel(result[0], 0, 0);
buffer.copyToChannel(result[1], 1, 0);
console.log(result[0].every((f, i) => f === buffer.getChannelData(0)[i]), result[1].every((f, i) => f === buffer.getChannelData(1)[i]));
?
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Hi reporter,
Thanks for the details, I will move this over to a component so developers can take a look over it. If is not the correct component please feel free to change it to an appropriate one.
Thanks for the report.
Clara
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Just saw the "parity-chrome" keyword. FYI, Chrome hasn't implemented the section about acquiring the contents for an AudioBufferSourceNode.
Description
•