Tested versions
- Reproducible in 4.7.2 (and latest master ca871cc). it's likely reproducible since the beginning of web samples playback, but at least as far back as here
System information
Intel MBP 15.7.9 - AMD Radeon Pro 5300M 4 GB Intel UHD Graphics 630 - but shouldn't matter.
Issue description
I know the guidance in the issue template says to submit separate issues for separate bugs, but these two bugs can be fixed by the same LOC change, and are closely related to one another (just with a slight twist).
I have put together a small fix for this and will open a PR shortly.
For web samples playback, pitch_scale is ignored in two cases:
- AudioStreamPlayer with autoplay=true (works fine when calling .play() directly)
- On the 2nd+ loops of a sample
The autoplay flavor of this bug has an additional codepath that seems to be broken (or at least, unintentionally called): the pause(enable:bool) method calls _unpause, which then unconditionally calls _restart, regardless of if the stream was playing or not.
(no ai used at all.)
Steps to reproduce
Autoplay bug:
- Add AudioStreamPlayer to scene
- Set autoplay=true
- Set pitch_scale=2
- Run scene: audio is playing at pitch_scale=1.
Loop bug:
- Add AudioStreamPlayer to scene
- Set autoplay=false
- Set pitch_scale=2
- Add an audio stream that has looping enabled
- Attach script,
_ready(): player.play() (important!)
- Run scene: audio will play with pitch_scale=2 properly, until it loops. at this point, pitch_scale is 1.0.
The cause of the pitch_scale problems is that _restart does not sync the playback rate when it creates a new AudioBufferSourceNode.
Minimal reproduction project (MRP)
This scene is configured to test both of these bugs.
pitch_mrp.zip
Tested versions
System information
Intel MBP 15.7.9 - AMD Radeon Pro 5300M 4 GB Intel UHD Graphics 630 - but shouldn't matter.
Issue description
I know the guidance in the issue template says to submit separate issues for separate bugs, but these two bugs can be fixed by the same LOC change, and are closely related to one another (just with a slight twist).
I have put together a small fix for this and will open a PR shortly.
For web samples playback, pitch_scale is ignored in two cases:
The autoplay flavor of this bug has an additional codepath that seems to be broken (or at least, unintentionally called): the
pause(enable:bool)method calls_unpause, which then unconditionally calls_restart, regardless of if the stream was playing or not.(no ai used at all.)
Steps to reproduce
Autoplay bug:
Loop bug:
_ready(): player.play()(important!)The cause of the pitch_scale problems is that _restart does not sync the playback rate when it creates a new AudioBufferSourceNode.
Minimal reproduction project (MRP)
This scene is configured to test both of these bugs.
pitch_mrp.zip