-
Notifications
You must be signed in to change notification settings - Fork 2
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 Detune (now wide browser support) #135
Comments
edit: I am not sure anymore if detune doesn't affect playback rate as well, that would make it less useful. Would have to be tested |
Deeply interested in this, I'm praying it's a trivial thing to add, but understood if not. Iirc depending on if you have audio in Sounds or Music folder, it will do different effects when using the PlaybackRate, I believe it time-stretches with no pitch shift for Music, and pitches up/down for Sounds. I believe this was the case, as I opted for putting my music in the Sounds folder for this very reason (wanted pitch shifting), which I do understand could be a very bad idea, especially if music is very long and gets loaded into memory. |
Yes please :) I have just recently added some dynamic sounds and my other option would be to add like 30 manually pitch-shifted versions. Changing the playback rate has obvious unwanted sideeffects for that purpose. |
I prototyped this but quickly found out that the Web Audio API actually does not support pitch shifting at all at the moment. The HTMLAudioElement does have a Pitch shifting audio appears to be a complex algorithm (granular synthesis came up in my research, and I think there are other approaches). It is probably possible to implement a custom pitch shifting algorithm with audio worklets, but I'd prefer not to build in such an approach, as it means integrating a complex library, and then has long-term compatibility implications if browsers do add the necessary feature but with a different approach. So I would prefer to only make this built-in if it's provided by a built-in browser API. Meanwhile it's possible to explore the custom audio processing approach with Construct's JavaScript coding feature, as you can access all the same browser APIs with that. For this to be implementable I think there are two approaches that could do it:
Either way this will need a change to the specification and support added by browsers. The relevant spec issues appear to be: Therefore I'm afraid this is not something we will consider implementing until the necessary web APIs are in place, so closing this request as declined. If the necessary web APIs are added, you can re-post this and we will reconsider. (On a side note: this is a classic example of how a simple-looking feature ends up being complicated, and it also illustrates how much prototyping and research work an apparently simple-looking feature request can end up taking, which is why it is difficult for us to respond to feature requests given we receive hundreds of them.) |
The description on the MDN web docs made it sound like it does just do pitch shifting, but apparently that's not the case. |
Reviewed guidelines
Checked for duplicate suggestions
Summary
Add the web audio API detune. This is useful to change pitch without changing length of the sound.
Possible workarounds or alternatives
Import sound pitch shifted, download size and maintainability suboptimal.
Change playback rate, but that changes length of the sound.
Proposed solution
Add the web audio API detune, as it now has wide browser support according to https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/detune
Why is this idea important?
Change pitch of a sound without changing its length, useful for adding variance to sound effects and games with music elements (i.e. you can play a piano in game)
Additional remarks
No response
The text was updated successfully, but these errors were encountered: