]> git.parisson.com Git - timeside.git/commitdiff
Fix(Doc): fix tutorial
authorThomas Fillon <thomas@parisson.com>
Tue, 28 Oct 2014 13:36:41 +0000 (14:36 +0100)
committerThomas Fillon <thomas@parisson.com>
Tue, 28 Oct 2014 13:36:41 +0000 (14:36 +0100)
doc/source/tutorial/Streaming.rst
doc/source/tutorial/quick_start.rst

index 5ececfe1be1024f71f0747b44b0946740a8f4608..0826aceeb7087ef485a7bfda091c20b1f7a1d610 100644 (file)
@@ -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
+
index 9dc79ee0df672d8042882c37aae29487e99ec649..93bf19565c3f5c315bb1b878bd127538d9b9decc 100644 (file)
@@ -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()