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

Visualization Stuck #40

Closed 5eed closed 4 years ago

5eed commented 5 years ago

This affects 0 volume inputs , e.g. from virtual audio devices (direct playback from audio output). Occured while routing audio with Volume Control from PulseAudio in Linux.

Affected Code in ledfx/effects/audio.py: self._volume = aubio.db_spl(self._raw_audio_sample) self._volume_filter.update(self._volume) - line 155-156

If you look up aubio.db_spl function https://aubio.org/manual/latest/py_utils.html, it is calculating the Sound Pressure Level by using log - resulting in -inf, if 0 input volume is provided, which is then used to update the volume_filter

Once -inf is applied to ExpFilter Implementation of Scott Lawson it will keep this value, even if volume rises again after an 0 volume intput (song change, ...) -> disabling all further audio processing, since -inf is always smaller than the min_volume (default -70)

if self._volume_filter.value > self._config['min_volume']: #process audio

Possible Solution: Add a check between lines 155 to 156: if self._volume < self._config['min_volume']: self._volume = -0.1 # set it to other value than -inf

richyxi commented 5 years ago

Hi men, does it work for you?

El mar., 21 de mayo de 2019 16:23, 5eed notifications@github.com escribió:

This affects 0 volume inputs from virtual audio devices, possibly occuring while routing your audio with Volume Control from PulseAudio in Linux.

Affected Code in ledfx/effects/audio.py: self._volume = aubio.db_spl(self._raw_audio_sample) self._volume_filter.update(self._volume) - line 155-156

If you look up aubio.db_spl function https://aubio.org/manual/latest/py_utils.html http://url, it is calculating the Sound Pressure Level by using log - resulting in -inf if 0 input volume is provided, which is then used to update the volume_filter

Once -inf is applied to ExpFilter Implementation of Scott Lawson it will keep this value, even if volume rises again after an 0 volume intput (song change, ...) -> disabling all further audio processing, since -inf is always smaller than the min_volume (default -70)

if self._volume_filter.value > self._config['min_volume']:

Possible Solution: Add a check between lines 155 to 156: if self._volume < self._config['min_volume']: self._volume = -0.1 # set it to other value than -inf

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahodges9/LedFx/issues/40?email_source=notifications&email_token=ALHKYG3PNVQ4XUKLXSJW633PWRR4FA5CNFSM4HOO2VL2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GVCDTOA, or mute the thread https://github.com/notifications/unsubscribe-auth/ALHKYG5UVSFZ7A24QFMSLLDPWRR4FANCNFSM4HOO2VLQ .

5eed commented 5 years ago

You mean the visualization in general or the suggested fix? - Works both for me

richyxi commented 5 years ago

Cool, I need to try this!

El dom., 26 de mayo de 2019 10:03, 5eed notifications@github.com escribió:

You mean the visualization in general or the suggested fix? - Works both for me

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ahodges9/LedFx/issues/40?email_source=notifications&email_token=ALHKYGYC3WQ2KAVAQQMDO23PXKRE5A5CNFSM4HOO2VL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWIHSBA#issuecomment-496007428, or mute the thread https://github.com/notifications/unsubscribe-auth/ALHKYG422RO2NORXWQ7YXCLPXKRE5ANCNFSM4HOO2VLQ .

spattinson commented 5 years ago

This fixes my issue of getting no output at all on any of the audio reactive effects apart from gradient and one other. Thanks

ahodges9 commented 4 years ago

Thanks! Fixed in the dev branch should be integrating dev into master soon