r/PowerShell • u/StartAutomating • 1h ago
Script Sharing Remixing Music with RoughDraft and PowerShell
This weekend I figured out how to remix music with PowerShell, RoughDraft, and ffmpeg.
Sample + Filter.
Rinse & Repeat.
RoughDraft + ffmpeg makes this all pretty easy.
Step 1 - Get Your Sample Source
RoughDraft includes an extension for yt-dlp. This can download media from almost anywhere. Just browse to a site with a song, set a $SongUrl variable, and download
Get-Media -MediaUrl $MediaUrl
Step 2 - Sample a Section
You can sample a section of audio or video with the -AudioTrim and -Trim filters. If we want the first few seconds of a song, we can use the AudioTrim filter, like so:
$sample = Edit-Media $song -AudioTrim -TrimStart "00:00:00" -TrimEnd "00:00:05"
Step 3 - Filter
ffmpeg is full of filters. There are hundreds of them, and RoughDraft supports a fair number.
Suppose we want to make our sample Vibrato. We can just use Edit-Media -Vibrato
$sample | Edit-Media -Vibrato
Or we could change the -PitchFactor, making it sound slower or faster while keeping the tempo intact.
$sample | Edit-Media -PitchFactor 0.81
Or we could use an Audio Compressor, with a short attack and release and a makeup to make the sounds louder
$sample | Edit-Media -Compressor -CompressorAttack 5 -CompressorRelease 10 -CompressorMakeup 2.5
Rinse and Repeat
The possibilities are endless. ffmpeg is an audio/video production tool of truly unparalleled capability.
All of that power is in your shell, in a format that's far easier to read and understand than direct filtergraph syntax. Edit-Media currently has a whopping 682 parameters to mix and match, all supporting tab completion.
This makes it easy to iterate and innovate. It took just about an hour after figuring this out to make my first little remix, just by sampling/filtering/rinsing/repeating.
The latest RoughDraft release includes a bunch of new audio filters to help assist and more will keep on coming with every release.
Hope this helps & Have Fun!