Add mod_soundtouch: pitch-preserving tempo control for file playback#1
Merged
Add mod_soundtouch: pitch-preserving tempo control for file playback#1
Conversation
Co-authored-by: pinc444 <148037078+pinc444@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Integrate SoundTouch for pitch-preserving speed control
Add mod_soundtouch: pitch-preserving tempo control for file playback
Feb 20, 2026
pinc444
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FreeSWITCH's existing
speed:+Nplayback uses sample skipping, which shifts pitch (chipmunk effect). This integrates the SoundTouch library to provide TDHS-based tempo change without pitch shift.Core changes
src/include/switch_ivr.h— Declaresswitch_ivr_soundtouch_processglobal function pointer (SWITCH_DECLARE_DATA extern) so the dynamically-loaded module can register itself with the coresrc/switch_ivr_play_say.c— Defines and initializes the pointer toNULL; in the speed processing block, checksuse_soundtouchchannel variable and dispatches to SoundTouch if the module is loaded, otherwise falls through to the original sample-skip path (fully backward compatible)New module:
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp— C++ module followingmod_cvpatterns (SWITCH_BEGIN_EXTERN_Cfor module entry points). Manages per-sessionSoundTouchinstances viaswitch_channel_set_private, cleaned up on hangup via a channel state handler. Sets/clearsswitch_ivr_soundtouch_processon load/unload.Makefile.am— Conditional build guarded byHAVE_SOUNDTOUCH(requireslibsoundtouch-dev)Configuration
configure.ac—PKG_CHECK_MODULES([SOUNDTOUCH], [soundtouch >= 1.7.1])conf/vanilla/autoload_configs/soundtouch.conf.xml— Parsed on load; controlsdefault-enabled,min-tempo,max-tempoAPI commands
Dialplan usage
Speed values map to SoundTouch tempo:
tempo = 1.0 + (0.25 × speed), sospeed:+1→ 1.25×,speed:+2→ 1.50×, matching the existing factor used by the sample-skip path.Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.