i have a wav file and i want to split according to the data i have in a list called speech and to export the the splitted wav files in folders according to the label variable
JavaScript
x
10
10
1
label=speech[0]
2
start= speech[1]
3
end = speech[2]
4
newAudio = AudioSegment.from_wav(audio_file_path)
5
newAudio = newAudio[start:end]
6
if label==1:
7
newAudio.export('/content/',x,'.wav', format="wav")
8
else:
9
newAudio.export('/content/',x,'.wav', format="wav")
10
but i keep getting the error export() got multiple values for argument ‘format’
Advertisement
Answer
The function definition of export
is as follows:
JavaScript
1
2
1
export(self, out_f=None, format='mp3', codec=None, bitrate=None, parameters=None, tags=None, id3v2_version='4', cover=None)
2
I think what you’re trying to do with your first parameter is a string concatenation, e.g. change it to a f-string:
JavaScript
1
2
1
newAudio.export(f'/content/{x}.wav', format='wav')
2