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/
$ 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
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
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
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
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)
--- /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)
+
+ 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()
--- /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)
+
+ 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()
+
+
+