Message Boards Message Boards


Does sound work on the Raspberry Pi?

Posted 10 years ago
12 Replies
10 Total Likes
Simple question: is Mathematica supposed to be able to make sound on the Raspberry Pi?

it doesn't on mine, and I see a bunch of stuff on the web about alsa and oss.  Are we supposed to hack this to get it work?
12 Replies
Posted 10 years ago
I would really appreciate it if someone coult explain specifically how to get Mathematica to send out MIDI data through the USB port of a Raspberry Pi.

POSTED BY: David Jameson

Hello David! I apologize if this is a little late.

As others have said, the Sound, EmitSound, and Speak functions work on the Pi version of MMA. These functions, along with Import, can be used to edit and play MIDI tracks in MMA. To route the output of these functions or a MIDI file to a USB audio device, you need to edit the configuration files on the Pi to use your USB device rather than the HDMI port or headphone jack. This article gives a pretty good guide to doing exactly this. Note that you'll probably have to power-cycle your Pi after changing any config files and please back up everything you edit before making changes!


POSTED BY: Brett Haines
I got my Raspi Model B yesterday, and installed MMA on it. As mentioned in the earlier discussions on this thread, none of Speak[], EmitSound[] produces sound. I connected an ear phone to the audio jack and set the "hdmi_ignore_edid_audio=1" in /boot/config.txt but that did not help either. Didn't this issue comeup during internal testing? 

Another question: Why is MMA (GUI app) not appearing in the Start menu under Education? Why only "Wolfram"?

OK, I continued my search for a solution, and found this page to be helpful:

I forced the audio port to be the analog jack. Now, Sound[], EmitSound[] and Speak[] work as expected.

Play[] does not work (this has been mentioned here before).

Sound objects produced by Play do not emit sound in the initial Pi release. This will be fixed in a future update. 
POSTED BY: Alex Newman
Posted 10 years ago
sorry, i should have been more specific - i'm trying to use the Play[] function. and other programs (eg. scratch) are able to play sound.
sudo amixer cset numid=3 1
forces the audio to the headphone jack, even with the HDMI video output plugged in.
If I do that, Speak["test"] works but EmitSound and Play do not.
I'm using Model B
POSTED BY: Frank Kampas
Another good thing worth looking at would be the Raspberry Pi config.txt read at boot.  

Specifically, the hdmi_ignore_edid_audio=1 option sems relevant as it should tell ALSA that the only available audio is analog, no matter what the display says. 
POSTED BY: Alex Newman
After doing an internet search, I think the reason I'm not hearing any sound from the audio output jack is that I'm using an HDMI monitor that doesn't have speakers in it.  It seems that the sound output only goes to the HDMI output if it is used.
POSTED BY: Frank Kampas
Frank, did you try things like


- did these lines work? Could you also please let us know what your RPi model is.
POSTED BY: Moderation Team
I was not able to get sound to work from Mathematica on Raspberry Pi.
POSTED BY: Frank Kampas
There are no technical limitations with the Pi or Mathematica currently barring the Raspberry Pi from playing sound (through its analog audio port or HDMI). The functions Speak[] and EmitSound when applied to SoundNote[] objects (midi) work today. Sound is under very active development in Mathematica in general, so the playback of waveform audio is not currently functioning as documented in the Pi release due to the snapshot nature of our initial release. This should be addressed soon in an update. 

You're not expected to hack it but you certainly can if you wish to (it should be quite possible to override the sound functions in Mathematica and many have). 
POSTED BY: Alex Newman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract