]> git.parisson.com Git - telemeta.git/commitdiff
rename and reorganize visualizers
authoryomguy <>
Wed, 31 Dec 2008 17:01:27 +0000 (17:01 +0000)
committeryomguy <>
Wed, 31 Dec 2008 17:01:27 +0000 (17:01 +0000)
19 files changed:
telemeta/visualization/__init__.py
telemeta/visualization/octave_core.py
telemeta/visualization/old/spectrogram.py [new file with mode: 0644]
telemeta/visualization/old/spectrogram3.py [new file with mode: 0644]
telemeta/visualization/old/waveform.py [new file with mode: 0644]
telemeta/visualization/old/waveform2.py [new file with mode: 0644]
telemeta/visualization/old/waveform4.py [new file with mode: 0644]
telemeta/visualization/spectrogram.py [deleted file]
telemeta/visualization/spectrogram2.py [deleted file]
telemeta/visualization/spectrogram3.py [deleted file]
telemeta/visualization/spectrogram4.py [deleted file]
telemeta/visualization/spectrogram_audiolab.py [new file with mode: 0644]
telemeta/visualization/spectrogram_octave.py [new file with mode: 0644]
telemeta/visualization/waveform.py [deleted file]
telemeta/visualization/waveform2.py [deleted file]
telemeta/visualization/waveform3.py [deleted file]
telemeta/visualization/waveform4.py [deleted file]
telemeta/visualization/waveform_audiolab.py [new file with mode: 0644]
telemeta/web/base.py

index 06d036b3558e4e3da9af33504892a70f95cd8fda..7b46c19a77aa4c6996d0ee12b57cbec8be2320c1 100644 (file)
@@ -1,9 +1,4 @@
 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 *
index 9109d43d3152821b11ed7a31efe3052529cb9ea0..13fc15e649511aa243b842ad400626adf1638c5e 100644 (file)
@@ -60,7 +60,7 @@ class OctaveCoreVisualizer(Component):
                   ' -scale x250 ' + self.pngFile.name)
         
         # Stream
-        while True  :
+        while True:
             buffer = self.pngFile.read(self.buffer_size)
             if len(buffer) == 0:
                 break
diff --git a/telemeta/visualization/old/spectrogram.py b/telemeta/visualization/old/spectrogram.py
new file mode 100644 (file)
index 0000000..f4f0bfc
--- /dev/null
@@ -0,0 +1,50 @@
+# 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
+        
+
+
+
+
+        
+
+            
diff --git a/telemeta/visualization/old/spectrogram3.py b/telemeta/visualization/old/spectrogram3.py
new file mode 100644 (file)
index 0000000..f970e47
--- /dev/null
@@ -0,0 +1,59 @@
+# 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()
diff --git a/telemeta/visualization/old/waveform.py b/telemeta/visualization/old/waveform.py
new file mode 100644 (file)
index 0000000..c645c5e
--- /dev/null
@@ -0,0 +1,55 @@
+# 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()            
+
diff --git a/telemeta/visualization/old/waveform2.py b/telemeta/visualization/old/waveform2.py
new file mode 100644 (file)
index 0000000..83a67aa
--- /dev/null
@@ -0,0 +1,41 @@
+# 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
+            
+        
diff --git a/telemeta/visualization/old/waveform4.py b/telemeta/visualization/old/waveform4.py
new file mode 100644 (file)
index 0000000..93d9b57
--- /dev/null
@@ -0,0 +1,59 @@
+# 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()
+
diff --git a/telemeta/visualization/spectrogram.py b/telemeta/visualization/spectrogram.py
deleted file mode 100644 (file)
index f4f0bfc..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# 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
-        
-
-
-
-
-        
-
-            
diff --git a/telemeta/visualization/spectrogram2.py b/telemeta/visualization/spectrogram2.py
deleted file mode 100644 (file)
index d4c41e9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
-        
diff --git a/telemeta/visualization/spectrogram3.py b/telemeta/visualization/spectrogram3.py
deleted file mode 100644 (file)
index f970e47..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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()
diff --git a/telemeta/visualization/spectrogram4.py b/telemeta/visualization/spectrogram4.py
deleted file mode 100644 (file)
index 87e6874..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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()
diff --git a/telemeta/visualization/spectrogram_audiolab.py b/telemeta/visualization/spectrogram_audiolab.py
new file mode 100644 (file)
index 0000000..c86106d
--- /dev/null
@@ -0,0 +1,59 @@
+# 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()
diff --git a/telemeta/visualization/spectrogram_octave.py b/telemeta/visualization/spectrogram_octave.py
new file mode 100644 (file)
index 0000000..b130e01
--- /dev/null
@@ -0,0 +1,38 @@
+# 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
+
diff --git a/telemeta/visualization/waveform.py b/telemeta/visualization/waveform.py
deleted file mode 100644 (file)
index 5868c23..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# 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()            
-
diff --git a/telemeta/visualization/waveform2.py b/telemeta/visualization/waveform2.py
deleted file mode 100644 (file)
index 5c4ff9a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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
-        
diff --git a/telemeta/visualization/waveform3.py b/telemeta/visualization/waveform3.py
deleted file mode 100644 (file)
index f6a111e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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()
-
diff --git a/telemeta/visualization/waveform4.py b/telemeta/visualization/waveform4.py
deleted file mode 100644 (file)
index 93d9b57..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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()
-
diff --git a/telemeta/visualization/waveform_audiolab.py b/telemeta/visualization/waveform_audiolab.py
new file mode 100644 (file)
index 0000000..9132002
--- /dev/null
@@ -0,0 +1,60 @@
+# 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()
+
index 9aa2604fffa3d4e027833047ead18298ffafe296..bfbeb92a3e3fe1e12ab1997c7b79c9ec0366403c 100644 (file)
@@ -57,7 +57,7 @@ class WebView(Component):
         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: