Skip to content

Instantly share code, notes, and snippets.

@peterkappus
Last active March 14, 2020 11:13
Show Gist options
  • Select an option

  • Save peterkappus/c1b8dfc621077c42019d21cf6f9ab624 to your computer and use it in GitHub Desktop.

Select an option

Save peterkappus/c1b8dfc621077c42019d21cf6f9ab624 to your computer and use it in GitHub Desktop.

Revisions

  1. peterkappus revised this gist Mar 14, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion rec.bash
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,6 @@

    # 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:%H:%M:%S) && 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
    # 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

  2. peterkappus revised this gist Mar 6, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rec.bash
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,4 @@

    # 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
    file=$(date +%Y-%m-%d:%H:%M:%S) && 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
  3. peterkappus created this gist Jan 8, 2020.
    22 changes: 22 additions & 0 deletions rec.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/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