Created
March 8, 2019 07:09
-
-
Save ylxdzsw/870480ddfac85e920231905a8691b6ea to your computer and use it in GitHub Desktop.
show noise level
This file contains 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
using Statistics | |
const p = run(pipeline(`arecord -f cd -t raw`, stdout=Pipe()), wait=false) | |
close(p.out.in) | |
while true | |
sleep(0.1) | |
x = reinterpret(Int16, readavailable(p.out)) | |
x = @. 20log(10, abs(max(x, typemin(Int16) + one(Int16))) / typemax(Int16)) | |
println(mean(x)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment