changes to the debugging to allow our demonstration to work better
authorchrishoder <chrishoder@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 1 Mar 2013 18:51:26 +0000 (18:51 +0000)
committerchrishoder <chrishoder@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 1 Mar 2013 18:51:26 +0000 (18:51 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1556 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/FordExperiments.py

index d2775a7..4461acd 100644 (file)
@@ -896,9 +896,11 @@ class FordExperiments(experiments):
         
         
         numFramesToRead = music.getframerate()*.05 # grab .1s of audio
-                
+        sampNum = 0
+        avgprev = 0
+        avg = 0
         while(1):
-
+            avgprev = avg
             runningSum = 0
             
             sample = music.readframes(int(numFramesToRead)) # grab .1s of audio
@@ -909,10 +911,11 @@ class FordExperiments(experiments):
                 runningSum += ord(sample[i])   #average the dual-channel
                 runningSum += ord(sample[i+2])
             
-             avg = math.fabs(runningSum/(length /2) -127)       # we used 2 of every 4 frames, so divide length by 2
-             if( sampNum > 0):
+            avg = math.fabs(runningSum/(length /2) -127)       # we used 2 of every 4 frames, so divide length by 2
+            if( sampNum > 0):
                  avg = (avg+avgprev)/2
-                 
+            sampNum = 1
+
             val = int(avg*15 + 40)                     # normalize to speedometer range of values
             
             print "speedometerVal = %f " %val;