Skip to content

Instantly share code, notes, and snippets.

@skratchdot
Created June 25, 2020 14:08
Show Gist options
  • Save skratchdot/40a5dfe15822aeedde2f0503e7a11ff1 to your computer and use it in GitHub Desktop.
Save skratchdot/40a5dfe15822aeedde2f0503e7a11ff1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# create 1 second 440Hz sine wave
sox -n -c 1 -r 44100 sine.wav synth 1 sine 440
# create 1 second of silence
sox -n -c 1 -r 44100 silence.wav trim 0 1
# create 1 second 440Hz sine wave followed by 1 second of silence
sox -V sine.wav silence.wav output.wav
# output times followed by amplitudes
sox output.wav output.dat
# create spectrogram
sox output.wav -n spectrogram -o output-spectrogram.png
# create waveform
ffmpeg -i output.wav -filter_complex showwavespic -frames:v 1 output-waveform.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment