[FEAT] Allow negative playback speeds in SoundPlayer
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 512
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Requirements
- I have searched the existing issues to ensure this feature has not already been requested.
- I have clearly described the problem and the proposed solution.
- I have considered alternative solutions.
1. Is your feature request related to a problem? Please describe.
I'm working on a realistic simulation of a vinyl record turntable for my app Vinyl Desktop.
The app is made using Godot with C# and is currently using FMOD Core as its audio engine. I wanted to try out SoundFlow as an open source replacement. Refactoring the audio system code was generally straightforward, but I ran into one major blocker.
Users can rewind (and scratch) the record while it is playing, making the audio play backwards. In FMOD I do this by changing the frequency of the sound channel to a negative value, like so:
_channel.setFrequency(_defaultFrequency * playbackSpeed)
Where _defaultFrequency is the original sample rate of the sound (eg: 48000Hz), and playbackSpeed can be either positive or negative.
But in SoundFlow trying to set the PlaybackSpeed property on an SoundPlayer to negative throws a Playback speed must be greater than zero. exception.
2. Describe the Solution You'd Like
Allow SoundPlayer.PlaybackSpeed to be set to a negative value, causing the audio to play backwards.
3. Describe Alternatives You've Considered
I also tried setting the AudioFormat.SampleRate of the SoundPlayer as a hack, but the Format property is read-only.
4. Proposed API (if applicable)
5. Benefits
This would allow SoundFlow to be used in a wider range of application, like for example a DJ application.
6. Potential Drawbacks/Challenges
No response
7. Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SoundPlayer.PlaybackSpeed property and the validation that raises the “Playback speed must be greater than zero” exception. Trace the playback path to determine how reverse audio can be supported without breaking positive speeds; done means negative values play audio backwards while existing forward playback continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100