self.filename = filename
self.color_scheme = color_scheme
+ if isinstance(color_scheme, dict):
+ colors = color_scheme['spectrogram']
+ else:
+ colors = default_color_schemes[color_scheme]['spectrogram']
+
self.image = Image.new("P", (self.image_height, self.image_width))
- colors = color_schemes[self.color_scheme]['spectrogram']
self.image.putpalette(interpolate_colors(colors, True))
self.samples_per_pixel = self.nframes / float(self.image_width)
from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
from timeside.api import IGrapher
-from timeside.grapher import *
+from timeside.grapher.core import *
class Spectrogram(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 = 1500
- if height:
- self.height = height
- else:
- self.height = 200
+ 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