-
Notifications
You must be signed in to change notification settings - Fork 11
[meta] WebCodecs: Clearly define how Web Audio API input will connect to WebCodecs output #61
Comments
Included:
|
Improved result where these problems are observed
using Posting the code here now before crash the browser and OS again and potentially lose the tentatively working version
However, the "glitches" or "gaps" between the merged files is still perceptible in some instances. It should be possible to set How will using WebCodecs with Web Audio API improve playback quality when the requirement is to use disparate and arbitrary media sources into a single, or multiple inputs to Web Audio API? How is WebCodecs concretely conceptualized as being capable able to resolve the issue: to process partial media file input, arbitrary selection of parts of media, or a potentially infinite input stream via WebCodecs; where is the connection made to Web Audio API? |
Has OfflineAudioContext rendering output been considered as an input to WebCodecs? See https://github.com/WebAudio/web-audio-api/issues/2138 |
@JohnWeisz The
Using Given the PCM processing model am not sure how the overall memory usage can be reduced at all. What can be improved is garbage collection once use of the audio buffers is no longer needed. If Web Audio API connects to WebCodecs via |
I totally agree |
Using Since per the Explainer WebCodecs is focused on
could be used to connect to Web Audio API, if necessary. Am trying to gather how the specification authors who have suggested that WebCodecs will somehow solve issues posted at Web Audio API repositories are actually cconceptualizing a prospective design pattern. As yet have not located any documentation that can point to which provides evidence of any such concept, flow-chart, algorithms, or API connection architecture. |
A proof-of-concept for a tentative WebCodecs-type connection to Web Audio API. To preface, have tested the code at least hundreds of times locally serving a ~35MB WAV file (22.05 kHz, 2 channels) converted from Opus using
which can be downloaded from https://drive.google.com/file/d/19-28SYFjhHg_a5NqPG1GIqV_sy5iMQ5x/view. Have no way to test the code at other architectures or devices right now. The goal of this code is to demonstrate how a WebCodecs-like API would connect to Web Audio API. Specifically, the primary goal is to request any audio file having any codec and to parse (demux) and commence playback of that media resource during reading of the request - before the entire file has been downloaded - and for that audio playback to be "seamless" (still some work to do there, though "works" as a base example of the pattern). The bulk of the work in this example is done in a Kindly test the code at various devices, architectures to verify the output. index.html
worker.js
codecs.js
wav22k2ch.js
audioWorklet.js
|
Theoretically, since the pattern is initiated in this case by The same procedure should be possible for input Was able to parse hexadecimal encoded PCM within Matroska file output by Next will attempt to parse Opus, both in a WebM and OGG containter, without using WASM, using only the API's shipped with the browser. |
Demonstration with 277MB WAV file https://plnkr.co/edit/nECtUZ?p=preview. |
Virtual F2F:
|
AFAICT Web Codec is not specified or implemented. The issues closed reference WebCodecs somehow being capable of connecting to WebAudio API. However, no such evidence exists that is or will be the case. Until then, this issue should remain open. |
As have already proven in several issues and code examples using |
Describe the feature
WebCodecs proposal is mentioned at V1 in several issues
Is there a prototype?
No.
It is not at all clear how WebCodecs will solve any of the issues where Web Audio API specification authors have suggested the same might eventually be possible.
So far there are only unsubstantiated claims without any hint of an algorithm or proof-of-concept in code where using WebCodecs would produce any result different than is currently possible using Web Audio API V1.
Since Web Audio API only processes PCM
without any documentation, example code, or even a concept to prove otherwise the gist of WebCodecs relevant to Web Audio API V1 or V2 would essentially be an arbitrary audio codec input to PCM output. Nothing more can be gleaned from the comments thus far, besides "hope" for some furture capability proferred by WebCodecs that will somehow be connectable to Web Audio API. For individuals that do not entertain hope, rather base conclusions on facts, there are currently no facts available which support the claims made thus far that WebCodecs will provide some means to solve the issues closed that point to WebCodecs proposal as being capable of remedying the problems described in the issues.
It is not clear how WebCodecs will change or modify at all Web Audio API processing model re "5.1. Audio sample format" or "5.2. Rendering", presently making any reference to "This will now be handled by https://discourse.wicg.io/t/webcodecs-proposal/3662" moot, null and void, particularly without any example or basic flow-chart detailing how precisely Web Audio API will connect to WebCodecs.
Describe the feature in more detail
This issue is intended to be a meta thread for WebCodecs prospective connection with the as-yet un-sepecified and un-deployed WebCodecs.
As a concrete example of the problem with simply suggesting WebCodecs will solve a current problem with the Web Audio API in the future, without evidence to support such a claim, following up on WebAudio/web-audio-api#2135 where
decodeAudioData()
does not support decoding partial content, leading to memory usage that eventually crashes the tab, was able to cobble together a working example of streaming Opus audio attempting to solve thisMediaSource
issue w3c/media-source#245 using Web Audio API by first splitting the file into N 15 second Opus files withffmpeg
ormkvmerge
then sorting and merging the files again into a single file usingFile
sthen serving the map of sorted offsets with the merged file
which allows executing
decodeAudioData()
on one of the included N merged parts of the single served file then commencing playback of that audio segment without decoding all of the N parts of the file first - and without discernable gaps in playback (not achieved with first attempt at splitting the file). Included is the first execution of the spittling of the file and original file in attached zip archive.The problem is twofold
ended
event of source buffer)AudioWorklet
to avoid gaps requires substantial attention to the 128 byte perprocess()
execution, where when the test is not correctly configured can crash the browser tab and the underlying OS.The suggested solution for this case as evidenced by the closure of similar use cases is now to use WebCodecs. However, it is not immediately clear at all how WebCodecs will overcome Web Audio API "Audio sampling format" and "Rendering" sections. This corresponding subject-matter WebCodecs issue w3c/webcodecs#28 is not resolved.
Given the code example above and cross-referencing to WebCodecs examples https://github.com/WICG/web-codecs/blob/master/explainer.md#examples the only code where Web Audio API would potentially connect to output of WebCodecs is by way of a
MediaStreamTrack
, not PCMThe question then becomes would the output
MediaStreamTrack
beconnect()
ed to a an audio node? If no post-processing or output modification is required why would Web Audio API be used at all in that case?Given the above example code that combines N files into a single file to preserve metadata for each file for
decodeAudioData()
what pattern would fulfill the suggestion that WebCodecs would solve the problems described in the linked closed issues that refer to WebCodecs?Ideally we should be able to parse any input file having any audio codec to
AudioWorklet
asFloat32Array
without having to also useMediaStreamTrack
, or again, why use Web Audio API at all in that case where we can simplyaudio.srcObject = new MediaStream([await audioDecorder])
?Is
expected to be used for connect to WebCodecs, where we could stream the Opus file without splitting the file into N parts - and playback will begin without parsing the entire input, especially where the input might not have a definitive end - even though that method is only available at Firefox?
The answer to, but not limited to the above questions, relevant to the reference to WebCodecs dependence, reliance or referral should be clear.
Re
Can the specification authors who have made the above claims kindly clearly write out precisely what you are "doing" re WebCodecs being connectable in any meaningful way to Web Audio API (V1 and V2)?
The text was updated successfully, but these errors were encountered: