Skip to content

Commit

Permalink
* kaiser window instead of exponent window;
Browse files Browse the repository at this point in the history
* scipy.wavio instead of wavio
  • Loading branch information
baranovmv committed Oct 10, 2018
1 parent cd79ba0 commit ba5c56f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
15 changes: 8 additions & 7 deletions measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import math
import subprocess
import wavio
import scipy.io.wavfile
import sys
import sounddevice as sd
from optparse import OptionParser
Expand All @@ -21,24 +22,24 @@ def Spectrum(s):
Ftest = scipy.fftpack.fft( s )
n = round(s.shape[0]/2)
xf = np.linspace(0.0, 44100/2.0, n)
return xf, 20*np.log10(np.abs(Ftest[0:n]))
return xf, 20*np.log10(np.abs(Ftest[0:n]))

#######################################################################################################################
if __name__ == "__main__":

parser = OptionParser()
parser.add_option( "-r", "--reuse", action="store",
parser.add_option( "-r", "--reuse", action="store",
type="string", dest="reuse_wav",
help="Use wav file with previous record instead actual playing and recording.")
parser.add_option( "-d", "--duration", action="store",
parser.add_option( "-d", "--duration", action="store",
type="float", dest="duration",
default=10,
help="Duration of probe impulse.")
parser.add_option( "-b", "--low-freq", action="store",
parser.add_option( "-b", "--low-freq", action="store",
type="float", dest="lowfreq",
default=100,
help="The lowest detected frequency [Hz].")
parser.add_option( "-e", "--high-freq", action="store",
parser.add_option( "-e", "--high-freq", action="store",
type="float", dest="highfreq",
default=15000,
help="The highest frequency in probe impulse [Hz].")
Expand All @@ -51,8 +52,8 @@ def Spectrum(s):
ir_file = options.reuse_wav
else:
# Store probe signal in wav file.
x = np.append(np.zeros(44100), estimator.probe_pulse)
wavio.write("test_sweep.wav", x, 44100, sampwidth=2)
x = np.append( np.zeros(44100), estimator.probe_pulse * 0.1 )
scipy.io.wavfile.write("test_sweep.wav", 44100, x)

# Play it and record microphones input simultaneously.
reccommand = \
Expand Down
Loading

0 comments on commit ba5c56f

Please sign in to comment.