Parcourir la source

add reference microphone argument to reference filter calculation, other small fixes

Fernando Pablo Lopez-Lezcano il y a 9 ans
Parent
commit
84690fcce7
1 fichiers modifiés avec 15 ajouts et 6 suppressions
  1. 15 6
      calibration/src/sphear_make_reference_filter

+ 15 - 6
calibration/src/sphear_make_reference_filter

@@ -27,8 +27,8 @@
 #
 DRC_BASE="../drc-3.2.1"
 
-# we use the full reference microphone recording as input
-REFERENCE="../data/current/ref-all/reference-001-1.wav"
+# we use the trimmed reference impulse response as input
+REFERENCE="../data/current/ref/reference-001-1.wav"
 
 # raw pcm output file base name
 OUTFILE="drc-filter"
@@ -37,18 +37,27 @@ OUTFILE="drc-filter"
 CAL_DIR="../data/current/cal"
 
 # configuration file (based on the "minimal" stock preset)
+# CONFIG="drc/erb_orig.drc"
 CONFIG="drc/minimal.drc"
 
+# see if we have a microphone calibration file
+if [ -n "$1" ] ; then
+    PSPOINTSFILE="--PSPointsFile drc/mics/$1/$1-cal.txt"
+    echo "  using drc/mics/$1/$1-cal.txt microphone calibration file"
+else
+    PSPOINTSFILE="--PSPointsFile drc/flat.txt"
+    echo "  using flat microphone calibration file"
+fi
+
 # normalize reference soundfile and convert to a format that DRC likes
 REFDRC=`echo ${REFERENCE}|sed "s|.wav|-norm.raw|"`
-sox --norm=-3 ${REFERENCE} ${REFDRC}
+sox --norm=-3 ${REFERENCE} -t f32 -c 1 ${REFDRC}
 
 ${DRC_BASE}/source/drc --BCInFile ${REFDRC} --PSOutFile ${CAL_DIR}/${OUTFILE}.pcm ${CONFIG} \
-	   --PSPointsFile drc/flat.txt \
-	   --MCPointsFile drc/mics/emm-6-5850/emm-6-5850-cal.txt
+	   --PSPointsFile drc/flat.txt $PSPOINTSFILE
 
 # convert the raw PCM output to a wav file that octave can understand
-sox -e floating-point -b 32 -r 48000 -c 1 -t raw ${CAL_DIR}/${OUTFILE}.pcm ${CAL_DIR}/${OUTFILE}.wav
+sox -e floating-point -t f32 -b 32 -r 48000 -c 1 -t raw ${CAL_DIR}/${OUTFILE}.pcm ${CAL_DIR}/${OUTFILE}.wav
 
 echo "filter written to ${CAL_DIR}/${OUTFILE}.wav"
 echo "done!"