-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
packaging lamejs as an AudioWorklet #48
Comments
lamejs is just a bit manipulation library it transforms wave audio bits into mp3 bits. |
@zhuker yeah I get that. Maybe I misunderstand but it seems that the lamejs essentially takes Uint16Array data as input and produces Uint8Array encoded data as output. Is that right? I think the AudioWorklet api takes Float32Array data as input and output.
I started working on this in a branch, but ran into the aforementioned issue. Would be happy to send a PR if/when it works! |
Input:
You can easily convert float32 to int16 by multiplying each member of the
array by 32767
Output:
Mp3 is a stream of bytes hence uint8, outputting it as float32 makes no
sense
I am not very familiar with audioworklet but lamejs should be the
terminating node in an audio pipeline. Shouldn't it?
…On Wed, Dec 13, 2017, 20:12 Mike Reinstein ***@***.***> wrote:
lamejs is just a bit manipulation library it transforms wave audio bits
into mp3 bits
@zhuker <https://github.com/zhuker> yeah I get that. Maybe I
misunderstand but it seems that the lamejs essentially takes Uint16Array
data as input and produces Uint8Array encoded data as output. Is that
right? I think the AudioWorklet api takes Float32Array data as input and
output.
integration into apis are welcome as pull requests
I startd working on this in a branch, but ran into the aforementioned
issue. Would be happy to send a PR if/when it works!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEKlQn8IRQR0XhhRjgUf29-hC72wlmOxks5tAKA2gaJpZM4RBXpc>
.
|
The audio pipeline in my use case:
Yeah, this is what I'm struggling with. Unless I'm mistaken, as per https://webaudio.github.io/web-audio-api/#defining-a-valid-audioworkletprocessor AudioWorklet outputs are Float32Arrays. I'm trying to figure out how to package this in a sensible way as an AudioWorklet so that lamejs can be used a normal webaudio node. |
Did you solve this? |
That was 5 years ago, I'm not working on audio processing lately. Audio Worklet support has gotten pretty decent now though. It should be pretty feasible in theory. |
I achieved the requirement using the details here e18447f. Is the issue resolved? |
I guess I can take a look and see if i can make that work via audio worklet |
This is what I am doing with raw PCM input that I simultaneously stream with
In an |
You should be able to incorporate the changes https://github.com/guest271314/AudioWorkletStream. FWIW for speech synthesis processing can also utilize https://github.com/guest271314/native-messaging-espeak-ng. I am currently updating https://github.com/guest271314/captureSystemAudio for MP3 support. Next I will substitute https://github.com/davedoesdev/webm-muxer.js for |
Having played around a little with AudioWorklets just now, I can say with more confidence that my original ask just doesn't really make sense. WebAudio Nodes are intended to operate on Float32Arrays, both as input and output. If one were to package lamejs as an audio worklet, it would have to follow this format. None of the existing webaudio graph nodes can accept lamejs encoded mp3. It only really makes sense as an intermediate node. My original graph diagram visualizes this: I was piping from lamejs to watson-speech-to-text and a local storage sink. Neither of these destinations benefit from being represented as a webaudio node. |
Yes, it does make sense.
Not necessarily, parse, convert data to the expected
Technically it can via HTML
The benefit is flexibility, and fidelity, particularly for speech to text. Though Mozilla Voice does use MP3. You can certainly pipe a The requirement is possible. |
Chrome is about to land AudioWorklet and deprecate ScriptProcessorNode.
It would be awesome if lamejs could be used a normal WebAudio node.
https://www.chromestatus.com/features/4588498229133312
The text was updated successfully, but these errors were encountered: