diff --git a/README.md b/README.md index 5f5f8a3..955ef44 100644 --- a/README.md +++ b/README.md @@ -5,64 +5,52 @@ **Audio** **Decode** converts the encoded audio back to uncompressed audio frames. In most cases, audio decoding is the first step of an audio processing pipeline. +Using the default audio_decode implementation and writing the pipeline in the simplified way -### Interface - ---- - -def audio_decode.${op_name}(**kwargs): - -def ${op_name}.__call__(audio) - -""" - -An audio decode operator takes an audio file path as input. It decodes the audio back to audio frames. - -**Args:** -**audio** (str): +### Code Example -Audio file path. +--- -**Return** (iterable): +```Python +import towhee -An iterator over audio frames with type `towhee.types.AudioFrame`. +towhee.glob('./music.mp3') + .audio_decode().flaten() -""" +``` -### Code Example +### Factory Constructor +--- -Using the default audio_decode implementation and writing the pipeline in the simplified way +Create the operator via the following factory method -```Python -import towhee.DataCollection as dc +audio_decode.ffmpeg() +### Interface -dc.glob(./music.flac) +--- - .audio_decode() +""" - .show() -``` +An audio decode operator takes an audio file path as input. It decodes the audio back to audio frames. +**Args:** +**audio** (str): -Using the ffmpeg based implementations of audio_decode to write a same pipeline +Audio file path. -```Python -import towhee.DataCollection as dc +**Return** (generator): +An generator over audio frames with type `towhee.types.AudioFrame`. +""" -dc.glob['path'](./music.flac) - .audio_decode.ffmpeg['path', 'frames']() - .select('frames') - .show() -```