neoRiley Posted May 7, 2014 Share Posted May 7, 2014 I've looked at the docs for the Sound object and there isn't anything jumping out that lets me adjust pitch at runtime, but hoping there's a way to do it that someone could share Is there away to adjust pitch at runtime? Link to comment Share on other sites More sharing options...
stasuss Posted May 7, 2014 Share Posted May 7, 2014 According to WebAudio specification you CAN Search this page for 'pitch' word. Link to comment Share on other sites More sharing options...
neoRiley Posted May 7, 2014 Author Share Posted May 7, 2014 According to WebAudio specification you CAN Search this page for 'pitch' word. awesome!!! I'll look into that and report back Thanks! Link to comment Share on other sites More sharing options...
neoRiley Posted May 7, 2014 Author Share Posted May 7, 2014 well, just to answer this so no one comes here thinking I abandoned this - I abandoned this idea When I found out that IE doesn't support webaudio, it made it pointless. So, my solution was to take 2 different car engine sounds - one idle, the other rev'd up and I cross fade them together by setting their volumes to the speed of the car. A slower speed means the idle sound is louder, and when as you accelerate, the rev'd sound becomes louder Anyway, hope that helps someone else jpdev 1 Link to comment Share on other sites More sharing options...
Wavertron Posted September 15, 2014 Share Posted September 15, 2014 (resurrecting an old thread) Seems like it would be neat to be able to programmatically alter pitch/playing speed.Even though it seems IE and Android doesnt support WebAudio, has anyone got this working in Phaser?I read WebAudio supports it, but wasnt able to get it to work in Phaser. http://updates.html5rocks.com/2012/01/Web-Audio-FAQ Q: How can I change the pitch of a sound using the Web Audio API?A: Change the playbackRate on the source node. I tried this, but to no effect://mySound = a Phaser.Sound objectvar pbr = { value: 2, defaultValue: 2};this.mySound._sound.playbackRate = pbr;this.mySound.play(); Link to comment Share on other sites More sharing options...
eldog Posted April 1, 2015 Share Posted April 1, 2015 @Rudy You were almost there, you need to set the value parameter (confusing I know, see AudioParam in the webaudio spec for more information, it is like this so you can make values ramp at a certain time, e.g., do a fade in) this.mySound._sound.playbackRate.value = pbr; Link to comment Share on other sites More sharing options...
ritherz Posted June 14, 2016 Share Posted June 14, 2016 This is like the first thing that comes up on google for how to change pitch. The last comment doesn't quite do it. After some playing around, I found that I actually had to play the sound before altering it immediately after: this.mySound.play(); this.mySound._sound.playbackRate.value = 1.2; This worked for me Like this Link to comment Share on other sites More sharing options...
FlashyGoblin Posted September 8, 2017 Share Posted September 8, 2017 On 6/13/2016 at 10:43 PM, ritherz said: This is like the first thing that comes up on google for how to change pitch. The last comment doesn't quite do it. After some playing around, I found that I actually had to play the sound before altering it immediately after: this.mySound.play(); this.mySound._sound.playbackRate.value = 1.2; This worked for me Like this This works great, but not on iOS. Anyone know how to change the pitch on iOS devices? Thanks. Link to comment Share on other sites More sharing options...
samme Posted September 8, 2017 Share Posted September 8, 2017 Quote On iOS 7 you can only affect the playbackRate when the media is paused (not while it's playing). Web Audio playbackRate explained Link to comment Share on other sites More sharing options...
Recommended Posts