Created
June 17, 2019 10:29
-
-
Save deanturpin/31ccefe764c06dfff60e25299fcf4230 to your computer and use it in GitHub Desktop.
Extracting and plotting a WAV in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ $# == 1 ]] && count=$1 || count=750 | |
# Fetch some samples | |
nibbles=8 | |
readarray samples < <(xxd -cols $nibbles -plain -s 42 -len $(( nibbles * count ))) | |
# Loop through samples | |
i=0 | |
for s in ${samples[*]}; do | |
# Extract left channel only | |
s=${s:0:4} | |
# Shift so all values are positive | |
echo -e $i\\t$(( 16#$s + 16#ffff )) | |
(( ++i )) | |
done | graph -T png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment