From 8563f43b45c4ab01e3a2a652024cd6a04dab484e Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Sun, 13 Oct 2013 17:37:13 +0200 Subject: [PATCH] update README and slides --- README.rst | 178 ++++------- doc/slides/timeside_slides.html | 508 ++++++++++++++++---------------- timeside/grapher/core.py | 11 +- 3 files changed, 320 insertions(+), 377 deletions(-) diff --git a/README.rst b/README.rst index 6dfbfb3..c1e3b8a 100644 --- a/README.rst +++ b/README.rst @@ -15,14 +15,14 @@ Goals We just *need* a python library to: - * build a python framework to do asynchronous audio processing, - * decode audio frames from ANY format into numpy arrays, - * analyze audio content with some state-of-the-art audio feature extraction libraries, - * organize, serialize and save analysis metadata through various formats, - * draw various fancy waveforms, spectrograms and other cool graphers, - * transcode audio data in various media formats and stream them through web apps, - * playback and interact *on demand* through a smart high-level HTML5 extensible player, - * index, tag and organize semantic metadata (see `Telemeta `_ which embed TimeSide). + * Do asynchronous and fast audio processing with Python, + * Decode audio frames from ANY format into numpy arrays, + * Analyze audio content with some state-of-the-art audio feature extraction libraries, + * Organize, serialize and save analysis metadata through various formats, + * Draw various fancy waveforms, spectrograms and other cool graphers, + * Transcode audio data in various media formats and stream them through web apps, + * Playback and interact *on demand* through a smart high-level HTML5 extensible player, + * Index, tag and organize semantic metadata (see `Telemeta `_ which embed TimeSide). Here is a schematic diagram of the TimeSide engine architecture: @@ -149,38 +149,6 @@ get the results:: `More examples `_ -UI examples -=========== - - * http://code.google.com/p/timeside/ - * http://parisson.telemeta.org/archives/items/PRS_07_01_03/ - * http://archives.crem-cnrs.fr/items/CNRSMH_I_1956_002_001_01/ (player embedded in a Telemeta session) - - -APIs and guides -=============== - -Engine API : http://code.google.com/p/timeside/source/browse/trunk/timeside/api.py - -Player API and guide : http://code.google.com/p/timeside/wiki/UiGuide - - -Related projects -================= - -TimeSide has emerged in 2010 from the `Telemeta project `_ which develops a free and open-source web audio CMS. - -Some decoders and encoders depend on the great `GStreamer framework `_. - - -Platforms -========= - -The TimeSide engine is intended to work on all Unix / Linux platforms, but MacOS X and Windows versions will soon be explorated. - -The player should work on any modern HTML5 enabled browser. Flash is needed for MP3 if the browser doesn't support it. - - Install ======= @@ -188,115 +156,69 @@ TimeSide needs some other python modules to run. The following methods explain h On Debian, Ubuntu, etc:: + $ echo "deb http://debian.parisson.com/debian/ stable main" | sudo tee -a /etc/apt/sources.list $ sudo apt-get update - $ sudo apt-get install gcc python python-dev python-pip python-setuptools \ - python-gobject gobject-introspection \ - python-gst0.10 gstreamer0.10-plugins-base gir1.2-gstreamer-0.10 \ - gstreamer0.10-plugins-good gstreamer0.10-plugins-bad \ - gobject-introspection python-mutagen \ - python-scipy python-h5py - -On Fedora and Red-Hat, etc:: + $ sudo apt-get install python-timeside - $ sudo yum update - $ sudo yum install gcc python python-devel gstreamer pygobject2 gstreamer-python \ - gstreamer gstreamer-plugins-bad-free gstreamer-plugins-bad-free-extras \ - gstreamer-plugins-base gstreamer-plugins-good - -And then:: +On other system, you'll need to install the Gstreamer framework and modules, aubio 0.4, yaafe 0.64 and then :: $ sudo pip install timeside -To get non-free (MP3, MP4, AAC, etc) decoding and encoding features, add Debian Multimedia repository and install the modules:: - echo "deb http://www.deb-multimedia.org stable main non-free" | sudo tee -a /etc/apt/sources.list - sudo apt-get update - apt-get install gstreamer0.10-lame gstreamer0.10-plugins-really-bad gstreamer0.10-plugins-ugly +Extensible HTML5 User Interface +================================ +TimeSide comes with a smart HTML5 audio player which can drive the process engine through a web server. -Batching -========= +Some examples of application: -TimeSide provides *ts-waveforms*, a waveform rendering batch script. Usage:: + * http://parisson.telemeta.org/archives/items/PRS_07_01_03/ + * http://archives.crem-cnrs.fr/items/CNRSMH_I_1956_002_001_01/ (player embedded in a Telemeta session) - ts-waveforms /path/to/media_dir /path/to/img_dir +The detailed documentation to extend the player: -Please use absolute paths. For example:: + * https://github.com/yomguy/TimeSide/wiki/Ui-Guide - ts-waveforms /home/$user/music/mp3/ /home/$USER/images/ -To change the color scheme or the size of the waveforms, edit the script from the source and change the variables of the GrapherScheme object:: +Documentation +============== - git clone https://github.com/yomguy/TimeSide.git - cd timeside/scripts/ - vi ts-waveforms - ./ts-waveforms /home/$user/music/mp3/ /home/$USER/images/ +Engine API : http://code.google.com/p/timeside/source/browse/trunk/timeside/api.py -Packages included +Related projects ================= - * SoundManager 2 >= 2.91 (http://www.schillmania.com/projects/soundmanager2) - * jQuery => 1.2.6 (http://www.jquery.com) - * jsGraphics => 3.03 (http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm) +TimeSide has emerged in 2010 from the `Telemeta project `_ which develops a free and open source web audio CMS. +Some decoders and encoders depend on the great `GStreamer framework `_. -License -======= - -TimeSide is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. -TimeSide is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +Platforms +========= -See LICENSE for more details. +The TimeSide engine is intended to work on all Unix / Linux platforms. +MacOS X and Windows versions will soon be explorated. +The player should work on any modern HTML5 enabled browser. +Flash is needed for MP3 if the browser doesn't support it. Development =========== -For version >= 0.5 + aubio 0.4dev on Linux (Debian Stable 7.0):: - - sudo apt-get update - - sudo apt-get install python python-dev python-pip python-setuptools python-gobject \ - python-gst0.10 gstreamer0.10-plugins-base gir1.2-gstreamer-0.10 \ - gstreamer0.10-plugins-good gstreamer0.10-plugins-bad \ - gstreamer0.10-plugins-ugly gobject-introspection python-numpy \ - python-yaml python-imaging python-simplejson python-mutagen - libsndfile-dev libsamplerate-dev libjack-jackd2-dev \ - liblash-compat-dev libfftw3-dev \ - docbook-to-man gcc git-core ipython \ - -Install aubio module with "develop" branch:: - - git clone git://git.aubio.org/git/aubio/ - cd aubio - git checkout develop - ./waf configure - ./waf build - sudo ./waf install - cd python - sudo python setup.py install - -Install temporary timeside module with "dev" branch:: - - git clone https://github.com/yomguy/TimeSide.git - cd TimeSide - git checkout dev - export PYTHONPATH=$PYTHONPATH:`pwd` - $tests/run_all_tests - +For version >= 0.5 on Debian Stable 7.0 Wheezy:: -Official repositories: + $ echo "deb http://debian.parisson.com/debian/ stable main" | sudo tee -a /etc/apt/sources.list + $ echo "deb-src http://debian.parisson.com/debian/ stable main" | sudo tee -a /etc/apt/sources.list + $ sudo apt-get update + $ sudo apt-get install git + $ sudo apt-get build-dep python-timeside - * http://code.google.com/p/timeside/ - * https://github.com/yomguy/TimeSide + $ git clone https://github.com/yomguy/TimeSide.git + $ cd TimeSide + $ git checkout dev + $ export PYTHONPATH=$PYTHONPATH:`pwd` + $ python tests/run_all_tests API / Documentation @@ -304,7 +226,6 @@ API / Documentation The *source code*, the API and some slides: - * http://code.google.com/p/timeside/ * https://github.com/yomguy/TimeSide * http://files.parisson.com/api/timeside/ * http://files.parisson.com/timeside/timeside/doc/timeside_slides.html @@ -319,3 +240,18 @@ Copyrights * Copyright (c) 2013 Thomas Fillon * Copyright (c) 2006, 2010 Samalyse SARL + +License +======= + +TimeSide is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +TimeSide is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +See LICENSE for more details. diff --git a/doc/slides/timeside_slides.html b/doc/slides/timeside_slides.html index 923a205..433e14d 100644 --- a/doc/slides/timeside_slides.html +++ b/doc/slides/timeside_slides.html @@ -1,92 +1,92 @@ - - + + - TimeSide : open and fast web audio components + TimeSide : open and fast web audio components - - + + - - + + - + - - + + - - + + - - + + - - + + - + -
+
- -
+ +
-
-

TimeSide

-

open and fast web audio components

-

- created by Guillaume Pellerin / @yomguy at Parisson.com -

- -
+
+

TimeSide

+

open and fast web audio components

+

+ created by Guillaume Pellerin / @yomguy at Parisson.com +

+ +
-
-

Goals

-

We just need a python library to:

-
-
    -
  • build an open python framework to do scalable asynchronous audio processing
  • -
  • decode audio frames from any format into numpy arrays
  • -
  • stream the frames in various processors and do numpy data analyzing
  • -
  • create various image outputs like waveforms, spectrograms, etc.. with numpy and PIL
  • -
  • transcode the processed frames in various media formats and stream it on the fly in realtime
  • -
  • provide a high-level 100% HTML5 user interface to display the results on demand and play sound through the web
  • -
  • metadata indexing, time marking and store everything on a web server (see Telemeta project)
  • -
-
- -
-

Architecture

- TimeSide architecture -
- -
-

Quick processing example

-

Define some processors:

-

+    
+

Goals

+

We just need a python library to:

+
+
    +
  • build an open python framework to do scalable asynchronous audio processing
  • +
  • decode audio frames from any format into numpy arrays
  • +
  • stream the frames in various processors and do numpy data analyzing
  • +
  • create various image outputs like waveforms, spectrograms, etc.. with numpy and PIL
  • +
  • transcode the processed frames in various media formats and stream it on the fly in realtime
  • +
  • provide a high-level 100% HTML5 user interface to display the results on demand and play sound through the web
  • +
  • metadata indexing, time marking and store everything on a web server (see Telemeta project)
  • +
+
+ +
+

Architecture

+ TimeSide architecture +
+ +
+

Quick processing example

+

Define some processors:

+

 import timeside.decoder
 import timeside.grapher
 import timeside.analyzer
@@ -96,51 +96,51 @@ decoder = timeside.decoder.FileDecoder('tests/samples/sweep.wav')
 grapher = timeside.grapher.Waveform()
 analyzer = timeside.analyzer.Level()
 encoder = timeside.encoder.Mp3Encoder('tests/samples/sweep.mp3')
-					
-

then, the magic pipeline:

-

+     
+

then, the magic pipeline:

+

 (decoder | grapher | analyzer | encoder).run()
-					
-

get the results:

-

+     
+

get the results:

+

 grapher.render(output='image.png')
 print 'Level:', analyzer.results()
-					
-
- -
-

Quick UI example

- -

-

Documentation : UiGuide

-
- - -
-

Changelog (dev branch, 05/13)

-
    -
  • finally fix all decoder memory leaks! (piem)
  • -
  • fix ogg vorbis and flac encoders (piem)
  • -
  • add various aubio analyzers thanks to piem such as :
  • -
      -
    • pitch (f0)
    • -
    • onsets
    • -
    • tempo
    • -
    • various spectral descriptors like : hfc, complex, phase, specdiff, kl, - mkl, specflux, centroid, slope, rolloff, spread, skewness, kurtosis, decrease
    • -
    -
  • new AnalyzerResultContainer and AnalyzerResult classes with various i/o formats : xml, json, yaml, numpy (piem)
  • -
  • more unit tests (piem)
  • -
  • UI : rewind player after ending + various bugfixes (yomguy) -
  • separate hosting for test samples (yomguy)
  • -
-
- - -
-

Install for production

-

for version 0.4.3 on Linux (Debian Stable 7.0)

-

+     
+
+ +
+

Quick UI example

+ +

+

Documentation : UiGuide

+
+ + +
+

Changelog (dev branch, 05/13)

+
    +
  • finally fix all decoder memory leaks! (piem)
  • +
  • fix ogg vorbis and flac encoders (piem)
  • +
  • add various aubio analyzers thanks to piem such as :
  • +
      +
    • pitch (f0)
    • +
    • onsets
    • +
    • tempo
    • +
    • various spectral descriptors like : hfc, complex, phase, specdiff, kl, + mkl, specflux, centroid, slope, rolloff, spread, skewness, kurtosis, decrease
    • +
    +
  • new AnalyzerResultContainer and AnalyzerResult classes with various i/o formats : xml, json, yaml, numpy (piem)
  • +
  • more unit tests (piem)
  • +
  • UI : rewind player after ending + various bugfixes (yomguy) +
  • separate hosting for test samples (yomguy)
  • +
+
+ + +
+

Install for production

+

for version 0.4.3 on Linux (Debian Stable 7.0)

+

 sudo apt-get update
 
 sudo apt-get install python python-pip python-setuptools python-gobject \
@@ -151,13 +151,13 @@ sudo apt-get install python python-pip python-setuptools python-gobject \
                         python-simplejson
 
 sudo pip install timeside
- 					
-
+
+
-
-

Install for development 1/2

-

for version >= 0.5 + aubio 0.4dev on Linux (Debian Stable 7.0)

-

+    
+

Install for development 1/2

+

for version >= 0.5 + aubio 0.4dev on Linux (Debian Stable 7.0)

+

 sudo apt-get update
 
 sudo apt-get install python python-dev python-pip python-setuptools python-gobject \
@@ -185,14 +185,14 @@ sudo ./waf install
 
 cd python
 sudo python setup.py install
- 					
-
+
+
-
-

Install for development 2/2

+
+

Install for development 2/2

-

+     

 
 git clone https://github.com/yomguy/TimeSide.git
 
@@ -204,15 +204,15 @@ export PYTHONPATH=$PYTHONPATH:`pwd`
 
 tests/run_all_tests
 
- 					
+
-

Ready!

-
+

Ready!

+
-
-

API

- IProcessor -

+    
+

API

+ IProcessor +

 class IProcessor(Interface):
     """Common processor interface"""
 
@@ -271,14 +271,14 @@ class IProcessor(Interface):
 
         # implementations should always call the parent method
 
-					
-
+
+
-
-

API

- IDecoder -

+    
+

API

+ IDecoder +

 class IDecoder(IProcessor):
     """Decoder driver interface. Decoders are different of encoders in that
     a given driver may support several input formats, hence this interface doesn't
@@ -301,14 +301,14 @@ class IDecoder(IProcessor):
     def metadata(self):
         """Return the metadata embedded into the encoded stream, if any."""
 
-					
-
+
+
-
-

API

- IAnalyzer -

+    
+

API

+ IAnalyzer +

 class IAnalyzer(IProcessor):
     """Media item analyzer driver interface. This interface is abstract, it doesn't
     describe a particular type of analyzer but is rather meant to group analyzers.
@@ -330,13 +330,13 @@ class IAnalyzer(IProcessor):
     @staticmethod
     def unit():
         """Return the unit of the data such as "dB", "seconds", etc...  """
-					
-
+
+
-
-

API

- AnalyzerResultContainer -

+    
+

API

+ AnalyzerResultContainer +

 class AnalyzerResultContainer(object):
 
     def __init__(self, analyzer_results = []):
@@ -440,21 +440,21 @@ class AnalyzerResultContainer(object):
     def from_numpy(self, input_file):
         import numpy
         return numpy.load(input_file)
-					
-
+
+
-
-

Howto implement an analyzer plugin?

-

start from this template

-

+    
+

Howto implement an analyzer plugin?

+

start from this template

+

 from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
 from timeside.analyzer.core import *
-from timeside.api import IValueAnalyzer
+from timeside.api import IAnalyzer
 
 import numpy
 
-class NewAnalyzer(Processor):
-    implements(IValueAnalyzer)
+class NewAnalyzer(Analyzer):
+    implements(IAnalyzer)
 
     @interfacedoc
     def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None):
@@ -479,7 +479,6 @@ class NewAnalyzer(Processor):
         return frames, eod
 
     def results(self):
-        container = AnalyzerResultContainer()
 
         result = AnalyzerResult(id = self.id(), name = self.name(), unit = "something")
         result.value = self.result_data
@@ -489,18 +488,18 @@ class NewAnalyzer(Processor):
 
         return container
 
-					
-
- -
-

Howto implement an analyzer plugin?

-
    -
  • adapt the template
  • -
  • save the file in timeside/analyzer/ -
    for instance : timeside/analyzer/new_analyzer.py
  • -
  • add it to timeside/analyzer/__init__.py like:
  • -
-

+     
+
+ +
+

Howto implement an analyzer plugin?

+
    +
  • adapt the template
  • +
  • save the file in timeside/analyzer/ +
    for instance : timeside/analyzer/new_analyzer.py
  • +
  • add it to timeside/analyzer/__init__.py like:
  • +
+

 from level import *
 from dc import *
 from aubio_temporal import *
@@ -508,16 +507,21 @@ from aubio_pitch import *
 from aubio_mfcc import *
 from aubio_melenergy import *
 from aubio_specdesc import *
+from yaafe import * # TF : add Yaafe analyzer
+from spectrogram import Spectrogram
+from waveform import Waveform
+from vamp_plugin import VampSimpleHost
+from irit_speech_entropy import *
+from irit_speech_4hz import *
 from new_analyzer import * # << here
-					
-
+
+
-
-

Howto implement an analyzer plugin?

-

then test it! -


-import timeside.decoder
-import timeside.analyzer
+    
+

Howto implement an analyzer plugin?

+

then test it! +


+import timeside
 
 decoder = timeside.decoder.FileDecoder('tests/samples/sweep.wav')
 analyzer = timeside.analyzer.NewAnalyzer()
@@ -525,77 +529,77 @@ analyzer = timeside.analyzer.NewAnalyzer()
 (decoder | analyzer).run()
 
 analyzer.results()
-					
-
- -
-

Links

-
+
+ +
+

Links

+ -
- -
-

Thanks!

-

by Guillaume Pellerin

-

guillaume@parisson.com

-

@yomguy

-
-

This document is released under the terms of the contract Creative Commons by-nc-sa/2.0/fr

-
- -
- -
- - - - - - - +
  • Telemeta project : web audio CMS
  • +
  • Aubio project
  • +
  • GNU General Public License
  • + + + +
    +

    Thanks!

    +

    by Guillaume Pellerin

    +

    guillaume@parisson.com

    +

    @yomguy

    +
    +

    This document is released under the terms of the contract Creative Commons by-nc-sa/2.0/fr

    +
    + +
    + +
    + + + + + + + diff --git a/timeside/grapher/core.py b/timeside/grapher/core.py index 8577649..ffcaa55 100644 --- a/timeside/grapher/core.py +++ b/timeside/grapher/core.py @@ -273,6 +273,7 @@ class WaveformImage(object): def release(self): pass + class WaveformImageJoyContour(WaveformImage): def __init__(self, image_width, image_height, nframes, samplerate, @@ -325,7 +326,6 @@ class WaveformImageJoyContour(WaveformImage): for i in range(0,self.ndiv): self.previous_x, self.previous_y = None, None - #bright_color = 255 bright_color = int(255*(1-float(i)/(self.ndiv*2))) bright_color = 255-bright_color+self.color_offset #line_color = self.color_lookup[int(self.centroids[j]*255.0)] @@ -335,11 +335,9 @@ class WaveformImageJoyContour(WaveformImage): #contour = contour*(1.0-float(i)/self.ndiv) #contour = contour*(1-float(i)/self.ndiv) - # Cosine + # Scaled contour = contour*numpy.arccos(float(i)/self.ndiv)*2/numpy.pi #contour = self.contour*(1-float(i)*numpy.arccos(float(i)/self.ndiv)*2/numpy.pi/self.ndiv) - - # Negative Sine #contour = contour + ((1-contour)*2/numpy.pi*numpy.arcsin(float(i)/self.ndiv)) curve = (height-1)*contour @@ -391,6 +389,7 @@ class WaveformImageJoyContour(WaveformImage): def release(self): pass + class WaveformImageSimple(object): """ Builds a PIL image representing a waveform of the audio stream. Adds pixels iteratively thanks to the adapter providing fixed size frame buffers. @@ -488,6 +487,7 @@ class WaveformImageSimple(object): def release(self): pass + class SpectrogramImage(object): """ Builds a PIL image representing a spectrogram of the audio stream (level vs. frequency vs. time). Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.""" @@ -569,6 +569,7 @@ class SpectrogramImage(object): def release(self): pass + class Noise(object): """A class that mimics audiolab.sndfile but generates noise instead of reading a wave file. Additionally it can be told to have a "broken" header and thus crashing @@ -691,6 +692,7 @@ def smooth(x, window_len=10, window='hanning'): y = numpy.convolve(w/w.sum(), s, mode='same') return y[window_len-1:-window_len+1] + def reduce_opacity(im, opacity): """Returns an image with reduced opacity.""" assert opacity >= 0 and opacity <= 1 @@ -703,6 +705,7 @@ def reduce_opacity(im, opacity): im.putalpha(alpha) return im + def im_watermark(im, inputtext, font=None, color=None, opacity=.6, margin=(30,30)): """ imprints a PIL image with the indicated text in lower-right corner -- 2.39.5