Skip to content
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

[AUDIO_WORKLET] Add multichannel audio tests. NFC #23394

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cwoffenden
Copy link
Contributor

@cwoffenden cwoffenden commented Jan 14, 2025

These are the audio worklet tests from #22753 extracted to a standalone PR. The tests are:

  • Multiple stereo inputs mixing in the processor to a single stereo output
  • Multiple stereo inputs copying in the processor to multiple stereo outputs
  • Multiple mono inputs mixing in the processor to a single mono output
  • Multiple mono inputs copying in the processor to L+R stereo outputs

The tests use different stack sizes (from 2kB to 6kB depending on the requirement).

The audio tracks were composed by Tim Wright especially for Emscripten and released under a CC0 license.

The tests can be run manually via:

test/runner interactive.test_audio_worklet_stereo_io
test/runner interactive.test_audio_worklet_2x_stereo_io
test/runner interactive.test_audio_worklet_mono_io
test/runner interactive.test_audio_worklet_2x_hard_pan_io

There are no code changes to Emscripten apart from integrating the test.

@sbc100
Copy link
Collaborator

sbc100 commented Jan 14, 2025

I love that Tim Wright composed our audio tests :) Please tell him I was a great fan or Lemmings and Shadow of the Beast 2 back in the day.

@cwoffenden
Copy link
Contributor Author

I love that Tim Wright composed our audio tests :)

😁

Please tell him I was a great fan or Lemmings and Shadow of the Beast 2 back in the day.

Now we'll need to widen the office doors even more to let in his ego!

test/webaudio/audioworklet_in_out_stereo.c Outdated Show resolved Hide resolved
test/webaudio/audioworklet_in_out_stereo.c Outdated Show resolved Hide resolved
test/webaudio/audioworklet_in_out_stereo.c Outdated Show resolved Hide resolved
EM_JS(EMSCRIPTEN_WEBAUDIO_T, createTrack, (EMSCRIPTEN_WEBAUDIO_T ctxID, const char* url, bool looping), {
var context = emscriptenGetAudioObject(ctxID);
if (context) {
var audio = document.createElement('audio');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these two JS functions needed? Is this functionality not available though existing emscripten APIs?

Are folks expected to create their own audio elements like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, there's no provision (that I know of) to create audio tracks.

In reality the audio will probably come in via other means (we decode and mix Opus files, for example, or generate effects).

test/webaudio/audioworklet_2x_in_out_stereo.c Outdated Show resolved Hide resolved
@sbc100 sbc100 changed the title [AUDIO_WORKLET] Standalone multichannel audio tests [AUDIO_WORKLET] Add standalone multichannel audio tests Jan 14, 2025
@sbc100 sbc100 changed the title [AUDIO_WORKLET] Add standalone multichannel audio tests [AUDIO_WORKLET] Add standalone multichannel audio tests. NFC Jan 14, 2025
@sbc100 sbc100 changed the title [AUDIO_WORKLET] Add standalone multichannel audio tests. NFC [AUDIO_WORKLET] Add multichannel audio tests. NFC Jan 14, 2025
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I knew the audio worklet API better so I could give this a better review myself.

@juj perhaps you could review later if you get time?

lgtm to all the parts I could understand

test/webaudio/audioworklet_test_shared.inc Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants