2

I am thinking of doing a project with my Raspberry Pi. I am going to put the Raspberry Pi near my front door and attach a speaker to its audio output. Then I will go to my Mac and say something into the microphone. I was wondering if there is any way to send this live microphone audio to the Raspberry Pi and output the audio.

asked Jun 27, 2014 at 20:42
3
  • It may be simpler to send a text string to your pi and then have the pi speak the text using (festival atext to speech app). see here for how to install it: raspberrypi.stackexchange.com/questions/1015/…. Once that works you may want to tackle the harder problem of streaming audio to the Pi for playback. Commented Jun 27, 2014 at 21:36
  • 3
    Hopefully you are going to use a powered speaker (amplifyer). The Rpi cannot directly drive a low impedance speaker. Commented Jun 28, 2014 at 14:02
  • you can also try avconv (former ffmeg) and ffserver. i have never used the second one, but i think googling it will yield lots of tutorials. Commented Nov 26, 2014 at 23:17

3 Answers 3

1

I think this is doable you just have to stream the captured audio from your Macbook to the Pi, to do that use arecord and aplay. Using these tools you can stream the audio across a network, so assuming the Pi and Mac are on the same local network this could be quite quick to implement...

The following article is based around using the Pi as a spy tool, but imagine it the other way around, using the Mac as the mic and the Pi as the output - its the same principle and it uses this command to send the audio along the network which looks kinda scary at first but is just piping audio through ssh:

arecord -D plughw:1,0 -f dat | ssh -C user@rpiIPaddress aplay -f dat

See this great post for more...

answered Jun 27, 2014 at 21:43
8
  • so instead of sending from pi to computer I would run the script on my computer and then send it via ssh to the pi? Commented Jun 27, 2014 at 23:23
  • where it says user@rpiIPadress would I just replace it with the Raspberry Pi's IP address? Commented Jun 27, 2014 at 23:24
  • So i would access the raspberry pi remotely via ssh and then execute this code? Commented Jun 27, 2014 at 23:35
  • Yes that's right. Replace with the pi IP address on a local network that will be some thing like 192.168.0.x where x will be another number obviously. There are probably other ways to do what you want namely via radio but as your post said using the mic from your mac ssh seems like the way to go. Commented Jun 28, 2014 at 6:40
  • on m mac when i type this command it says arecord command not found Commented Jun 28, 2014 at 15:33
1

You can make your Pi a BT audio receiver and connect your Mac and Pi together and run a program to real time listen to your microphone. Have the Mac set the audio out to the BT Pi and you should be good. Resources for this can be found

http://www.raspberrypi.org/forums/viewtopic.php?t=26685

http://prupert.wordpress.com/2010/08/02/stream-live-audio-from-a-microphone-in-near-real-time-in-ubuntu/

/OR/

https://askubuntu.com/questions/123798/how-to-hear-my-voice-in-speakers-with-a-mic

answered Sep 25, 2014 at 23:26
0

The simplest way to do this would be to utilise Apple's Airplay technology so that remote audio devices are accessible from most OSX and iOS audio apps. The best way to do this is to install and run shairport-sync on the Pi - Which turns the Pi into a network speaker you can select via Airplay on a OSX or iOS device. You'll have to build it from source on Raspbian, though there are apparently binary packages on ArchLinux for the Pi. There is also an older version of shairport (apt-get install libshairport1) which apparently works but has some issues.

Another approach would be to use jacktrip, or netjack, which work with the JACK audio system which is available for OSX, Linux, and Windows.

It is also possible to use Gstreamer (see related question) and/or ffmpeg to set up streaming audio and video.

answered Mar 25, 2015 at 11:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.