From: Thomas Fillon Date: Tue, 28 Oct 2014 13:36:41 +0000 (+0100) Subject: Fix(Doc): fix tutorial X-Git-Tag: 0.6.1~18 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=0638792b4e4d82598a88b82181f81e9a9666e56c;p=timeside.git Fix(Doc): fix tutorial --- diff --git a/doc/source/tutorial/Streaming.rst b/doc/source/tutorial/Streaming.rst index 5ececfe..0826ace 100644 --- a/doc/source/tutorial/Streaming.rst +++ b/doc/source/tutorial/Streaming.rst @@ -1,5 +1,5 @@ .. This file is part of TimeSide - @author: Guillaume Pellerin + @author: Guillaume Pellerin, Thomas Fillon Streaming out encoded audio ============================ @@ -11,16 +11,19 @@ Instead of calling a pipe.run(), the chunks of an encoding processor can also be >>> from timeside.tools.test_samples import samples >>> import numpy as np >>> audio_file = samples['sweep.wav'] ->>> decoder = get_processor('file_decoder') +>>> decoder = get_processor('file_decoder')(audio_file, duration=1) >>> output = '/tmp/test.mp3' ->>> encoder = get_processor('mp3_encoder')(output, streaming=True) +>>> encoder = get_processor('mp3_encoder')(output, streaming=True, overwrite=True) >>> pipe = decoder | encoder Create a process callback method so that you can retrieve end send the chunks: >>> def streaming_callback(): ->>> for chunk in pipe.stream(): ->>> # Do something with chunk ->>> yield chunk +... for chunk in pipe.stream(): +... # Do something with chunk +... print chunk.timestamp Now you can use the callback to stream the audio data outside TimeSide! + +>>> streaming_callback() # doctest: +SKIP + diff --git a/doc/source/tutorial/quick_start.rst b/doc/source/tutorial/quick_start.rst index 9dc79ee..93bf195 100644 --- a/doc/source/tutorial/quick_start.rst +++ b/doc/source/tutorial/quick_start.rst @@ -36,8 +36,9 @@ Spectrogram. All graphers return an image: .. doctest:: test_2 >>> import timeside + >>> from timeside.tools.test_samples import samples >>> from timeside.core import get_processor - >>> decoder = get_processor('gst-dec')('sweep.wav') # doctest: +SKIP + >>> decoder = get_processor('file_decoder')(samples["sweep.wav"]) >>> spectrogram = get_processor('spectrogram_lin')(width=400, height=150) >>> (decoder | spectrogram).run() >>> spectrogram.render('graph.png') @@ -48,8 +49,9 @@ analysis and encoding: .. doctest:: test_3 >>> import timeside + >>> from timeside.tools.test_samples import samples >>> from timeside.core import get_processor - >>> decoder = get_processor('gst-dec')('sweep.wav') # doctest: +SKIP + >>> decoder = get_processor('file_decoder')(samples["sweep.wav"]) >>> levels = get_processor('level')() >>> encoders = get_processor('mp3_encoder')('sweep.mp3') | get_processor('flac_encoder')('sweep.flac') >>> (decoder | levels | encoders).run()