Skip to content

Instantly share code, notes, and snippets.

@djosix
Created October 16, 2020 11:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djosix/d02436d8e9af951d3ac13132aef0ad05 to your computer and use it in GitHub Desktop.
Save djosix/d02436d8e9af951d3ac13132aef0ad05 to your computer and use it in GitHub Desktop.

Streaming with SOX

  • FILE audio file I/O
  • -d default audio device I/O
  • -p pipe: standard I/O

The simplest sox command format

sox INPUT_FILE OUTPUT_FILE

Play audio file

sox audio.mp3 -d

Record sound to file

sox -d record.mp3

Record and pipe to next sox command then save

sox -d -p | sox -p record.mp3

Stream local audio file and play on remote

sox audio.mp3 -p | ssh user@remote 'sox -p -d'

Stream remote file and play on local

ssh user@remote 'sox audio.mp3 -p' | sox -p -d

Stream local microphone to remote and play

sox -d -p | ssh user@remote 'sox -p -d'

Stream remote microphone to local and play

ssh user@remote 'sox -d -p' | sox -p -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment