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

[Sound] Add speed accessor #30

Closed
Tracked by #50
beefchimi opened this issue Mar 12, 2023 · 0 comments · Fixed by #50
Closed
Tracked by #50

[Sound] Add speed accessor #30

beefchimi opened this issue Mar 12, 2023 · 0 comments · Fixed by #50
Assignees
Labels
✨ Feature New addition to the codebase (feature, utility, component, etc.)

Comments

@beefchimi
Copy link
Owner

beefchimi commented Mar 12, 2023

We should be able to adjust the playbackRate of each Sound. This probably should be restricted to Sound and unavailable on Stack or Earwurm.

Changing playbackRate also affects "pitch" - the faster the audio is played, the higher pitch is sounds. At the moment, there is no native way to "preserve pitch", but it is in discussion here: WebAudio/web-audio-api#2487

We should try to implement a custom solution (if possible) to preservePitch.

Expectation

const sound1 = await stack.prepare();
// Should be `1` by default.
const currentSpeed = sound1.speed;

// sound1.speed = 2;
sound1.setSpeed(2, 1000);

const sound2 = await stack.prepare({speed: 2});
const sound3 = new Sound(...props, {speed: 0.5, preservePitch: true});

Key points

@beefchimi beefchimi added the ✨ Feature New addition to the codebase (feature, utility, component, etc.) label Mar 12, 2023
@beefchimi beefchimi self-assigned this Jan 3, 2024
@beefchimi beefchimi linked a pull request Jan 3, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature New addition to the codebase (feature, utility, component, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant