Skip to content

Feat: wrap AudioBuffer with JS proxy #90

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

Merged
merged 13 commits into from
Mar 17, 2024
Merged

Feat: wrap AudioBuffer with JS proxy #90

merged 13 commits into from
Mar 17, 2024

Conversation

b-ma
Copy link
Collaborator

@b-ma b-ma commented Feb 26, 2024

Before

RESULTS:
  - # pass: 115
  - # fail: 23
  - # type error issues: 20

After

(w/ orottier/web-audio-api-rs#463)

  RESULTS:
  - # pass: 145
  - # fail: 13
  - # type error issues: 0

@@ -40,6 +41,10 @@ ${d.nodes.map(n => ` ${d.name(n)},`).join('\n')}
}
}

createBuffer(numberOfChannels, length, sampleRate) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to have this constructor option supported

@@ -0,0 +1,20 @@

exports.toSanitizedSequence = function toSanitizedSequence(data, targetCtor) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this for?

Copy link
Collaborator Author

@b-ma b-ma Feb 26, 2024

Choose a reason for hiding this comment

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

Finally... for nothing in this PR :) but I was thinking copyFromChannel and copyToChannel had the same API as for example https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createiirfilter which support any kind of floating point value sequence, e.g. Array, Float32Array, Float64Array (numbers is JS are basically only double)
Should be useful later I hope/imagine

@b-ma
Copy link
Collaborator Author

b-ma commented Feb 27, 2024

Just realized there is an issue with startRendering and decodeAudioData which do not return a wrapped object.
Need to change the wrapping approach to make it more like a mixin rather than use inheritance I guess (e.g. like
AudioParam.js)

@b-ma
Copy link
Collaborator Author

b-ma commented Mar 13, 2024

Ok I made the changes, but wpt results are a bit disturbing...

(all are made against rust upstream/main)

npm run wpt -- --filter the-audiobuffer-interface

main (upstream: main)

RESULTS:
  - # pass: 115
  - # fail: 22
  - # type error issues: 21

feat/audiobuffer-proxy (upstream: main)

RESULTS:
  - # pass: 140
  - # fail: 14
  - # type error issues: 0

Which is nice, but if I do

npm run wpt

main (upstream: main)

  RESULTS:
  - # pass: 5398
  - # fail: 624
  - # type error issues: 62

feat/audiobuffer-proxy (upstream: main)

  RESULTS:
  - # pass: 5302
  - # fail: 568
  - # type error issues: 41

Don't really understand, less failing test but less passing test too...

@orottier
Copy link
Collaborator

Without looking into it, I just want to comment it is possible to both decrease in success and fail.
One newly introduced failure can block many subsequent successes.

I'm using the following trick to digest the results better:

(make sure to run npm run build before)

create file run-wpt.sh and chmod +x run-wpt.sh:

#!/bin/bash
echo $1
echo ~~~~~~~~~~~~~~~~~
node ./.scripts/wpt-harness.mjs --filter "$1" 2>&1 | grep -A 3 RESULTS
echo

dissect the full suite per directory:
ls wpt/webaudio/the-audio-api | xargs -I {} ./run-wpt.sh {}
check the specific file results in a dir:
ls wpt/webaudio/the-audio-api/the-oscillatornode-interface | xargs -I {} ./run-wpt.sh {}

@b-ma
Copy link
Collaborator Author

b-ma commented Mar 13, 2024

Ah thanks!

@b-ma
Copy link
Collaborator Author

b-ma commented Mar 17, 2024

Ok, finally got it working, it was a bit more complex than expected but paves the way for #84

main

RESULTS:
  - # pass: 5215
  - # fail: 628
  - # type error issues: 68

feat/Audiobuffer-proxy

RESULTS:
  - # pass: 5278
  - # fail: 591
  - # type error issues: 46

@b-ma b-ma merged commit defbfa1 into main Mar 17, 2024
5 checks passed
@b-ma b-ma deleted the feat/audiobuffer-proxy branch March 17, 2024 16:02
@b-ma b-ma mentioned this pull request Mar 17, 2024
12 tasks
@orottier
Copy link
Collaborator

Cool!

@b-ma b-ma mentioned this pull request Mar 30, 2024
2 tasks
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