Last active
March 14, 2020 11:13
-
-
Save peterkappus/c1b8dfc621077c42019d21cf6f9ab624 to your computer and use it in GitHub Desktop.
Bash script for recording audio with Sox on my mac
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
#!/bin/bash | |
# For recording flac & mp3 files (with compression and silence trimming) | |
# Prerequisite: sox | |
#`brew install sox --with-lame --with-flac --with-libvorbis` | |
# For recording flac & mp3 files. | |
# Grab your laptop | |
# Plug in your USB sound device | |
# Check sound settings that you're using your USB input | |
# open a terminal | |
# First time only: | |
# chmod +x recod.bash | |
# Run the following: | |
# ./rec.bash | |
# Play some music... | |
# After 5 seconds of silence, it automatically stops. | |
# You should have a slightly compressed MP3 and a FLAC file, with silence trimmed, and named after the current date (YYYY-MM-DD). | |
# Using ISO 8601 date-time format https://en.wikipedia.org/wiki/ISO_8601 and adding timezone (%Z) | |
file=$(date +%Y-%m-%dT%H%M%S%Z) && rec $file.flac silence 1 0:01 0.00599% 1 0:03 0.00599% norm compand 0.3,1 -5,-5 && sox $file.flac $file.mp3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment