IAHispano / Applio

A simple, high-quality voice conversion tool focused on ease of use and performance.
https://applio.org
MIT License
1.71k stars 276 forks source link

Formant Shifting suggestion #335

Closed SilvazeYakko closed 2 months ago

SilvazeYakko commented 7 months ago

I love the new Applio updates, but, I would like to have the formant shift section there for the interface. That way, I can convert male to female voices, along with the 50HZ to 11hz inference frequencies, just like from the previous version. I'm glad that the inferencing times are faster.

valoville commented 7 months ago

made an account just to second this!! i'm super happy about the new inferencing times + other updates as well. my only complaint is no formant shifting now

Subraiz commented 2 months ago

you really don't need Applio for this just use parselmouth

from parselmouth.praat import call

def shift_formant(audio_path: str, factor: float) -> str: """Shift audio formant and preserve pitch

Args:
    audio_path (str): path to file
    factor (float): factor of formant shift to apply

Returns:
    str: path of saved file
"""
shifted_audio_path = audio_path.replace(".wav", "_shifted.wav")

sound = parselmouth.Sound(audio_path)
shifted_sound = call(sound, "Change gender", 100, 500, factor, 0, 1, 1)

shifted_sound.save(shifted_audio_path, "WAV")

return shifted_audio_path