-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
web: Decode and mix audio via Rust #4273
Conversation
0525438
to
6961cab
Compare
@Herschel, many thanks for this new implementation It would be great to have Just in case it is relevant, at least in MP3 sampling rate should be read from file itself (since Flash already allows unspecified values such as 16 kHz [as reported in #335]). Many thanks for your code. |
I've done some testings using the web extension (Firefox). Not sure that's very useful because this PR is still a draft, but here are my observations.
|
@Toad06, could you check whether https://www.free-culture.tk/lfc-presentation.swf is played with distorsion or not? Many thanks for your help. |
@ousia I don't hear any distortion other than distortion I would expect from the source audio being a fairly low bitrate. |
@sombraguerrero, many thanks for your help. Are you playing the SWF file with the desktop program? This is what plays distorted sound. |
Fixed the panic in the Sonic Shorts cartoon. Weird dash sound in Ultimate Flash Sonic seems to be a decoding issue in symphona, filed an issue. Wasn't able to repro the Garfield Coop Catch issue, it seems to loop for me (is it the in-game music?) |
The issue reported in Symphonia has been fixed (no idea when the new version will be released). Just in case it helps. |
Symphonia, release 0.3.0 contains the fix for pdeljanov/Symphonia#28 (reported by @Herschel). Just in case it might help. |
Waiting for this merge for a loadSound pull request (some issues with asynchronous decode_audio_data). |
So, I wound up making a few small changes in #5059 that will conflict with this PR if either of them are merged. Specifically, I added Also, I noticed you added mixins for an audio backend base. I think it might be useful to have |
Hi Ruffle dev team, @kmeisthax does your note mean that this Pull Request wasn't implemented? We've downloaded most recent Ruffle version, but our sound.position issue still stopping play (see my Issue #5019 ).... Thank you for any advice! |
When a PR is still in the draft state, it is not part of the main code branch (that's what 'merging' generally means). The only way you would be able to interact with these changes is if you happened to fork the branches that the rest of the developers are working on. |
@zumbasana, [WIP] in title stands for “work in progress”. This is still a draft. As far as I know, there is no commit (no code yet) that deals with The lack of I’m afraid we have to work until this pull request gets merged (if it contains the implementation of I hope this makes the situation clearer and I apologize if this contains explanations obvious to you. |
Thanks much @sombraguerrero and @ousia , I'm a complete non-coding newbie, so your elucidation appreciated. We've got several AS2 projects using sound.position ..... is it possible to bump up a Ruffle translation of that, and work with you guys to get it resolved? Thank you! |
@zumbasana, according to what @kmeisthax wrote in #5059 (comment), I cannot code, but I wonder whether the implementation of Other than that, @Herschel (as the author of this pull request) could explain better how long it would take to get |
No longer necessary now that web audio mixing is done on Rust side.
This returns the approximate interval that the audio backend updates the sound position information. This is used for syncing animation to embedded "stream" audio tracks, and fixes some stuttering in cases where the syncing was being too strict.
Ok, let's see how this goes! |
Both `byteorder` and `fnv` are no longer used since ruffle-rs#4273.
Both `byteorder` and `fnv` are no longer used since #4273.
WebAudioMixerBackend
that uses theAudioMixer
on web, outputting the audio stream via a pair ofAudioBufferSourceNode
s.symphonia
for MP3 decoding on web.This gives consistent audio between the web and desktop builds. On web, it should significantly improve loading performance and memory usage, as the AudioMixer can decode the audio on demand, as opposed to decoding completely on load using
decodeAudioData
. This also allows us to simplify some of the preloading code, as the API was contorting itself to deal with SoundStreamBlock data within the limitations of WebAudio.Performance may be more intensive during playback as audio is decoded on the fly and not leveraging the browser's native audio capabilities. Underruns may also be an issue, for example, if some AS code does a busy loop, then the audio may drop out.
We should eventually move towards using
AudioWorklet
instead, and only useAudioBufferSourceNode
as a fallback. We can defer that part to a future PR, as a fullAudioWorklet
implementation will be quite involved and may require us to deal with shared memory.Thx to @torokati44 and @Toad06 for the assistance!