Commits

Ian George committed e2a3eb3

A bit of tidying up but nothing really achieved.

Comments (0)

Files changed (1)

 
 #analysis
 from scikits import audiolab
-import scipy
+from scipy import fftpack, absolute, log10
   
  # Window dimensions
-screen_width = 600
+screen_width = 1200
 screen_height = 600
-line_colour = 100,100,100
+line_colour = 255,255,255
+audio_file = 'pinetop.wav'
 
 screen = pygame.display.set_mode((screen_width, screen_height))
 clock = pygame.time.Clock()
 
     def next(self):
         while len(self.data) > 0:
-            X = scipy.fft(self.data[:self.frame_bits])
-            Xdb = 20*scipy.log10(scipy.absolute(X))
+            X = fftpack.fft(self.data[:self.frame_bits])
+            Xdb = 20*log10(absolute(X))
             self.data = self.data[self.frame_bits:]
             yield [int(x) for i, x in enumerate(Xdb) if (i % self.interval == 0)]
 
     return get_ticks() - ticks
 
 running = True
-interval = 10
-vis = SignalVis('louis.wav', interval, screen_width)
+interval = 100
+vis = SignalVis(audio_file, interval, screen_width)
 pygame.mixer.init()
-pygame.mixer.music.load('postal.wav')
+pygame.mixer.music.load(audio_file)
 local_time = get_ticks()
 pygame.mixer.music.play()
 
     screen.fill((0,0,0))
 
     for x in xrange(len(line_data)):
-        screen.set_at((x, screen_height-(300 + int(round(line_data[x]*2)))), line_colour)
+        screen.set_at((x, screen_height-(300 - int(round(line_data[x]*2)))), line_colour)
     
     while get_time_since(local_time) < interval:
         pass
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.