Skip to Content
Hands-On Reactive Programming with Python
book

Hands-On Reactive Programming with Python

by Romain Picard
October 2018
Intermediate to advanced
420 pages
10h 26m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Python

Configuring the audio encoding

Several changes are necessary to make these settings configurable. The first one is declaring a new sink item:

Configure = namedtuple('Configure', ['samplerate', 'bitdepth'])

This item contains the values of the two settings that can be configured. Then the mp3_to_flac function must take these values as parameters instead of hardcoding them. The following are the changes in it:

def mp3_to_flac(data, samplerate, bitdepth):    ...    transformer.convert(samplerate=samplerate, n_channels=2, bitdepth=bitdepth)    ...

The two samplerate and bitdepth parameters are forwarded to the convert function of the transformer. One last modification is needed to configure the encoding. It consists of saving the information of the

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Programming with Design Patterns

Python Programming with Design Patterns

James W. Cooper

Publisher Resources

ISBN: 9781789138726Supplemental Content