]> git.parisson.com Git - timeside.git/commitdiff
fix grapher core defaults
authoryomguy <yomguy@parisson.com>
Fri, 18 Jun 2010 22:10:49 +0000 (22:10 +0000)
committeryomguy <yomguy@parisson.com>
Fri, 18 Jun 2010 22:10:49 +0000 (22:10 +0000)
INSTALL
timeside/grapher/core.py
timeside/grapher/waveform.py

diff --git a/INSTALL b/INSTALL
index 9b57714c00f6199ded06716f782162ee15f923f7..c622564d9ff72bd361556bdbcb003844301d1903 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,7 @@ For example, a normalization and a waveform, from a python shell::
 >>> grapher  =  timeside.grapher.Waveform('image.png')
 >>> encoder  =  timeside.encoder.WavEncoder('normalized.wav')
 >>> (decoder | grapher | encoder).run()
+>>> grapher.render()
 
 
 See the website for more examples and information about the TimeSide API:
index 21b8fe1332c61e22022c4c2f0f3085b0731f09fb..4eb518bf916abfa1e163298bbeae70d07fe24cc9 100644 (file)
@@ -131,7 +131,7 @@ class WaveformImage(object):
     Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.
     Peaks are colored relative to the spectral centroids of each frame packet. """
 
-    def __init__(self, image_width, image_height, nframes, samplerate, fft_size, bg_color=(0,0,0), color_scheme=None, filename=None):
+    def __init__(self, image_width, image_height, nframes, samplerate, fft_size, bg_color, color_scheme, filename=None):
         self.image_width = image_width
         self.image_height = image_height
         self.nframes = nframes
@@ -143,10 +143,8 @@ class WaveformImage(object):
 
         if isinstance(color_scheme, dict):
             colors = color_scheme['waveform']
-        elif color_scheme:
-            colors = default_color_schemes[self.color_scheme]['waveform']
         else:
-            colors = default_color_schemes['default']['waveform']
+            colors = default_color_schemes[color_scheme]['waveform']
 
         self.color_lookup = interpolate_colors(colors)
 
index fb7016eaac8205103b77e2933f5a1cb7b94d5782..0f78054a356dd2e116137e2dc4be25b9db039195 100644 (file)
@@ -21,7 +21,7 @@
 
 from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
 from timeside.api import IGrapher
-from timeside.grapher import *
+from timeside.grapher.core import *
 
 
 class Waveform(Processor):
@@ -30,15 +30,9 @@ class Waveform(Processor):
     FFT_SIZE = 0x400
 
     @interfacedoc
-    def __init__(self, width=None, height=None, output=None, bg_color=None, color_scheme=None):
-        if width:
-            self.width = width
-        else:
-            self.width = 1024
-        if height:
-            self.height = height
-        else:
-            self.height = 256
+    def __init__(self, width=1024, height=256, output=None, bg_color=(0,0,0), color_scheme='default'):
+        self.width = width
+        self.height = height
         self.bg_color = bg_color
         self.color_scheme = color_scheme
         self.filename = output