ahodges9 / LedFx

LedFx is a network based LED effect controller with support for advanced real-time audio effects! LedFx can control multiple devices and works great with cheap ESP8266 nodes allowing for cost effectvice syncronized effects across your entire house!
MIT License
387 stars 90 forks source link

Select audio input? #31

Closed t413 closed 5 years ago

t413 commented 5 years ago

Hey, on my Odroid device the default audio device doesn't seem to work for input. Doesn't look like there's a config value for specifying one in particular.

I've used arecord -L to list my devices and arecord -D plughw:CARD=Device,DEV=0 -f cd -d 0 -vv /dev/null to test monitoring the levels with success.

t413 commented 5 years ago

Here's what happens when I try and enable an audio reactive effect:

[2019-02-12 09:40:20] INFO:ledfx.core:Starting ledfx Started webinterface at http://127.0.0.1:8888 [2019-02-12 09:40:20] INFO:ledfx.utils:Importing ['ledfx.devices.e131', 'ledfx.devices.udp'] from ledfx.devices [2019-02-12 09:40:20] INFO:ledfx.utils:Importing ['ledfx.effects.audio', 'ledfx.effects.beat', 'ledfx.effects.energy', 'ledfx.effects.gradient', 'ledfx.effects.math', 'ledfx.effects.mel', 'ledfx.effects.pitchSpectrum', 'ledfx.effects.rainbow', 'ledfx.effects.scroll', 'ledfx.effects.spectrum', 'ledfx.effects.temporal', 'ledfx.effects.wavelength'] from ledfx.effects [2019-02-12 09:40:20] INFO:ledfx.devices:Loading device from config: {'config': {'center_offset': 0, 'channel_count': 24, 'channel_offset': 0, 'force_refresh': False, 'ip_address': '192.168.1.180', 'max_brightness': 1.0, 'name': 'First', 'pixel_count': 8, 'preview_only': False, 'refresh_rate': 60, 'universe': 1, 'universe_end': 1, 'universe_size': 512}, 'id': 'first', 'type': 'e131'} [2019-02-12 09:40:31] INFO:ledfx.effects:Effect Wavelength config updated to {'gradient_roll': 0, 'blur': 3.0, 'flip': False, 'gradient_name': 'Spectral', 'mirror': False}. [2019-02-12 09:40:31] INFO:ledfx.effects.audio:Activating AudioReactiveEffect. [2019-02-12 09:40:31] INFO:ledfx.effects:Effect Wavelength activated. ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.front.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM front ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround51.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround51.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround40.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround40 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround51.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround41 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround51.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround50 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround51.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround51 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.surround71.0:CARD=0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround71 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM iec958 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.Odroid-XU4.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline [2019-02-12 09:40:31] INFO:ledfx.effects.audio:Audio Input Devices: [2019-02-12 09:40:31] INFO:ledfx.effects.audio: [1] HD Pro Webcam C920: USB Audio (hw:1,0) [2019-02-12 09:40:31] INFO:ledfx.effects.audio: [2] USB PnP Sound Device: Audio (hw:2,0) Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514 Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818 [2019-02-12 09:40:31] ERROR:aiohttp.server:Error handling request Traceback (most recent call last): File "/home/timo/.local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start resp = await self._request_handler(request) File "/home/timo/.local/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle resp = await handler(request) File "/home/timo/.local/lib/python3.6/site-packages/ledfx/api/init.py", line 26, in handler return await method(*{arg_name: available_args[arg_name] for arg_name in wanted_args}) File "/home/timo/.local/lib/python3.6/site-packages/ledfx/api/device_effects.py", line 50, in put device.set_effect(effect) File "/home/timo/.local/lib/python3.6/site-packages/ledfx/devices/init.py", line 49, in set_effect self._active_effect.activate(self.pixel_count) File "/home/timo/.local/lib/python3.6/site-packages/ledfx/effects/audio.py", line 437, in activate self._audio_data_updated) File "/home/timo/.local/lib/python3.6/site-packages/ledfx/effects/audio.py", line 117, in subscribe self.activate() File "/home/timo/.local/lib/python3.6/site-packages/ledfx/effects/audio.py", line 99, in activate stream_callback = self._audio_sample_callback) File "/home/timo/.local/lib/python3.6/site-packages/pyaudio.py", line 750, in open stream = Stream(self, args, kwargs) File "/home/timo/.local/lib/python3.6/site-packages/pyaudio.py", line 441, in init self._stream = pa.open(arguments) OSError: [Errno -9998] Invalid number of channels [2019-02-12 09:41:13] INFO:ledfx.api.websocket:Websocket connected. [2019-02-12 09:41:13] INFO:ledfx.api.websocket:Starting sender [2019-02-12 09:41:13] INFO:ledfx.api.websocket:Websocket subscribing to event device_update with filter {'device_id': 'first'} [2019-02-12 09:41:15] INFO:ledfx.api.websocket:Connection closed by client. [2019-02-12 09:41:15] INFO:ledfx.api.websocket:Stopping sender [2019-02-12 09:41:15] INFO:ledfx.api.websocket:Closed connection

t413 commented 5 years ago

Got the solution from @not-matt in the group chat:

audio:
  device_index: 0

It'd be excellent to see it in the documentation! Great to get things running.