hamiltron/py-simple-audio

Wave that works through aplay. simpleaudio reports "Unable to get period size for PLAYBACK: Invalid argument"

mankyd opened this issue · 0 comments

Running on a RaspberryPi Zero using i2s sound.

  1. I downloaded a random wave I found (CantinaBand60.wav: https://www2.cs.uic.edu/~i101/SoundFiles/).
  2. Tested it with aplay CantinaBand60.wav. It works fine.
  3. Tried it with simpleaudio and I get an error:
ALSA lib pcm.c:8591:(snd_pcm_set_params) Unable to get period size for PLAYBACK: Invalid argument
Exception in thread sound:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/dave/clock/clock/hardware/sound.py", line 28, in _run
    player = self._wav.play()
  File "/home/dave/clock/lib/python3.7/site-packages/simpleaudio/shiny.py", line 20, in play
    self.bytes_per_sample, self.sample_rate)
  File "/home/dave/clock/lib/python3.7/site-packages/simpleaudio/shiny.py", line 61, in play_buffer
    sample_rate)
_simpleaudio.SimpleaudioError: Error setting parameters. -- CODE: -22 -- MSG: Invalid argument

I've seen this on other wave's as well, however, some wave's seem to work fine. I don't know what makes the difference.

Happy to provide whatever other details you may require.