]> git.parisson.com Git - timeside.git/commitdiff
fix doc
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 22 Oct 2014 16:06:23 +0000 (18:06 +0200)
committerThomas Fillon <thomas@parisson.com>
Fri, 24 Oct 2014 12:21:36 +0000 (14:21 +0200)
doc/source/tutorial/Streaming.rst [new file with mode: 0644]
doc/source/tutorial/index.rst

diff --git a/doc/source/tutorial/Streaming.rst b/doc/source/tutorial/Streaming.rst
new file mode 100644 (file)
index 0000000..e6f86e6
--- /dev/null
@@ -0,0 +1,27 @@
+.. This file is part of TimeSide
+   @author: Guillaume Pellerin
+
+=================================
+ Streaming encoded audio outside
+=================================
+
+Instead of calling a pipe.run(), the chunks of an encoding processor can also be retrieved and streamed outside the pipe during the process.
+
+>>> import timeside
+>>> from timeside.core import get_processor
+>>> from timeside.tools.test_samples import samples
+>>> import numpy as np
+>>> audio_file = samples['sweep.wav']
+>>> decoder = get_processor('file_decoder')
+>>> output = '/tmp/test.mp3'
+>>> encoder = get_processor('mp3_encoder')(output, streaming=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
+
+Now you can use the callback to stream the audio data outside TimeSide!
index ce16117aa1b4a9205d03a5272b4f68284adbec77..7e9ee3ed63cac25f818df394ae1d5a18e385d3cc 100644 (file)
@@ -14,5 +14,6 @@ Contents:
       Quick start <quick_start>
       Usage of AnalyzerResult <AnalyzerResult>
       Running a pipe with previously decoded frames <frames_stack>
+      Streaming encoded audio outside TimeSide <Streaming>