October 2018
Intermediate to advanced
420 pages
10h 26m
English
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