feat: add audio effects (pitch and speed control)

- Added new audio_effects.py module with pitch shift and speed change
- Pitch range: -12 to +12 semitones (higher = chipmunk, lower = deeper)
- Speed range: 0.5 to 2.0x (higher = faster, lower = slower)
- Maximum 2 active effects per user (performance optimization)
- Added /effects command group:
  - /effects list - Shows current effects with descriptions
  - /effects set pitch|speed <value> - Apply effects
  - /effects reset - Confirmation UI to clear all effects
- Effects persist across restarts in preferences.json
- Updated /voice preview to support optional pitch/speed parameters
- Effects applied in _generate_wav_bytes using librosa
- Added performance warnings when processing takes >1 second
- Updated README with effects documentation
This commit is contained in:
2026-01-31 15:43:29 -06:00
parent 4a2d72517f
commit 9f14e8c745
4 changed files with 527 additions and 29 deletions

View File

@@ -13,6 +13,8 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
- 🔄 **Hot-reload Voices**: Add new voices without restarting the bot using `/voice refresh`
- 🧪 **Test Mode**: Separate testing configuration for safe development
- 📦 **Auto-updates**: Automatically checks for and installs dependency updates on startup
- 👂 **Voice Preview**: Preview voices with `/voice preview` before committing to them
- 🎵 **Audio Effects**: Apply pitch shift and speed changes to your TTS voice
## Prerequisites
@@ -126,6 +128,28 @@ This loads `.env.testing` instead of `.env`, allowing you to:
Create `.env.testing` by copying `.env.example` and configuring it with your testing values.
### Audio Effects
Apply pitch shift and speed changes to your TTS voice:
- `/effects list` - Show your current effect settings
- `/effects set pitch <semitones>` - Change pitch (-12 to +12)
- Positive = higher/chipmunk voice
- Negative = lower/deeper voice
- 0 = normal pitch (default)
- `/effects set speed <multiplier>` - Change speed (0.5 to 2.0)
- Higher = faster speech
- Lower = slower speech
- 1.0 = normal speed (default)
- `/effects reset` - Reset all effects to defaults
**Note**: You can use up to 2 effects simultaneously. More effects require more processing time.
### Preview with Effects
Test voice and effect combinations before committing:
- `/voice preview <name> [pitch] [speed]` - Preview a voice with optional effect overrides
## How It Works
```