From: Thomas Fillon Date: Wed, 14 May 2014 11:16:42 +0000 (+0200) Subject: Fix documentation and doctest X-Git-Tag: 0.5.5~1^2~26^2~2^2^2~4 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=23130fb617a0400076b9eff61dd66f07a1bb345f;p=timeside.git Fix documentation and doctest --- diff --git a/doc/source/api/analyzer/analyzers.rst b/doc/source/api/analyzer/analyzers.rst index 9c15a75..7d6e524 100644 --- a/doc/source/api/analyzer/analyzers.rst +++ b/doc/source/api/analyzer/analyzers.rst @@ -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: diff --git a/doc/source/api/decoder/index.rst b/doc/source/api/decoder/index.rst index 34b6df6..5197bbe 100644 --- a/doc/source/api/decoder/index.rst +++ b/doc/source/api/decoder/index.rst @@ -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: diff --git a/doc/source/tutorial/frames_stack.rst b/doc/source/tutorial/frames_stack.rst index 6cab3c2..cf0f7ff 100644 --- a/doc/source/tutorial/frames_stack.rst +++ b/doc/source/tutorial/frames_stack.rst @@ -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 ` 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 -[, ] +[, ] After the pipe has been run, the other processes of the pipe are removed from the pipe and only the :class:`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 -[, ] +[, ] And run the pipe: diff --git a/doc/source/tutorial/quick_start.rst b/doc/source/tutorial/quick_start.rst index 723dd40..f750933 100644 --- a/doc/source/tutorial/quick_start.rst +++ b/doc/source/tutorial/quick_start.rst @@ -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={})} diff --git a/timeside/analyzer/yaafe.py b/timeside/analyzer/yaafe.py index 978753f..6b34052 100644 --- a/timeside/analyzer/yaafe.py +++ b/timeside/analyzer/yaafe.py @@ -36,7 +36,6 @@ from timeside.analyzer.preprocessors import downmix_to_mono class Yaafe(Analyzer): - """Yaafe feature extraction library interface analyzer""" implements(IAnalyzer) diff --git a/timeside/decoder/live.py b/timeside/decoder/live.py index 0651d5d..70cd997 100644 --- a/timeside/decoder/live.py +++ b/timeside/decoder/live.py @@ -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)