Created
October 9, 2024 13:05
-
-
Save xavriley/886a2afa1fe20a1d4f51f314d58d730f to your computer and use it in GitHub Desktop.
Autotune Audio with MAutoPitch using Python and Pedalboard
This file contains 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
import pedalboard | |
from pedalboard.io import AudioFile | |
# download and install MAutoPitch using https://www.meldaproduction.com/MFreeFxBundle | |
MAutoPitch = pedalboard.load_plugin( | |
"/Library/Audio/Plug-Ins/VST3/MeldaProduction/Pitch Shift/MAutoPitch.vst3" | |
) | |
MAutoPitch.depth_automatic_tuning = 100 # Only use tuned output | |
MAutoPitch.speed_automatic_tuning = 100 # Lock pitch immediately | |
MAutoPitch.keep_formants_effects = 0 # Don't try to correct formants | |
MAutoPitch.stabilization_detector = 0 # 0ms attack time | |
board = pedalboard.Pedalboard([MAutoPitch]) | |
# Open an audio file for reading, just like a regular file: | |
with AudioFile('vocadito_test.wav') as f: | |
# Open an audio file to write to: | |
with AudioFile('output.wav', 'w', f.samplerate, f.num_channels) as o: | |
# Read one second of audio at a time, until the file is empty: | |
while f.tell() < f.frames: | |
chunk = f.read(f.samplerate) | |
# Run the audio through our pedalboard: | |
effected = board(chunk, f.samplerate, reset=False) | |
# Write the output to our output file: | |
o.write(effected) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment