#! /bin/sh # Capture the audio player by any program on Linux. This creates a dump # of all the sounds sent to the audio card in raw format. # # Usage: alsacapture programname args... # # This will install sound capture, run the given program, and stop # capturing when the program finishes. Note that all sounds sent to # the sound card are captured, not just the ones produced by the given # program. DUMPFILE=/dev/shm/out.raw # The dump file is $DUMPFILE, which you can e.g. reencode in MP3 with # (assuming 2-channels 16-bit low-endian): # # ffmpeg -ac 2 -f s16le -i $DUMPFILE -acodec mp3 -ab 192k output.mp3 if [[ -e ~/.asoundrc ]] ; then echo "Move ~/.asoundrc out of the way..." exit 1 fi cat > ~/.asoundrc <