Jetson nano audio looping skipping

I have a jetson nano and im trying to play a sound on a loop,
im doing a basic sound playing with pyaudio on a basic python loop, it looks like this:

for i in range(10):
    new_player = Player(device=player_device, file='test.wav')
    data = new_player.wav_file.readframes(new_player.chunk_size)
        print(f"Playing {new_player.file_name}")
        while data:
            new_player.stream.write(data)
            data = new_player.wav_file.readframes(new_player.chunk_size)
    new_player.wav_file.rewind()
    new_player.stream.stop_stream()
    new_player.close()

for some reason as im running the code for 10 times, 1-3 out of the 10 iterations doesn’t actually play the sound on the speaker, am i missing something?

Hi irmir10,

Which device/interface is used for the playback ? (Is it HDMI/USB/I2S?)

Also, what is the playback duration of this clip (test.wav)? Is it possible to attach the clip here?

Thanks,
Sharad

Hi Sharad,

The device used for playback is mobile speaker through a USB to 3.5mm jack.

the playback clip is a 0.66 sec generic buzzing sound.

Thanks,

Could you please try below:

  • Back to back playback with a longer duration clip (~2 sec).
  • Add sleep/delay between close and start of the player.

Thanks,
Sharad

I have tried putting a 2sec sleep and it still skipped.
And the sound has to be 0.66 sec