From: Guillaume Pellerin Date: Wed, 22 Oct 2014 16:06:23 +0000 (+0200) Subject: fix doc X-Git-Tag: 0.6~4^2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=0dfa06bd51d56f0f6038239347fa7e98c1993dc2;p=timeside.git fix doc --- diff --git a/doc/source/tutorial/Streaming.rst b/doc/source/tutorial/Streaming.rst new file mode 100644 index 0000000..e6f86e6 --- /dev/null +++ b/doc/source/tutorial/Streaming.rst @@ -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! diff --git a/doc/source/tutorial/index.rst b/doc/source/tutorial/index.rst index ce16117..7e9ee3e 100644 --- a/doc/source/tutorial/index.rst +++ b/doc/source/tutorial/index.rst @@ -14,5 +14,6 @@ Contents: Quick start Usage of AnalyzerResult Running a pipe with previously decoded frames + Streaming encoded audio outside TimeSide