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

Option to use speech-optimized tempo effect in from time_stretch() #89

Open
wants to merge 2 commits into
base: ps/pinwavesurfer
Choose a base branch
from

Conversation

babua
Copy link

@babua babua commented Jul 12, 2023

The SoX tempo effect has additional flags -s and -m which optimize WSOLA parameters for speech and music, respectively.

In my testing, I found that using the time_stretch() without the -s flag, there are significant artifacts in the audio, already at 0.7 or 1.3 factors, which are not too extreme, in my opinion. Simply adding the -s flag makes the output much more smoother.

As AudioTools is speech-oriented, I think it would be a sane default for many users to use this flag in time_stretch().

Sample below with original, before, after, code was:

def stretch(wav)
    a = AudioSignal(wav,sample_rate=24000)
    return a.clone().time_stretch(speed,quick=False).audio_data

0.5_0.7_stretch_samples.zip

@pseeth
Copy link
Contributor

pseeth commented Jul 16, 2023

Looks like a good change. Do you mind editing the base branch of this PR to point to the one in this PR: #90, so I can merge it in with the next version, and updating the relevant test to cover the change? The test is here: https://github.com/descriptinc/audiotools/blob/master/tests/core/test_effects.py#L170-L181

@babua babua changed the base branch from master to ps/pinwavesurfer July 21, 2023 01:14
@babua
Copy link
Author

babua commented Oct 6, 2023

btw, it's been a while but in case it escaped your attention, I'd added the requested changes. if not, no need to reply! :)

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

Successfully merging this pull request may close these issues.

2 participants