]> git.parisson.com Git - timeside.git/commitdiff
Fix documentation and doctest
authorThomas Fillon <thomas@parisson.com>
Wed, 14 May 2014 11:16:42 +0000 (13:16 +0200)
committerThomas Fillon <thomas@parisson.com>
Wed, 14 May 2014 11:16:42 +0000 (13:16 +0200)
doc/source/api/analyzer/analyzers.rst
doc/source/api/decoder/index.rst
doc/source/tutorial/frames_stack.rst
doc/source/tutorial/quick_start.rst
timeside/analyzer/yaafe.py
timeside/decoder/live.py

index 9c15a75c6961fd2876e3ed3a2ecc21bf7efdabeb..7d6e524e69909c33327f2baddde3454071d6a4e1 100644 (file)
@@ -27,9 +27,10 @@ Aubio
 **aubio** is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.
 See http://aubio.org/
 
+
 Aubio Melenergy
 ---------------
-.. automodule:: timeside.analyzer.aubio_melenergy
+.. automodule:: timeside.analyzer.aubio.aubio_melenergy
    :members:
    :undoc-members:
    :show-inheritance:
@@ -37,28 +38,28 @@ Aubio Melenergy
 
 aubio_mfcc
 ----------
-.. automodule:: timeside.analyzer.aubio_mfcc
+.. automodule:: timeside.analyzer.aubio.aubio_mfcc
    :members:
    :undoc-members:
    :show-inheritance:
 
 aubio_pitch
 -----------
-.. automodule:: timeside.analyzer.aubio_pitch
+.. automodule:: timeside.analyzer.aubio.aubio_pitch
    :members:
    :undoc-members:
    :show-inheritance:
 
 aubio_specdesc
 --------------
-.. automodule:: timeside.analyzer.aubio_specdesc
+.. automodule:: timeside.analyzer.aubio.aubio_specdesc
    :members:
    :undoc-members:
    :show-inheritance:
 
 aubio_temporal
 --------------
-.. automodule:: timeside.analyzer.aubio_temporal  
+.. automodule:: timeside.analyzer.aubio.aubio_temporal  
    :members:
    :undoc-members:
    :show-inheritance:
index 34b6df6a059ec5e6e17610d1ffc9861eff5cecdb..5197bbe004090c08da5711180db416ef9c29594e 100644 (file)
@@ -12,7 +12,7 @@ Decoder package
 File Decoder
 ===========
 
-.. autoclass:: FileDecoder
+.. autoclass:: timeside.decoder.file.FileDecoder
    :members:
    :undoc-members:
    :show-inheritance:
@@ -20,7 +20,7 @@ File Decoder
 Array Decoder
 =============
 
-.. autoclass:: ArrayDecoder
+.. autoclass:: timeside.decoder.array.ArrayDecoder
    :members:
    :undoc-members:
    :show-inheritance:
@@ -28,7 +28,7 @@ Array Decoder
 Live Decoder
 =============
 
-.. autoclass:: LiveDecoder
+.. autoclass:: timeside.decoder.live.LiveDecoder
    :members:
    :undoc-members:
    :show-inheritance:
index 6cab3c258750c3fab98eb9711be51b7deada08e5..cf0f7ffad228d840747c15b462ffdfd6e5e08fd0 100644 (file)
@@ -10,19 +10,20 @@ Example of use of the `stack` argument in :class:`timeside.decoder.file.FileDeco
 First, let's import everything and define the audio file source :
 
 >>> import timeside
+>>> from timeside.core import get_processor
 >>> import numpy as np
 >>> audio_file = 'http://github.com/yomguy/timeside-samples/raw/master/samples/sweep.mp3'
 
 Then let's setup a :class:`FileDecoder <timeside.decoder.file.FileDecoder>` with argument `stack=True` (default argument is `stack=False`) :
 
->>> decoder = timeside.decoder.FileDecoder(audio_file, stack=True)
+>>> decoder = timeside.decoder.file.FileDecoder(audio_file, stack=True)
 
 Setup an arbitrary analyzer to check that decoding process from file and from stack are equivalent:
 
->>> pitch_on_file = timeside.analyzer.AubioPitch()
+>>> pitch_on_file = get_processor('aubio_pitch')()
 >>> pipe = (decoder | pitch_on_file)
 >>> print pipe.processors #doctest: +ELLIPSIS
-[<timeside.decoder.file.FileDecoder object at 0x...>, <timeside.analyzer.aubio_pitch.AubioPitch object at 0x...>]
+[<timeside.decoder.file.FileDecoder object at 0x...>, <timeside.analyzer.aubio.aubio_pitch.AubioPitch object at 0x...>]
 
 After the pipe has been run, the other processes of the pipe are removed from the pipe and only the :class:`FileDecoder <timeside.decoder.file.FileDecoder>` is kept :
 
@@ -48,13 +49,13 @@ Last frame :
 If the pipe is used for a second run, the processed frames stored in the stack are passed to the other processors without decoding the audio source again.
 Let's define a second analyzer equivalent to the previous one:
 
->>> pitch_on_stack = timeside.analyzer.AubioPitch()
+>>> pitch_on_stack = get_processor('aubio_pitch')()
 
 Add it to the pipe:
 
 >>> pipe |= pitch_on_stack
 >>> print pipe.processors #doctest: +ELLIPSIS
-[<timeside.decoder.file.FileDecoder object at 0x...>, <timeside.analyzer.aubio_pitch.AubioPitch object at 0x...>]
+[<timeside.decoder.file.FileDecoder object at 0x...>, <timeside.analyzer.aubio.aubio_pitch.AubioPitch object at 0x...>]
 
 And run the pipe:
 
index 723dd40be34c53f699aa99eadc8bbfed45d3b153..f750933a969e9a565a66a8f3c6f1dc7183abcd02 100644 (file)
@@ -11,7 +11,7 @@ A most basic operation, transcoding, is easily performed with two processors:
    import os
    ModulePath =  os.path.dirname(os.path.realpath(timeside.analyzer.core.__file__))
    wavFile = os.path.join(ModulePath , '../../tests/samples/sweep.wav')
-   decoder = timeside.decoder.FileDecoder(wavFile)
+   decoder = timeside.decoder.file.FileDecoder(wavFile)
 
 .. testcleanup:: test_1
 
@@ -28,9 +28,10 @@ A most basic operation, transcoding, is easily performed with two processors:
 
 .. doctest:: test_1
 
- >>> import timeside # doctest: +SKIP
- >>> decoder = timeside.decoder.FileDecoder('sweep.wav')# doctest: +SKIP
- >>> encoder = timeside.encoder.VorbisEncoder('sweep.ogg')
+ >>> import timeside
+ >>> from timeside.core import get_processor        
+ >>> decoder = get_processor('gst_dec')('sweep.wav')# doctest: +SKIP
+ >>> encoder = get_processor('gst_vorbis_enc')('sweep.ogg')
  >>> pipe = decoder | encoder
  >>> pipe.run()
 
@@ -43,8 +44,9 @@ Spectrogram. All graphers return an image:
 .. doctest:: test_2
 
    >>> import timeside
-   >>> decoder = timeside.decoder.FileDecoder('sweep.wav') # doctest: +SKIP
-   >>> spectrogram = timeside.grapher.SpectrogramLinear(width=400, height=150)
+   >>> from timeside.core import get_processor
+   >>> decoder =  get_processor('gst-dec')('sweep.wav') # doctest: +SKIP
+   >>> spectrogram = get_processor('spectrogram_lin')(width=400, height=150)
    >>> (decoder | spectrogram).run()
    >>> spectrogram.render('graph.png')
 
@@ -54,9 +56,10 @@ analysis and encoding:
 .. doctest:: test_3
 
    >>> import timeside
-   >>> decoder = timeside.decoder.FileDecoder('sweep.wav') # doctest: +SKIP
-   >>> levels = timeside.analyzer.Level()
-   >>> encoders = timeside.encoder.Mp3Encoder('sweep.mp3') | timeside.encoder.FlacEncoder('sweep.flac')
+   >>> from timeside.core import get_processor
+   >>> decoder = get_processor('gst-dec')('sweep.wav') # doctest: +SKIP
+   >>> levels = get_processor('level')()
+   >>> encoders = get_processor('gst_mp3_enc')('sweep.mp3') | get_processor('gst_flac_enc')('sweep.flac')
    >>> (decoder | levels | encoders).run()
    >>> print levels.results
    {'level.max': GlobalValueResult(id_metadata=IdMetadata(id='level.max', name='Level Max', unit='dBFS', description='', date='...', version='...', author='TimeSide', uuid='...'), data_object=DataObject(value=array([-6.021])), audio_metadata=AudioMetadata(uri='file://...sweep.wav', start=0.0, duration=8.0, is_segment=False, sha1='...', channels=2, channelsManagement=''), parameters={}), 'level.rms': GlobalValueResult(id_metadata=IdMetadata(id='level.rms', name='Level RMS', unit='dBFS', description='', date='...', version='...', author='TimeSide', uuid='...'), data_object=DataObject(value=array([-9.856])), audio_metadata=AudioMetadata(uri='file://...sweep.wav', start=0.0, duration=8.0, is_segment=False, sha1='...', channels=2, channelsManagement=''), parameters={})}
index 978753fbe8f884d79a8ddd37ef96ebb626f908af..6b340520971321e8b0a0ac86d73ba6ea818ea4e0 100644 (file)
@@ -36,7 +36,6 @@ from timeside.analyzer.preprocessors import downmix_to_mono
 
 
 class Yaafe(Analyzer):
-
     """Yaafe feature extraction library interface analyzer"""
     implements(IAnalyzer)
 
index 0651d5dc68ac1e08d767c2e316f1201cb81d97fa..70cd99714faf0c08fa1aad5154e8e5f9731c67d8 100644 (file)
@@ -70,8 +70,9 @@ class LiveDecoder(Decoder):
 
         >>> import timeside
 
+        >>> from timeside.core import get_processor
         >>> live = timeside.decoder.live.LiveDecoder(num_buffers=5)
-        >>> a = timeside.analyzer.Waveform()
+        >>> a = get_processor('waveform_analyzer')()
         >>> e = timeside.encoder.mp3.Mp3Encoder('/tmp/test_live.mp3',
         ...                                 overwrite=True)
         >>> pipe = (live | a | e)