Previous posts for this project:
- Sci Fi Your Pi: PiDesk - Project Description
- Sci Fi Your Pi: PiDesk - Project Update #1
- Sci Fi Your Pi: PiDesk - Guide: Setting Up the Raspberry Pi 2
- Sci Fi Your Pi: PiDesk - Project Update #2
- Sci Fi Your Pi: PiDesk - Review: Bare Conductive Touch Board
- Sci Fi Your Pi: PiDesk - Project Update #3
- Sci Fi Your Pi: PiDesk - Guide: Stepper Motors with Gertbot
- Sci Fi Your Pi: PiDesk - Project Update #4
- Sci Fi Your Pi: PiDesk - Project Update #5
- Sci Fi Your Pi: PiDesk - Guide: Controlling NeoPixels with the Raspberry Pi A+/B+
- Sci Fi Your Pi: PiDesk - Project Update #6
- Sci Fi Your Pi: PiDesk - Project Update #7
- Sci Fi Your Pi: PiDesk - Project Update #8
- Sci Fi Your Pi: PiDesk - Project Update #9
- Sci Fi Your Pi: PiDesk - Guide: Capacitive Touch with Atmel's AT42QT1070 Touch Sensor IC
- Sci Fi Your Pi: PiDesk - Project Update #10
- Sci Fi Your Pi: PiDesk - Guide: Magic Lamp with wireless charger, Adafruit Trinket & NeoPixels
- Sci Fi Your Pi: PiDesk - Project Update #11
- Sci Fi Your Pi: PiDesk - Project Update #12
- Sci Fi Your Pi: PiDesk - Project Update #13
- Sci Fi Your Pi: PiDesk - Project Update #14
- Sci Fi Your Pi: PiDesk - Project Update #15
- Sci Fi Your Pi: PiDesk - Project Update #16
- Sci Fi Your Pi: PiDesk - Guide: Endstops with Gertbot
- Sci Fi Your Pi: PiDesk - Project Update #17
- Sci Fi Your Pi: PiDesk - Project Update #18
Project Update
Problem!
I was testing the combination of audio and light effects today, only to find out that they are affecting each other!
Playing audio messes up the animations and the LED strip starts blinking randomly. There is also a nasty jitter in the audio output. I don't know the exact cause of the problem, I just hope it won't affect anything else ... There's a video at the bottom of this post, demonstrating the problem.
Solution?
The current workaround involves a USB sound card. It's a super cheap, low quality sound card I got from eBay for about $2, which I had around. The device is plug an play, and all that is required is to specify it as the output device when playing out sound files.
Listing the device, ensuring it is detected properly:
pi@PiDesk ~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
It is the last one in the list, card 1, device 0. These are the two parameters required when playing out, using the "-D" option:
pi@PiDesk ~ $ aplay -D hw:1,0 example.wav Playing WAVE 'example.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
The workaround is not that nice, but due to the time constraints, I'll stick with that for now. Another disadvantage of this solution is that it requires an extra USB port on the Pi. As I was planning on using the A+ (with a single USB port), I'll either have to use a USB splitter or move to the B+.
Anyway, problem solved for now, let's hope no other surprises pop up ...
Video
A short video demonstrating the problem using the onboard audio, and the solution with USB audio.
Top Comments