Skip to content
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

feat: Add widening effect support for stereo output #56

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mrorigo
Copy link
Contributor

@mrorigo mrorigo commented Feb 9, 2025

feat: Add stereo phase shift support for audio output

  • Introduced a new CLI option --stereo-phase-shift to apply a phase shift to stereo audio, allowing values between -1.0 and 1.0.
  • Implemented apply_phase_shift function using an all-pass filter to modify the phase response of audio without significant amplitude alteration.
  • Updated TTSOpts to include a stereo_phase_shift parameter.
  • Adjusted audio generation logic to apply the phase shift for stereo outputs, ensuring compatibility with mono and stereo modes.
  • Added warnings for invalid phase shift values or conflicting mono mode usage, providing clipping behavior when necessary.

This update enables a stereo widening effect through phase-shifted audio in the right channel when in stereo mode.

- Introduced a new CLI option `--stereo-phase-shift` to apply a phase shift to stereo audio, allowing values between -1.0 and 1.0.
- Implemented `apply_phase_shift` function using an all-pass filter to modify the phase response of audio without significant amplitude alteration.
- Updated `TTSOpts` to include a `stereo_phase_shift` parameter.
- Adjusted audio generation logic to apply the phase shift for stereo outputs, ensuring compatibility with mono and stereo modes.
- Added warnings for invalid phase shift values or conflicting mono mode usage, providing clipping behavior when necessary.

This update enables a stereo widening effect through phase-shifted audio in the right channel when in stereo mode.
Updated the conditional check for `stereo_phase_shift` to account for both positive and negative values by replacing `> 0.0` with `!= 0.0`. This ensures phase shifts are correctly applied regardless of direction.
@lucasjinreal
Copy link
Owner

Hi, would this make output audio sounds weired on PCs? they maybe not support spatial stereo effect actually like iOS devices does.

@mrorigo
Copy link
Contributor Author

mrorigo commented Feb 10, 2025

I am no audio expert, but the widening effect made the headphone listening experience better imho..

@lucasjinreal
Copy link
Owner

looks there is some conflict as new features comes in, would like resolve it before merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants