Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Playing Audio With Intel Edison

DZone's Guide to

Playing Audio With Intel Edison

Learn how to play an audio file with Edison by connecting it to Bluetooth speakers.

· IoT Zone
Free Resource
            

Intel Edison has onboard Wi-Fi and Bluetooth. This is one of my favorite IoT boards, as it never disappoints me. Recently I wanted to play some sound with an Edison in one of my projects so I thought I'd give its Bluetooth functionality a try and it was easier than I thought. 

Requirements

  • Intel Edison with Arduino Expansion board
  • Bluetooth Speakers
  • USB cables

Connections

Connect your Edison to PC and also establish a serial communication. As we are connecting through Bluetooth our Edison will work in Device Mode. If you are using a USB sound card and headsets you need to switch it to host mode, in that case this article won’t be much helpful to you.

SetUp

Connect to Edison with Putty, then enter your username and password. The default username is root, with no password.

5

Make sure your Bluetooth speakers is turned on. Now type these commands:

root@edison:~# rfkill unblock bluetooth
root@edison:~# bluetoothctl

6
You will enter the Bluetooth control mode. Scan the Bluetooth device:

[bluetooth] scan on

You will see your device listed. Find your device and Pair it.

[bluetooth] pair 30:21:85:A1:46:3D

Sometimes device does not automatically connect, so you need to run another command to connect it.

[bluetooth] connect 30:21:85:A1:46:3D

8

Exit the Bluetooth Manager.

[bluetooth] quit

Now let us verify that our device is recognized in pulse audio as a sink device and if everything goes fine you will see it listed as bluez_sink

pactl list sinks

Configure the default sink to use pulse audio server with the following command, replacing with the details of your device

9

pactl set-default-sink bluez_sink. 30_21_85_A1_46_3D

Now we are almost done. Let us run the audio file using gStreamer. I have already copied an audio file to my Edison using FileZilla.

Run this command and also replace the file name and location.

10

gst-launch-1.0 filesrc location= /home/root/Songs/SanamRe.wav ! wavparse ! pulsesink

If everything goes fine you will notice song playing via your Bluetooth speakers. Enjoy your new music player!

11

References:

Topics:
audio ,edison

Published at DZone with permission of Pooja Baraskar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}