Edited at

シェルでFFTする

とりあえずメモ書きだけしておく。

ffmpeg -t 1 -f avfoundation -i ":0" -f flac - | sox - -n stat -freq 2> fft.txt

time (cat fft.txt | awk 'BEGIN{sum=0} {sum += $2} END{print sum}')

time (cat fft.txt | awk 'BEGIN{sum=0} {if(NR % 2048 == 0){print sum/2048; sum = 0} else{sum += $2}}')

ffmpeg -f avfoundation -i ":0" -f flac - 2>/dev/null | sox - -n stat -freq 2>&1 | awk 'BEGIN{sum=0} {if(NR % 2048 == 0){print sum/2048; sum = 0} else{sum += $2}}'

参考: https://qiita.com/ina111/items/6d9e9dcea275213cb431