You can configure LightShow Pi to use the input from a USB audio dongle as the audio your lights respond to (i.e. instead of playing local audio files). There are many applications that this can be used for, one of which is for adding a light show to an existing karaoke setup:
USB Audio Input Setup
First, you’ll need a USB audio sound card in hand. You can find lists of compatible devices here. One USB audio card that is known to work just fine is the Sabrent AU-MMSA.
Next, you’ll want set your USB audio sound card as the default soundcard following the instructions here*.
* The instructions above refer to a file that no longer exists in newer installs. If you do not find the file /etc/modprobe.d/alsa-base.conf
then instead you need to update the file /usr/share/alsa/alsa.conf
and change:
defaults.ctl.card 0 defaults.pcm.card 0
To
defaults.ctl.card 1 defaults.pcm.card 1
LightShow Pi configuration
To enable audio-in mode, set the lightshow mode to audio-in in your configuration override file (e.g. ~/.lights.cfg):
[lightshow] mode = audio-in
There are other advanced options related to audio-in mode, take a look at the default configuration file for more details (search for “audio-in”).
Running in Audio-In mode
Once you’ve enabled audio-in mode, you can run the synchronized lights script to start things up:
sudo python py/synchronized_lights.py
This is now out of date I believe. Now you have to go to /usr/share/alsa/alsa.conf and change :
defaults.ctl.card 0
defaults.pcm.card 0
To
defaults.ctl.card 1
defaults.pcm.card 1
Yup, thanks! Will update the info here.
Running in Audio-In mode
Once you’ve enabled audio-in mode, you can run the synchronized lights script to start things up:
sudo py/synchronized_lights.py
This command no longer works, replace with :
sudo python py/synchronized_lights.py
Thanks for the fix, I’ve updated the command above.
Hi Ken I am working on audio-in feature (its damn cool )
I am facing a problem.
My mic capture works perfectly with command
————-
arecord –device=hw:1,0 –format S16_LE -vv –rate 44100 -c1 test.wav
aplay –device=plughw:1,0 test.wav
————
but when I start lightshow with audio in mode the speaker noise get cracked and it hears like audio is fast forwarded.
I guess there’s problems when lightshow program reads data from mic.
Alsa-base.conf file not in “etc/modprobe.d/”
Trying to comment out “options snd-usb-audio index =-2” as that’s what this guide I was linked to is telling me to do if I want to use my USB audio card interface:
Problem is, when I go to the directory, when I “ls -a” I don’t see the file anywhere.
Any ideas about how to solve this?
Thank you so much in advance!
Ah, looks like things have moved around on us, see this post for details on a solution:
https://plus.google.com/u/0/112801616065459310852/posts/aTxRbKj5Sza
It seems like this ought to work with a usual USB Microphone. Is that true?
Yes it should!
Hi, i am getting this error, my sound card is AXAGO ADA-20, Thanks.
Traceback (most recent call last):
File “py/synchronized_lights.py”, line 139, in
import hardware_controller as hc
File “/home/pi/Downloads/lightshowpi/py/hardware_controller.py”, line 55, in
cm = configuration_manager.Configuration()
File “/home/pi/Downloads/lightshowpi/py/configuration_manager.py”, line 95, in __init__
self.set_lightshow()
File “/home/pi/Downloads/lightshowpi/py/configuration_manager.py”, line 243, in set_lightshow
lghtshw[“songname_command”] = self.config.get(ls, ‘songname_command’)
File “/usr/lib/python2.7/ConfigParser.py”, line 340, in get
raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option ‘songname_command’ in section: ‘lightshow’
This is my soundcard configuration
Simple mixer control ‘Speaker’,0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left – Front Right
Limits: Playback 0 – 151
Mono:
Front Left: Playback 44 [29%] [-20.13dB] [on]
Front Right: Playback 44 [29%] [-20.13dB] [on]
Simple mixer control ‘Mic’,0
Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined
Playback channels: Mono
Capture channels: Mono
Limits: Playback 0 – 32 Capture 0 – 16
Mono: Playback 23 [72%] [34.36dB] [off] Capture 0 [0%] [0.00dB] [on]
Simple mixer control ‘Auto Gain Control’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
The error isn’t related to the soundcard, but your configuration file, what changes have you made there? I’d suggest starting with a default one again, and working from there.
Hey there,
I’ve tried to set up audio streaming through audio-in using a Sabrent AU-MMSA USB audio card. Whenever I run the song through the mic input there’s a distorted crackling that causes lightshow pi to shut down after like 5 seconds. Did anyone experience that already? If yes, how did you fix it?
Thanks
Hey,
I am getting an error trying to use the audio-in function. The light turns white and after a couple of seconds it stops and the following error occurs on screen.
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition ‘defaults.pcm.card’
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib confmisc.c:251:(snd_func_getenv) error evaluating default
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_getenv returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File “py/synchronized_lights.py”, line 965, in
lightshow.play_song()
File “py/synchronized_lights.py”, line 805, in play_song
self.setup_audio()
File “py/synchronized_lights.py”, line 622, in setup_audio
self.set_audio_device()
File “py/synchronized_lights.py”, line 321, in set_audio_device
output_device = aa.PCM(aa.PCM_PLAYBACK, aa.PCM_NORMAL, cm.lightshow.audio_out_card)
alsaaudio.ALSAAudioError: No such file or directory
thanks in advance
nervermind. i fixed it. i accidently commented the defaults.pcm.card line
it works great. thx very much to everyone who worked on this for creating such an amazing software!
Glad it’s working for you!
Hello,
i am trying to use the usb audio-in but its keep saying this error
Traceback (most recent call last):
File “py/synchronized_lights.py”, line 959, in
lightshow.audio_in()
File “py/synchronized_lights.py”, line 432, in audio_in
data = stream_reader()
File “py/synchronized_lights.py”, line 341, in
stream_reader = lambda: self.streaming.read()[-1]
alsaaudio.ALSAAudioError: Capture data too large. Try decreasing period size
this is same problem with this thread in google plus “https://plus.google.com/+Piotr%C5%BBmiejewski/posts/VBDwgdjeFuE”
Try reducing chunk_size in your overrides.cfg file to 1024 (from 2048).
Thanks todd! 😃 1024 didn’t work haha! But i reduced it to 512 and it works! 😂
when go to save the usr/share/alsa/also.conf it says can’t open file to save
The file is
/usr/share/alsa/alsa.conf
– you need the initial forward slash in front of usr.when I go to run my light show I also get an error. it reads: alsaaudio.ALSAAudioError: No such file or directory…does this mean I have an install missing?
when i am trying to run the lights it shows me this eror:
Traceback (most recent call last):
File “py/synchronized_lights.py”, line 82, in
import mutagen
ImportError: No module named mutagen
Please visit https://www.reddit.com/r/LightShowPi/ for support.