0

I have WAV file and I'm trying to use the silence of the audio to create dataset of audio's

I use this code to split the audio

sound = AudioSegment.from_file("/content/46.wav", format="wav")
audio_chunks = split_on_silence(sound, min_silence_len=500, silence_thresh=-50)
for i, chunk in enumerate(audio_chunks):
    output_file = "/content/chunk{0}.wav".format(i)
    chunk.export(output_file, format="wav")

Problem:

my 46.wav file is float32 and 44100H but when I check the created chunks, sample rate is ok but float32 changed to int16

#original file
rate, audio = read("/content/46.wav")

rate: 44100
audio: array([[-1, -1], ..., [ 0, 0]], dtype=float32)

for example chunck1.wav

rate: 44100
audio: array([[-1, -1], ..., [ 0, 0]], dtype=int16)

how do I fix this dtype=int16

0 Answers0