Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if .wav is silent or not
#3
Function Function3
Code:
Copy      Help
str s1.getfile("C:\noise.wav")
str s2.getfile("C:\silence.wav")

outb s1 100
outb s2 100

Noise file outputs this:
Code:
Copy      Help
52 49 46 46 C4 EA 1A 00 57 41 56 45 66 6D 74 20 10 00 00 00 01 00 02 00 44 AC 00 00 10 B1 02 00 04 00 10 00 64 61 74 61 A0 EA 1A 00 C9 07 75 06 FB FE CB FA 5E 04 45 FB 33 09 44 09 EA 00 C6 05 95 05 8B F1 BB 0B E0 F1 A1 05 57 FF A5 06 6B F3 F1 02 C8 12 29 07 A2 07 9A 01 88 0E 89 FC 74 13 16 06 97 05

Silent file outputs this:
Code:
Copy      Help
52 49 46 46 C4 EA 1A 00 57 41 56 45 66 6D 74 20 10 00 00 00 01 00 02 00 44 AC 00 00 10 B1 02 00 04 00 10 00 64 61 74 61 A0 EA 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

I'm not quite sure how to load the hex into a variable and analyze with qm, but silent is all zeros where noise has values assigned.  The forum won't let me upload the .wav files I used.

The other way you could do it is by using SoX http://sox.sourceforge.net/

Function Function2
Code:
Copy      Help
RunConsole2("C:\Program Files\sox\sox.exe C:\silence.wav -n stat" str'sout)
out sout

RunConsole2("C:\Program Files\sox\sox.exe C:\noise.wav -n stat" sout)
out sout


str pattern="Mean\s*amplitude:\s*(.*)"
str MeanAmp
findrx(sout pattern 0 0 MeanAmp 1)
out MeanAmp
if val(MeanAmp 2)
,out "NOT SILENT"


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)