]> git.alsa-project.org Git - alsa.git/commitdiff
Added -right option to fft1.py
authorJaroslav Kysela <perex@perex.cz>
Mon, 20 Aug 2012 12:54:42 +0000 (14:54 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 20 Aug 2012 12:54:42 +0000 (14:54 +0200)
audio-test/fft1.py

index 04578619d27e3b3d8eef7fe25fbc0770e81c2043..25e55c46dcf4eccc186b0563dbe6ba6bed7a8573 100755 (executable)
@@ -3,11 +3,11 @@
 # Depends on python-scipy and python-matplotlib
 #
 # This test analyzes the .wav file and uses FFT (Fast Fourier Transform)
-# to analyze the frequency range. Only left channel is analyzed. Samples
-# are normalized before FFT. Frequencies bellow 200Hz and above 6000Hz
-# are ommited. The utility compares the frequencies using 200Hz steps
-# with given or predefined FFT samples and the diff to the most-close FFT
-# sample is printed.
+# to analyze the frequency range. Only one channel is analyzed (use -right
+# option to select the second one). Samples  are normalized before FFT.
+# Frequencies bellow 200Hz and above 6000Hz are ommited. The utility
+# compares the frequencies using 200Hz steps with given or predefined
+# FFT samples and the diff to the most-close FFT sample is printed.
 #
 
 import sys
@@ -201,6 +201,7 @@ def fft_test(args):
   global FFT_SAMPLES
   graph = False
   values = False
+  channel = 0
   while 1:
     if args[0] == '-graph':
       del args[0]
@@ -210,6 +211,14 @@ def fft_test(args):
       del args[0]
       values = True
       continue
+    if args[0] == '-left':
+      del args[0]
+      channel = 0
+      continue
+    if args[0] == '-right':
+      del args[0]
+      channel = 1
+      continue
     if args[0] == '-clean':
       del args[0]
       a = FFT_SAMPLES['zero']
@@ -233,7 +242,7 @@ def fft_test(args):
 
   filename = args[0]
 
-  samplerate, data = read_wav(filename)
+  samplerate, data = read_wav(filename, channel)
 
   windowsize = len(data)
   lowfreq = 200