Instead of listening in on the action, maybe you'd like to be the one creating all the noise by making the Pi an extension of your own voice. You'll be on a computer with a microphone, and the Pi can be somewhere else broadcasting your message to the world through a pair of speakers (or a megaphone). In other words, the roles of the Pi and your computer from the previous topic will be reversed.
First, make sure SoX is added to Windows as per the instructions in the Listening in Windows section:
cmd
in the Run/Search field.C:> "C:Program Files (x86)sox-14-4-2sox" -d -d
C:> "C:Program Files (x86)sox-14-4-2sox" -d -t wav - | "C:Program Files (x86)PuTTYplink" pi@[IP address] -pw [password] sox -q -t wav - -d
My Song.mp3
from your desktop to be played out of the speakers connected to the Pi:C:> type "%UserProfile%DesktopMy Song.mp3" | "C:Program Files (x86)PuTTYplink" pi@[IP Address] -pw [password] sox -t mp3 - -d
My Album
folder on the desktop:C:> type "%UserProfile%DesktopMy Album*.mp3" | "C:Program Files (x86)PuTTYplink" pi@[IP Address] -pw [password] sox -t mp3 - -d
First make sure SoX is added to your operating system as per the instructions in the Listening in Mac OS X or Linux section:
alsamixer
./Applications/Utilities
on the Mac).$ sox -d -d
$ sox -d -t sox - | ssh pi@[IP address] sox -q -t sox - -d
You'll likely be flooded with warnings from the CoreAudio driver while SSH is waiting for you to input your password for the pi
user. Just ignore the messages, type in your password anyway, and press the Enter key-the recording will proceed as normal:
My Song.mp3
from your desktop to be played out of the speakers connected to the Pi:$ cat ~/"Desktop/My Song.mp3" | ssh pi@[IP address] sox -t mp3 - -d
My Album
folder on the desktop:$ cat ~/"Desktop/My Album/"*.mp3 | ssh pi@[IP address] sox -t mp3 - -d
Using Bluetooth makes it easy to be mischievous by using the techniques explored in the Listening over Bluetooth section. For example, you could set your Pi to remotely connect to the Bluetooth sound-bar connected to your TV in the living room, with you sitting in another room projecting your voice by speaking into the microphone attached to your Pi's soundcard.
Or, if your Pi is an integral part of the furniture in a particular room, you could use a Bluetooth headset with a microphone to send audio to a speaker connected to the Pi's jack output.
To do this, we need to tell PulseAudio what our default sound source and output is, and simply run the SoX monitoring loop again.
If PulseAudio isn't already running, then start it with:
pi@raspberrypi ~ $ pulseaudio --start
The following command will set your Pi's default audio output to the jack plug:
pi@raspberrypi ~ $ pactl set-default-sink alsa_output.0.analog-stereo
With my headset connected to the Pi (which has a built-in mic), I can find the source device name, according to PulseAudio, using:
pi@raspberrypi ~ $ pacmd list-sources short | grep -e 'name:'
In my case, this is:
bluez_sink.00_03_89_93_8D_B4.monitor
To set this as the default audio input device, use this command:
pi@raspberrypi ~ $ pactl set-default-source bluez_sink.00_03_89_93_8D_B4.monitor
Set up the monitor loop to use the default devices and start talking:
pi@raspberrypi ~ $ sox -d -d
18.119.131.10