from telemeta.visualization.api import *
-#from telemeta.visualization.waveform import *
-#from telemeta.visualization.waveform2 import *
-from telemeta.visualization.waveform3 import *
-#from telemeta.visualization.spectrogram import *
-from telemeta.visualization.spectrogram2 import *
-from telemeta.visualization.spectrogram3 import *
-from telemeta.visualization.waveform4 import *
-from telemeta.visualization.spectrogram4 import *
\ No newline at end of file
+from telemeta.visualization.waveform_audiolab import *
+from telemeta.visualization.spectrogram_audiolab import *
+from telemeta.visualization.spectrogram_octave import *
' -scale x250 ' + self.pngFile.name)
# Stream
- while True :
+ while True:
buffer = self.pngFile.read(self.buffer_size)
if len(buffer) == 0:
break
--- /dev/null
+# Copyright (C) 2007 Samalyse SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Olivier Guilyardi <olivier@samalyse.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from telemeta.visualization.snack_core import SnackCoreVisualizer
+
+class SpectrogramVisualizer(SnackCoreVisualizer):
+ """Spectral view visualization driver"""
+
+ implements(IMediaItemVisualizer)
+
+ # possible alternative:
+ # http://jokosher.python-hosting.com/file/jokosher-extra/Waveform.py
+
+ def get_id(self):
+ return "spectrogram"
+
+ def get_name(self):
+ return "Spectrogram 1"
+
+ def set_colors(self, background=None, scheme=None):
+ pass
+
+ def render(self, media_item, options=None):
+ """Generator that streams the spectral view as a PNG image"""
+
+ canvas = self.get_snack_canvas()
+ snd = self.get_snack_sound(media_item)
+
+ canvas.create_spectrogram(0, 10, sound=snd, height=180, width=300 ,
+ windowtype="hamming", fftlength=1024, topfrequency=5000, channel="all", winlength=64)
+
+ stream = self.canvas_to_png_stream(canvas)
+
+ return stream
+
+
+
+
+
+
+
+
--- /dev/null
+# Copyright (C) 2008 Parisson SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from django.conf import settings
+from tempfile import NamedTemporaryFile
+from telemeta.visualization.wav2png import *
+
+class SpectrogramVisualizer3(Component):
+ """Spectrogram visualization driver (python style)"""
+
+ implements(IMediaItemVisualizer)
+
+ bg_color = None
+ color_scheme = None
+
+ def get_id(self):
+ return "spectrogram3"
+
+ def get_name(self):
+ return "Spectrogram (audiolab)"
+
+ def set_colors(self, background=None, scheme=None):
+ self.bg_color = background
+ self.color_scheme = scheme
+
+ def render(self, media_item, width=None, height=None, options=None):
+ """Generator that streams the spectrogram as a PNG image with a python method"""
+
+ wav_file = media_item.file.path
+ pngFile = NamedTemporaryFile(suffix='.png')
+
+ if not width == None:
+ image_width = width
+ else:
+ image_width = 305
+ if not height == None:
+ image_height = height
+ else:
+ image_height = 150
+
+ fft_size = 2048
+ args = (wav_file, pngFile.name, image_width, image_height, fft_size,
+ self.bg_color, self.color_scheme)
+ create_spectrogram_png(*args)
+
+ buffer = pngFile.read(0xFFFF)
+ while buffer:
+ yield buffer
+ buffer = pngFile.read(0xFFFF)
+
+ pngFile.close()
--- /dev/null
+# Copyright (C) 2007 Samalyse SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Olivier Guilyardi <olivier@samalyse.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from django.conf import settings
+from tempfile import NamedTemporaryFile
+import os
+import os.path
+
+class WaveFormVisualizer(Component):
+ """WaveForm visualization driver"""
+
+ implements(IMediaItemVisualizer)
+
+ # possible alternative:
+ # http://jokosher.python-hosting.com/file/jokosher-extra/Waveform.py
+
+ def get_id(self):
+ return "waveform_first"
+
+ def get_name(self):
+ return "Waveform (wav2png.c)"
+
+ def set_colors(self, background=None, scheme=None):
+ pass
+
+ def render(self, media_item, options=None):
+ """Generator that streams the waveform as a PNG image"""
+
+ pngFile = NamedTemporaryFile(suffix='.png')
+ wav2png = os.path.dirname(__file__) + '/wav2png/wav2png'
+ args = "-i " + media_item.file.path + " "
+ args += "-o " + pngFile.name + " "
+ args += "-b ffffff "
+ args += "-l 000088 "
+ args += "-z 990000 "
+ args += "-w 300 "
+ args += "-h 151 "
+
+ os.system(wav2png + " " + args)
+
+ buffer = pngFile.read(0xFFFF)
+ while buffer:
+ yield buffer
+ buffer = pngFile.read(0xFFFF)
+
+ pngFile.close()
+
--- /dev/null
+# Copyright (C) 2007 Samalyse SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Authors: Olivier Guilyardi <olivier@samalyse.com>
+# Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from telemeta.visualization.octave_core import OctaveCoreVisualizer
+
+class WaveformVisualizer2(OctaveCoreVisualizer):
+ """Octave temporal view visualization driver"""
+
+ implements(IMediaItemVisualizer)
+
+ def __init__(self):
+ self.set_m_file('waveform2img.m')
+ self.buffer_size = 0xFFFF
+ self.trans_type = 'png'
+
+ def get_id(self):
+ return "waveform_octave"
+
+ def get_name(self):
+ return "Waveform (octave)"
+
+ def set_colors(self, background=None, scheme=None):
+ pass
+
+ def render(self, media_item, options=None):
+ """Generator that streams the temporal view as a PNG image"""
+
+ stream = self.octave_to_png_stream(media_item)
+ for chunk in stream:
+ yield chunk
+
+
--- /dev/null
+# Copyright (C) 2008 Parisson SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from django.conf import settings
+from tempfile import NamedTemporaryFile
+from telemeta.visualization.wav2png import *
+
+class WaveFormVisualizer(Component):
+ """WaveForm visualization driver (python style)"""
+
+ implements(IMediaItemVisualizer)
+
+ bg_color = None
+ color_scheme = None
+
+ def get_id(self):
+ return "waveform4"
+
+ def get_name(self):
+ return "Waveform (audiolab large)"
+
+ def set_colors(self, background=None, scheme=None):
+ self.bg_color = background
+ self.color_scheme = scheme
+
+ def render(self, media_item, width=None, height=None, options=None):
+ """Generator that streams the waveform as a PNG image with a python method"""
+
+ wav_file = media_item.file.path
+ pngFile = NamedTemporaryFile(suffix='.png')
+
+ if not width == None:
+ image_width = width
+ else:
+ image_width = 1800
+ if not height == None:
+ image_height = height
+ else:
+ image_height = 300
+
+ fft_size = 2048
+ args = (wav_file, pngFile.name, image_width, image_height, fft_size, self.bg_color, self.color_scheme)
+ create_wavform_png(*args)
+
+ buffer = pngFile.read(0xFFFF)
+ while buffer:
+ yield buffer
+ buffer = pngFile.read(0xFFFF)
+
+ pngFile.close()
+
+++ /dev/null
-# Copyright (C) 2007 Samalyse SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Olivier Guilyardi <olivier@samalyse.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from telemeta.visualization.snack_core import SnackCoreVisualizer
-
-class SpectrogramVisualizer(SnackCoreVisualizer):
- """Spectral view visualization driver"""
-
- implements(IMediaItemVisualizer)
-
- # possible alternative:
- # http://jokosher.python-hosting.com/file/jokosher-extra/Waveform.py
-
- def get_id(self):
- return "spectrogram"
-
- def get_name(self):
- return "Spectrogram 1"
-
- def set_colors(self, background=None, scheme=None):
- pass
-
- def render(self, media_item, options=None):
- """Generator that streams the spectral view as a PNG image"""
-
- canvas = self.get_snack_canvas()
- snd = self.get_snack_sound(media_item)
-
- canvas.create_spectrogram(0, 10, sound=snd, height=180, width=300 ,
- windowtype="hamming", fftlength=1024, topfrequency=5000, channel="all", winlength=64)
-
- stream = self.canvas_to_png_stream(canvas)
-
- return stream
-
-
-
-
-
-
-
-
+++ /dev/null
-# Copyright (C) 2007 Samalyse SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Authors: Olivier Guilyardi <olivier@samalyse.com>
-# Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from telemeta.visualization.octave_core import OctaveCoreVisualizer
-
-class SpectrogramVisualizer2(OctaveCoreVisualizer):
- """Octave spectral view visualization driver"""
-
- implements(IMediaItemVisualizer)
-
- def __init__(self):
- self.set_m_file('spectrogram2img.m')
-
- def get_id(self):
- return "spectrogram2"
-
- def get_name(self):
- return "Spectrogram (octave)"
-
- def set_colors(self, background=None, scheme=None):
- pass
-
- def render(self, media_item, width=None, height=None, options=None):
- """Generator that streams the spectral view as a PNG image"""
-
- stream = self.octave_to_png_stream(media_item)
- return stream
-
+++ /dev/null
-# Copyright (C) 2008 Parisson SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from django.conf import settings
-from tempfile import NamedTemporaryFile
-from telemeta.visualization.wav2png import *
-
-class SpectrogramVisualizer3(Component):
- """Spectrogram visualization driver (python style)"""
-
- implements(IMediaItemVisualizer)
-
- bg_color = None
- color_scheme = None
-
- def get_id(self):
- return "spectrogram3"
-
- def get_name(self):
- return "Spectrogram (audiolab)"
-
- def set_colors(self, background=None, scheme=None):
- self.bg_color = background
- self.color_scheme = scheme
-
- def render(self, media_item, width=None, height=None, options=None):
- """Generator that streams the spectrogram as a PNG image with a python method"""
-
- wav_file = media_item.file.path
- pngFile = NamedTemporaryFile(suffix='.png')
-
- if not width == None:
- image_width = width
- else:
- image_width = 305
- if not height == None:
- image_height = height
- else:
- image_height = 150
-
- fft_size = 2048
- args = (wav_file, pngFile.name, image_width, image_height, fft_size,
- self.bg_color, self.color_scheme)
- create_spectrogram_png(*args)
-
- buffer = pngFile.read(0xFFFF)
- while buffer:
- yield buffer
- buffer = pngFile.read(0xFFFF)
-
- pngFile.close()
+++ /dev/null
-# Copyright (C) 2008 Parisson SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from django.conf import settings
-from tempfile import NamedTemporaryFile
-from telemeta.visualization.wav2png import *
-
-class SpectrogramVisualizer3(Component):
- """Spectrogram visualization driver (python style)"""
-
- implements(IMediaItemVisualizer)
-
- bg_color = None
- color_scheme = None
-
- def get_id(self):
- return "spectrogram4"
-
- def get_name(self):
- return "Spectrogram (audiolab large)"
-
- def set_colors(self, background=None, scheme=None):
- self.bg_color = background
- self.color_scheme = scheme
-
- def render(self, media_item, width=None, height=None, options=None):
- """Generator that streams the spectrogram as a PNG image with a python method"""
-
- wav_file = media_item.file.path
- pngFile = NamedTemporaryFile(suffix='.png')
-
- if not width == None:
- image_width = width
- else:
- image_width = 1800
- if not height == None:
- image_height = height
- else:
- image_height = 300
-
- fft_size = 2048
- args = (wav_file, pngFile.name, image_width, image_height, fft_size,
- self.bg_color, self.color_scheme)
- create_spectrogram_png(*args)
-
- buffer = pngFile.read(0xFFFF)
- while buffer:
- yield buffer
- buffer = pngFile.read(0xFFFF)
-
- pngFile.close()
--- /dev/null
+# Copyright (C) 2008 Parisson SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from django.conf import settings
+from tempfile import NamedTemporaryFile
+from telemeta.visualization.wav2png import *
+
+class SpectrogramVisualizerAudiolab(Component):
+ """Spectrogram visualization driver (python style thanks to wav2png.py and scikits.audiolab)"""
+
+ implements(IMediaItemVisualizer)
+
+ bg_color = None
+ color_scheme = None
+
+ def get_id(self):
+ return "spectrogram_audiolab"
+
+ def get_name(self):
+ return "Spectrogram (audiolab)"
+
+ def set_colors(self, background=None, scheme=None):
+ self.bg_color = background
+ self.color_scheme = scheme
+
+ def render(self, media_item, width=None, height=None, options=None):
+ """Generator that streams the spectrogram as a PNG image with a python method"""
+
+ wav_file = media_item.file.path
+ pngFile = NamedTemporaryFile(suffix='.png')
+
+ if not width == None:
+ image_width = width
+ else:
+ image_width = 1500
+ if not height == None:
+ image_height = height
+ else:
+ image_height = 200
+
+ fft_size = 2048
+ args = (wav_file, pngFile.name, image_width, image_height, fft_size,
+ self.bg_color, self.color_scheme)
+ create_spectrogram_png(*args)
+
+ buffer = pngFile.read(0xFFFF)
+ while buffer:
+ yield buffer
+ buffer = pngFile.read(0xFFFF)
+
+ pngFile.close()
--- /dev/null
+# Copyright (C) 2007 Samalyse SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Authors: Olivier Guilyardi <olivier@samalyse.com>
+# Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from telemeta.visualization.octave_core import OctaveCoreVisualizer
+
+class SpectrogramVisualizer2(OctaveCoreVisualizer):
+ """Octave spectral view visualization driver"""
+
+ implements(IMediaItemVisualizer)
+
+ def __init__(self):
+ self.set_m_file('spectrogram2img.m')
+
+ def get_id(self):
+ return "spectrogram_octave"
+
+ def get_name(self):
+ return "Spectrogram (octave)"
+
+ def set_colors(self, background=None, scheme=None):
+ pass
+
+ def render(self, media_item, width=None, height=None, options=None):
+ """Generator that streams the spectral view as a PNG image"""
+
+ stream = self.octave_to_png_stream(media_item)
+ for chunk in stream:
+ yield chunk
+
+++ /dev/null
-# Copyright (C) 2007 Samalyse SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Olivier Guilyardi <olivier@samalyse.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from django.conf import settings
-from tempfile import NamedTemporaryFile
-import os
-import os.path
-
-class WaveFormVisualizer(Component):
- """WaveForm visualization driver"""
-
- implements(IMediaItemVisualizer)
-
- # possible alternative:
- # http://jokosher.python-hosting.com/file/jokosher-extra/Waveform.py
-
- def get_id(self):
- return "waveform"
-
- def get_name(self):
- return "Waveform"
-
- def set_colors(self, background=None, scheme=None):
- pass
-
- def render(self, media_item, options=None):
- """Generator that streams the waveform as a PNG image"""
-
- pngFile = NamedTemporaryFile(suffix='.png')
- wav2png = os.path.dirname(__file__) + '/wav2png/wav2png'
- args = "-i " + media_item.file.path + " "
- args += "-o " + pngFile.name + " "
- args += "-b ffffff "
- args += "-l 000088 "
- args += "-z 990000 "
- args += "-w 300 "
- args += "-h 151 "
-
- os.system(wav2png + " " + args)
-
- buffer = pngFile.read(0xFFFF)
- while buffer:
- yield buffer
- buffer = pngFile.read(0xFFFF)
-
- pngFile.close()
-
+++ /dev/null
-# Copyright (C) 2007 Samalyse SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Authors: Olivier Guilyardi <olivier@samalyse.com>
-# Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from telemeta.visualization.octave_core import OctaveCoreVisualizer
-
-class WaveformVisualizer2(OctaveCoreVisualizer):
- """Octave temporal view visualization driver"""
-
- implements(IMediaItemVisualizer)
-
- def __init__(self):
- self.set_m_file('waveform2img.m')
- self.buffer_size = 0xFFFF
- self.trans_type = 'png'
-
- def get_id(self):
- return "waveform2"
-
- def get_name(self):
- return "Waveform (octave)"
-
- def set_colors(self, background=None, scheme=None):
- pass
-
- def render(self, media_item, options=None):
- """Generator that streams the temporal view as a PNG image"""
-
- stream = self.octave_to_png_stream(media_item)
- return stream
-
+++ /dev/null
-# Copyright (C) 2008 Parisson SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from django.conf import settings
-from tempfile import NamedTemporaryFile
-from telemeta.visualization.wav2png import *
-
-class WaveFormVisualizer(Component):
- """WaveForm visualization driver (python style)"""
-
- implements(IMediaItemVisualizer)
-
- bg_color = None
- color_scheme = None
-
- def get_id(self):
- return "waveform3"
-
- def get_name(self):
- return "Waveform (audiolab)"
-
- def set_colors(self, background=None, scheme=None):
- self.bg_color = background
- self.color_scheme = scheme
-
- def render(self, media_item, width=None, height=None, options=None):
- """Generator that streams the waveform as a PNG image with a python method"""
-
- wav_file = media_item.file.path
- pngFile = NamedTemporaryFile(suffix='.png')
-
- if not width == None:
- image_width = width
- else:
- image_width = 305
- if not height == None:
- image_height = height
- else:
- image_height = 150
-
- fft_size = 2048
- args = (wav_file, pngFile.name, image_width, image_height, fft_size,
- self.bg_color, self.color_scheme)
- create_wavform_png(*args)
-
- buffer = pngFile.read(0xFFFF)
- while buffer:
- yield buffer
- buffer = pngFile.read(0xFFFF)
-
- pngFile.close()
-
+++ /dev/null
-# Copyright (C) 2008 Parisson SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Guillaume Pellerin <pellerin@parisson.com>
-
-from telemeta.core import *
-from telemeta.visualization.api import IMediaItemVisualizer
-from django.conf import settings
-from tempfile import NamedTemporaryFile
-from telemeta.visualization.wav2png import *
-
-class WaveFormVisualizer(Component):
- """WaveForm visualization driver (python style)"""
-
- implements(IMediaItemVisualizer)
-
- bg_color = None
- color_scheme = None
-
- def get_id(self):
- return "waveform4"
-
- def get_name(self):
- return "Waveform (audiolab large)"
-
- def set_colors(self, background=None, scheme=None):
- self.bg_color = background
- self.color_scheme = scheme
-
- def render(self, media_item, width=None, height=None, options=None):
- """Generator that streams the waveform as a PNG image with a python method"""
-
- wav_file = media_item.file.path
- pngFile = NamedTemporaryFile(suffix='.png')
-
- if not width == None:
- image_width = width
- else:
- image_width = 1800
- if not height == None:
- image_height = height
- else:
- image_height = 300
-
- fft_size = 2048
- args = (wav_file, pngFile.name, image_width, image_height, fft_size, self.bg_color, self.color_scheme)
- create_wavform_png(*args)
-
- buffer = pngFile.read(0xFFFF)
- while buffer:
- yield buffer
- buffer = pngFile.read(0xFFFF)
-
- pngFile.close()
-
--- /dev/null
+# Copyright (C) 2008 Parisson SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Guillaume Pellerin <pellerin@parisson.com>
+
+from telemeta.core import *
+from telemeta.visualization.api import IMediaItemVisualizer
+from django.conf import settings
+from tempfile import NamedTemporaryFile
+from telemeta.visualization.wav2png import *
+
+class WaveFormVisualizer(Component):
+ """WaveForm visualization driver (python style thanks to wav2png.py and scikits.audiolab)"""
+
+ implements(IMediaItemVisualizer)
+
+ bg_color = None
+ color_scheme = None
+
+ def get_id(self):
+ return "waveform_audiolab"
+
+ def get_name(self):
+ return "Waveform (audiolab)"
+
+ def set_colors(self, background=None, scheme=None):
+ self.bg_color = background
+ self.color_scheme = scheme
+
+ def render(self, media_item, width=None, height=None, options=None):
+ """Generator that streams the waveform as a PNG image with a python method"""
+
+ wav_file = media_item.file.path
+ pngFile = NamedTemporaryFile(suffix='.png')
+
+ if not width == None:
+ image_width = width
+ else:
+ image_width = 1500
+ if not height == None:
+ image_height = height
+ else:
+ image_height = 200
+
+ fft_size = 2048
+ args = (wav_file, pngFile.name, image_width, image_height, fft_size,
+ self.bg_color, self.color_scheme)
+ create_wavform_png(*args)
+
+ buffer = pngFile.read(0xFFFF)
+ while buffer:
+ yield buffer
+ buffer = pngFile.read(0xFFFF)
+
+ pngFile.close()
+
if request.REQUEST.has_key('visualizer_id'):
visualizer_id = request.REQUEST['visualizer_id']
else:
- visualizer_id = 'waveform3'
+ visualizer_id = 'waveform_audiolab'
analyzers = []
for analyzer in self.analyzers: