Has anyone had any luck with the sound library on the pi 0?


#1

Hello everyone
According to https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio
there is a way to play audio out of the pi 0. I tried to reproduce it, followed all the instructions, and even though the monitor window on the pi tells me the audio is playing, I am not hearing anything. So I thought, mmmhhh I am pretty good with Processing so let me see if I can write a simple sketch on the pi to see if this is actually feasible.
Well the Processing compiler tells me that “Sound” is not a class, that it does not recognize commands like “void” or that the void draw () is missing a ; (when I know it is not)
Hence now I am wondering if there is not a larger issue where the library did not download properly or what?
Has anyone had similar errors and how did they solve it ?


#2

@gwenn A lot of the parts on the Raspberry Pi are still in some level of flux, as the software stack matures. On all versions but the Pi Zero, audio playback works sufficiently okay - e.g. with Processing’s Sound library (which you can find, with examples, in the Contributions Manager). But it seems the (PWM-based) sound is at least not officially supported on the Zero, since it doesn’t have a the jack (or the internally connected header pins exposed).

I know, USB ports are at an abolute premium on this device as well, but my suggestion would be to simply get a supported, cheap USB sound card. This way you’ll have clean(er) playback, and also a handy microphone port.


#3

Hi Gottfried, thanks for your reply. OK but how is the USB sound card going to fix the issues with the Processing library? My issue at the moment is that the Processing compiler does not recognize many of the standard function in Processing (void, etc), when used on the pi 0.


#4

Hi @gwenn - Processing on the Pi Zero should behave exactly the same as on another board or platform. When you’re seeing an error complaining that Sound is not a class, this would indicate to me that the Sound library is perhaps not installed? (You find it for download in the Contributions Manager.)

Perhaps you could try some of the examples that come with the Sound Library on their own, to ensure that this works. Compilation errors like this shouldn’t have any connection to which hardware you have connected, but they might point to something else (libraries, sketch) being amiss.


#5

Thanks Gotfried. I am going to re-install the library then (or perhaps install it) because I had troubles installing Processing (initially) hence perhaps the library did not get installed in the end? I have tried the basic sound example and I am still getting compiler errors

Thanks again

Gwenn-Aël LYNN
http://gwennaellynn.com
US, cell: + 1 (773) 885 9507
France, cell (mobile): + 33 (0)6 25 23 65 58
France, landline (fixe): + 33 (0)1 77 10 59 74
Skype: gwenn.ael.lynn


#6

Oh duh! I overlooked this when I installed P5 on the pi. That would explain everything (so dumb from me) “The Video and Sound libraries need to be downloaded through the Library Manager.”

Gwenn-Aël LYNN
http://gwennaellynn.com
US, cell: + 1 (773) 885 9507
France, cell (mobile): + 33 (0)6 25 23 65 58
France, landline (fixe): + 33 (0)1 77 10 59 74
Skype: gwenn.ael.lynn