Skip to content

[BUG] PlaybackSpeed leads to bad audio quality #89

@BlyZeDev

Description

@BlyZeDev

Requirements

  • I have searched the existing issues to ensure this bug has not already been reported.
  • I have provided a clear and concise description of the bug.
  • I have provided detailed steps to reproduce the bug.
  • I have included a minimal reproducible example (MRE) if applicable.
  • I have provided error messages and stack traces if applicable.
  • I have completed the environment information.

1. Describe the Bug

If the playback speed is changed to a value other than 1.0f the quality gets really bad.

2. Steps to Reproduce

Call PlaybackSpeed with any value other than 1.0f

3. Expected Behavior

The sound to play faster and not lose quality

4. Current Behavior

The sound plays inconsistently faster and the quality gets very bad

5. Minimal Reproducible Example (MRE)

private static readonly MiniAudioDeviceConfig _deviceConfig = new MiniAudioDeviceConfig
{
    NoFixedSizedCallback = true,
    Wasapi = new WasapiSettings
    {
        Usage = WasapiUsage.ProAudio
    }
};
private static readonly AudioFormat _audioFormat = new AudioFormat
{
    Channels = 2,
    Format = SampleFormat.F32,
    SampleRate = 48000
};

private readonly MiniAudioEngine _audioEngine;

public void Play(string filepath)
{
      if (!File.Exists(filepath)) return;

      playbackDevice = _audioEngine.InitializePlaybackDevice(device._deviceInfo, _audioFormat, _deviceConfig);
      
      if (!playbackDevice.Capability.HasFlag(Capability.Playback))
      {
          playbackDevice.Dispose();
          return;
      }
      
      var player = new SurroundPlayer(_audioEngine, _audioFormat, new ChunkedDataProvider(_audioEngine, _audioFormat, filepath));
      player.SetSpeakerConfiguration(SurroundPlayer.SpeakerConfiguration.Stereo);
      
      playbackDevice.MasterMixer.AddComponent(player);
      playbackDevice.Start();

      player.Play();
      
      mySound.PlaybackSpeed = Random.Shared.NextSingle() * 2f;
}

6. Error Messages and Stack Trace (if applicable)

No error just bad audio quality

SoundFlow Version

1.2.1

.NET Version

.NET 9.0

Operating System

Windows 11

Architecture

x64

Audio Backend Used (if known)

WASAPI

Specific Audio Hardware (if relevant)

Logitech G733 Headset

8. Affected Components/Modules (if known)

SoundPlayer and SurroundPlayer

9. Impact

Incorrect audio output

10. Possible Workaround (if known)

11. Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlog-featureA new feature request that has been planned for future implementation; not yet started.bugSomething isn't working

    Projects

    Status

    Bugs

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions