I want to run a function for processing mp3 file with deep learning. But I get the following error. I looked for solutions for similar errors, but it did not help. What could be the problem?
def createSpectrogramsFromAudio():
genresID = dict()
files = os.listdir(rawDataPath)
files = [file for file in files if file.endswith(".mp3")]
nbFiles = len(files)
if not os.path.exists(os.path.dirname(spectrogramsPath)):
try:
os.makedirs(os.path.dirname(spectrogramsPath))
except OSError as exc: # Guard against race condition
if exc.errno != errno.EEXIST:
raise
for index,filename in enumerate(files):
print ("Creating spectrogram for file {}/{}...".format(index+1,nbFiles))
fileGenre = getGenre(rawDataPath+filename)
genresID[fileGenre] = genresID[fileGenre] + 1 if fileGenre in genresID else 1
fileID = genresID[fileGenre]
newFilename = fileGenre+"_"+str(fileID)
createSpectrogram(filename,newFilename)
ERROR:
Creating spectrograms...
Creating spectrogram for file 1/1...
Traceback (most recent call last):
File "main.py", line 33, in <module>
createSlicesFromAudio()
File "/content/drive/My Drive/Colab Notebooks/DeepAudioClassification/songToData.py", line 72, in createSlicesFromAudio
createSpectrogramsFromAudio()
File "/content/drive/My Drive/Colab Notebooks/DeepAudioClassification/songToData.py", line 66, in createSpectrogramsFromAudio
newFilename = fileGenre+"_"+str(fileID)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'