-
Notifications
You must be signed in to change notification settings - Fork 11
RawPCMStreamNode (StreamNode, or InputStreamNode) #97
Comments
This will also provide a simpler solution for https://github.com/WebAudio/web-audio-api-v2/issues/90
|
Related https://github.com/w3c/mediacapture-insertable-streams. Not sure if that proposal can solve this. |
This is largely solved by https://github.com/w3c/mediacapture-insertable-streams and https://github.com/w3c/webrtc-insertable-streams, and to the extent applicable, without making the tab unresponsive, WebCodecs |
Largely though not completely solved. The |
A tentative workaround in lieu of
Interestingly, the I am not certain why |
One issue is that with live input streams the Consider the function
when the input Uint8Array from a ReadableStreamDefaultReader.read() call is a single TypedArray, or multiple TypedArray's where the length is an even number, e.g.,
or
the audio is output effectively as expected, with minimal artifacts. However, when the input is a live stream where the Uint8Array length is arbitrary, and potentially an odd length,
the audio output can include static interference, evidently at the locations in the timeline when the
where construction of an Int16Array from a Uint8Array with odd length will not throw
passing the buffer will throw
we lose data
resulting in static inference in audio output. A tentative solution that I have previously attempted is to "carry over" the odd value, however, artifacts are still evident in playback at the locations in the timeline where we need to create and slice multiple
A solution that does output expected result with
during the live stream. For this feature request, a means to stream raw PCM which in general will be accessed in the form of a |
Based on testing there does not appear to be any way to avoid glitches, gaps, static interferences ("fragmentation") when streaming audio using multiple Memory limits in webassembly https://stackoverflow.com/a/40425252
For |
WebCodecs does not help with this. The Inserrtable Streams (Breakout Box; Media Transform API) can be utilized to achieve the expected result. |
Describe the feature
Is there a prototype?
Yes. Rather involved, illustrating some of the deficiencies of
SharedArrayBuffer
and even dynamicSharedArrayBuffer
memory growth usingWebAssembly.Memory.prototype.grow()
, thus this feature request to simplify the process.From wasmerio/wasmer-php#121 (comment)
Describe the feature in more detail
Internally
RawPCMStreamNode
(or simplyStreamNode
orInputStreamNode
) is aTransformStream
that accepts aReadableStream
(readable
) of raw PCM, transforms the raw data (the terms "interleaved" and "planar" are no longer included in Web Audio API v1) intoFloat32Array
(s) corresponding to the number of channels contained in the input stream and sets theFloat32Array
(s) asoutputs
inprocess()
.Externally his will work in the same way as
MediaElementSourceNode
where when connected to an
AudioWorkletNode
AudioWorkletProcessor.process()
effectively takes input fromsrc
ofHTMLMediaElement
and resulting audio pipeline and outputsFloat32Array
s atoutputs
.This will provide an entry point for users to utilize
AudioContext
for non-standard or non-implemented device capture and processing with Web Audio API.WebCodecs does not solve this - unless that solution can be unequivocally proven here by evidence, not conjecture.
Related art:
Related issue:
The text was updated successfully, but these errors were encountered: