Trying to save a .wav audio file from Nao. I get a damaged file

41 Views Asked by At

I am implementing a client capable of capturing an audio file from the Nao robot and sending it via socket to a server locally. In reading the file I get a corrupted audio file

if os.path.exists(file_path+"/"+filename):
    audio_file = wave.open(file_path+"/"+filename, 'rb')
    sample_width = audio_file.getsampwidth()
    num_channels = audio_file.getnchannels()
    frame_rate = audio_file.getframerate()
    num_frames = audio_file.getnframes()

    audio_data = audio_file.readframes(num_frames)

    audio_file.close()
else:
    print("Errore: Il file '{}' non esiste.".format(file_path+"/"+filename))

From this i expect an audio file in .wav, but i have a .wav corrupted file

0

There are 0 best solutions below