You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ev3dev-lang-python version:
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii micropython-ev 2.1.0 all Python language bindings for ev3d
ii python3-ev3dev 1.2.0 all Python language bindings for ev3d
ii python3-ev3dev 2.1.0 all Python language bindings for ev3d
Hi, I'm not able to play audio from a wav file using Sound.play_file. Here's the code:
If I don't include Sound.PLAY_LOOP in play_file, then the program completes successfully, just never playing the audio in Recording.wav. With PLAY_LOOP specified, the script speaks "Hello?" and then runs indefinitely without making another sound.
I also tried specifying the full path to Recording.wav which didn't seem to make any difference. I verified that the file is on the device in the same folder with the script.
Am I doing something wrong, or is this a bug? Attaching a zip file with my small .wav file.
Internally, play_file uses the aplay command. Could you try running this command and see if it is able to play your file? If not, are there any error messages?
Converting to 16-bit mono, 22050 Hz (352,800 bit rate) allowed it to work. Thanks for the quick answer!
Would be awesome to add that format to the documentation.
Activity
WasabiFan commentedon Aug 21, 2020
Internally,
play_fileuses theaplaycommand. Could you try running this command and see if it is able to play your file? If not, are there any error messages?dlech commentedon Aug 21, 2020
Try normalizing the sound to make it as loud as possible. Currently, the peaks are a small fraction of the available range.
Also, 16-bit, mono, 22050Hz sound format works best, otherwise the CPU on the EV3 has to do extra processing to convert the format on the fly.
drew-linerud commentedon Aug 21, 2020
Converting to 16-bit mono, 22050 Hz (352,800 bit rate) allowed it to work. Thanks for the quick answer!
Would be awesome to add that format to the documentation.
Clarify ideal WAV audio format