I have a directory with a lot of audio files and a list that contains the names of some of these files. I want to process only the files in the directory that are matching with my name list.
My attempt (that is not working) is this:
path_to_audio_files = 'D:/Data_small/output_conv/'
sample_list = ['s1.wav', 's2.wav', 's3.wav']
import fnmatch
for file in os.listdir(path_to_audio_files):
if fnmatch.fnmatch(file, sample_list):
fs, signal = wavfile.read(file)
Is this even the right way to do it or how can it be done? Thanks!