#!/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). file=$(date +%Y-%m-%d) && 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