'Soundfile does not change the bit rate

I found recently the sounfile library that is intended to convert the bit rate of an audio file (which in my case is 32) to 16, due to the fact I need to have audio files with the bit rate of 16 in order to use them as a dataset for training. The problem is that it does not change anything, I checked with Audacity the resulted files. Does anyone have any ideas why it does that?

Thanks!

import os
import soundfile
folder_name = []

for filename in os.scandir('D:\MLTutorial\TransformerASR\FinalDataset\YoutubeDataset\\audios'):
    if filename.is_file():
        folder_name.append(os.path.basename(filename).split('.')[0])

for f in os.scandir('D:\MLTutorial\TransformerASR\FinalDataset\YoutubeDataset\\audios'):
    if f.is_file():
        file_name = os.path.basename(f)
        print(file_name)
        data, samplerate = soundfile.read('D:\MLTutorial\TransformerASR\FinalDataset\YoutubeDataset\\audios\\'+file_name)
        soundfile.write("D:\\MLTutorial\\TransformerASR\\FinalDataset\\YoutubeDataset\\audios_16khz\\" + file_name, data, 44100, subtype='PCM_16')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source