]> git.parisson.com Git - telemeta.git/commitdiff
* Add wav2png.py and dependencies
authoryomguy <>
Tue, 19 Aug 2008 15:13:21 +0000 (15:13 +0000)
committeryomguy <>
Tue, 19 Aug 2008 15:13:21 +0000 (15:13 +0000)
* Add waveform3 and spectrogram3 (python style)

INSTALL
VERSION [new file with mode: 0644]
debian/control
telemeta/visualization/__init__.py
telemeta/visualization/octave_core.py
telemeta/visualization/spectrogram3.py [new file with mode: 0644]
telemeta/visualization/waveform3.py [new file with mode: 0644]

diff --git a/INSTALL b/INSTALL
index 836bc60d4fd7ee787c1c9628e09204e7451742b8..77d13511d9c391d16b08efac8c34610dbb750348 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -18,7 +18,7 @@ lame, ecasound, par2
 
 2.0. Install Telemeta:
 
-* On debian or Ubuntu just add these lines to your /etc/apt/sources-list:
+* On Debian or Ubuntu just add these lines to your /etc/apt/sources-list:
 
     deb http://debian.parisson.org/ binary/
     deb-src http://debian.parisson.org/ source/
@@ -42,7 +42,7 @@ lame, ecasound, par2
     
     $ cd $DIR/telemeta/visualization/wav2png/
     
-    where $DIR is the directory where telemeta has been installed (e.g. /usr/lib/python2.5/site-packages/)
+    where $DIR is the directory where telemeta  installed (e.g. /usr/lib/python2.5/site-packages/)
 
     $ make
     
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..9e11b32
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.3.1
index f7cede481b247aa3cb997f5aaca4568fe79f7ebd..4e575a640e08aff45431a4e88c26b72ffa57a2ec 100644 (file)
@@ -8,7 +8,7 @@ Standards-Version: 3.7.3
 
 Package: telemeta
 Architecture: any
-Depends: ${python:Depends}, python-xml, python-mutagen, python-django (>= 0.96.2), sox, vorbis-tools, flac, normalize-audio, python-mysqldb, mysql-server, octave2.9, octave2.9-forge, python-tk, libgd2-xpm, libsndfile1
+Depends: ${python:Depends}, python-xml, python-mutagen, python-django (>= 0.96.2), sox, vorbis-tools, flac, normalize-audio, python-mysqldb, mysql-server, octave2.9, python-tk, libgd2-xpm, libsndfile1
 Recommends: lame
 Suggests: ecasound, festival, par2
 Description: web frontend to backup, transcode and tag any audio content with metadata
index 4fe60935c75750b466579e968b8fe0887851ec88..e3f7bbc329522f0b25f709df75d4ebaef7dccf45 100644 (file)
@@ -1,5 +1,7 @@
 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.waveform2 import *
\ No newline at end of file
+from telemeta.visualization.spectrogram3 import *
\ No newline at end of file
index 5b514f303ab283e34aaaf0662b4fa41ba51c5528..c8da9edfb548d5418fff40f852ff5af9639c984a 100644 (file)
@@ -37,7 +37,7 @@ class OctaveCoreVisualizer(Component):
         
     def octave_to_png_stream(self, media_item):
 
-        self.ppmFile = NamedTemporaryFile(suffix='.'+self.trans_type)
+        self.ppmFile = NamedTemporaryFile(suffix='.ppm')
         self.wavFile = self.get_wav_path(media_item)
         mFile_tmp = NamedTemporaryFile(suffix='.m')
         mFile_name = mFile_tmp.name
@@ -45,6 +45,7 @@ class OctaveCoreVisualizer(Component):
         mFile_tmp = open(mFile_name,'w')
         self.pngFile = NamedTemporaryFile(suffix='.png')
         command = ['octave2.9', mFile_name]
+        print command
 
         for line in self.get_mFile_line():
             mFile_tmp.write(line)
diff --git a/telemeta/visualization/spectrogram3.py b/telemeta/visualization/spectrogram3.py
new file mode 100644 (file)
index 0000000..f48995c
--- /dev/null
@@ -0,0 +1,48 @@
+# 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)
+
+    def __init__(self):
+        pass
+    
+    def get_id(self):
+        return "spectrogram3"
+
+    def get_name(self):
+        return "Spectrogram3"
+    
+    def render(self, media_item, options=None):
+        """Generator that streams the spectrogram as a PNG image with a python method"""
+
+        wav_file = settings.MEDIA_ROOT + '/' + media_item.file
+        pngFile_w = NamedTemporaryFile(suffix='.png')
+        pngFile_s = NamedTemporaryFile(suffix='.png')
+        image_width = 1800
+        image_height = 150
+        fft_size = 2048
+        args = (wav_file, pngFile_w.name, pngFile_s.name, image_width, image_height, fft_size)
+        create_png(*args)
+
+        buffer = pngFile_s.read(0xFFFF)
+        while buffer:
+            yield buffer
+            buffer = pngFile_s.read(0xFFFF)
+
+        pngFile_w.close()
+        pngFile_s.close()
diff --git a/telemeta/visualization/waveform3.py b/telemeta/visualization/waveform3.py
new file mode 100644 (file)
index 0000000..9f46f41
--- /dev/null
@@ -0,0 +1,51 @@
+# 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)
+
+    def __init__(self):
+        pass
+    
+    def get_id(self):
+        return "waveform3"
+
+    def get_name(self):
+        return "Waveform3"
+    
+    def render(self, media_item, options=None):
+        """Generator that streams the waveform as a PNG image with a python method"""
+
+        wav_file = settings.MEDIA_ROOT + '/' + media_item.file
+        pngFile_w = NamedTemporaryFile(suffix='.png')
+        pngFile_s = NamedTemporaryFile(suffix='.png')
+        image_width = 300
+        image_height = 150
+        fft_size = 2048
+        args = (wav_file, pngFile_w.name, pngFile_s.name, image_width, image_height, fft_size)
+        create_png(*args)
+
+        buffer = pngFile_w.read(0xFFFF)
+        while buffer:
+            yield buffer
+            buffer = pngFile_w.read(0xFFFF)
+
+        pngFile_w.close()
+        pngFile_s.close()
+
+
+