Ian George avatar Ian George committed 6937574

Renamed siganal, sounds strange.

Comments (0)

Files changed (2)

siganal/main.py

- #! /usr/bin/env python
-#display
-from __future__ import division
-import pygame
-import random
-from pygame.time import get_ticks
-
-#analysis
-from scikits import audiolab
-import scipy
-  
- # Window dimensions
-screen_width = 600
-screen_height = 600
-line_colour = 100,100,100
-
-screen = pygame.display.set_mode((screen_width, screen_height))
-clock = pygame.time.Clock()
-zoom_factor = 10
-
-class SignalVis(object):
-    def __init__(self, filename, frame_interval, points):
-        """
-        filename - pretty obvious :) currently only working with wavs
-        frame_interval - frame size for analysis in ms
-        """
-        self.data, self.fs, self.encoding = audiolab.wavread(filename)
-        self.frame_bits = int(frame_interval/1000 * self.fs)
-        self.points = points
-        self.interval = int(round(self.frame_bits /self.points))
-
-    def next(self):
-        while len(self.data) > 0:
-            X = scipy.fft(self.data[:self.frame_bits])
-            Xdb = 20*scipy.log10(scipy.absolute(X))
-            self.data = self.data[self.frame_bits:]
-            yield [int(x) for i, x in enumerate(Xdb) if (i % self.interval == 0)]
-
-def get_time_since(ticks):
-    return get_ticks() - ticks
-
-running = True
-interval = 10
-vis = SignalVis('louis.wav', interval, screen_width)
-pygame.mixer.init()
-pygame.mixer.music.load('postal.wav')
-local_time = get_ticks()
-pygame.mixer.music.play()
-
-for line_data in vis.next():
-    #blank screen
-    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)
-    
-    while get_time_since(local_time) < interval:
-        pass
-    local_time = get_ticks()
-    pygame.display.flip()
-    
-
+ #! /usr/bin/env python
+#display
+from __future__ import division
+import pygame
+import random
+from pygame.time import get_ticks
+
+#analysis
+from scikits import audiolab
+import scipy
+  
+ # Window dimensions
+screen_width = 600
+screen_height = 600
+line_colour = 100,100,100
+
+screen = pygame.display.set_mode((screen_width, screen_height))
+clock = pygame.time.Clock()
+zoom_factor = 10
+
+class SignalVis(object):
+    def __init__(self, filename, frame_interval, points):
+        """
+        filename - pretty obvious :) currently only working with wavs
+        frame_interval - frame size for analysis in ms
+        """
+        self.data, self.fs, self.encoding = audiolab.wavread(filename)
+        self.frame_bits = int(frame_interval/1000 * self.fs)
+        self.points = points
+        self.interval = int(round(self.frame_bits /self.points))
+
+    def next(self):
+        while len(self.data) > 0:
+            X = scipy.fft(self.data[:self.frame_bits])
+            Xdb = 20*scipy.log10(scipy.absolute(X))
+            self.data = self.data[self.frame_bits:]
+            yield [int(x) for i, x in enumerate(Xdb) if (i % self.interval == 0)]
+
+def get_time_since(ticks):
+    return get_ticks() - ticks
+
+running = True
+interval = 10
+vis = SignalVis('louis.wav', interval, screen_width)
+pygame.mixer.init()
+pygame.mixer.music.load('postal.wav')
+local_time = get_ticks()
+pygame.mixer.music.play()
+
+for line_data in vis.next():
+    #blank screen
+    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)
+    
+    while get_time_since(local_time) < interval:
+        pass
+    local_time = get_ticks()
+    pygame.display.flip()
+    
+
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.