Closed nicedevil007 closed 8 years ago
@nicedevil007 your alsa-config looks correct and you have the loopback enabled, read this and test gstreamer without python first: https://github.com/RanzQ/hyperion-audio-effects/issues/9#issuecomment-114837353
There might some other answers on that issue that could help too.
I've got a Pi2 lying aroung so I could install OSMC and try it myself but currently I'm too busy. :)
You can also debug the volumes by changing this line, set quiet=False
.
And you should start getting peak and decay levels like this:
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
Also make sure you music application uses default audio output, the alsa config then splits the audio stream to your HDMI and the loopback (and this python app listens for the loopback stream).
It doesn't seem to work for me neither now (I get only 0 levels), maybe some update has broken it or then my alsa-setup is fked up.
Like you said, I tested it with quiet=False
but it ends up like you wrote above.
root@Pi:/opt/hyperion# python main.py --config=/etc/hyperion.config.json --effect vumeter
Exit by typing 'x' or 'exit'
[79, 80, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 62, 63]
[14, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 30]
(0, 255, 0)
(255, 0, 0)
[(0, 255, 0), (13, 241, 0), (26, 228, 0), (40, 214, 0), (53, 201, 0), (67, 187, 0), (80, 174, 0), (93, 161, 0), (107, 147, 0), (120, 134, 0), (134, 120, 0), (147, 107, 0), (161, 93, 0), (174, 80, 0), (187, 67, 0), (201, 53, 0), (214, 40, 0), (228, 26, 0), (241, 13, 0)]
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
0.000 | 0.000 | 0.000 | 0.000
Mhhh i also tryed your Gui command from your mentioned post
root@Pi:/opt/hyperion# python main.py --effect vumeter --config /etc/hyperion.config.json --gui
Traceback (most recent call last):
File "main.py", line 197, in <module>
main()
File "main.py", line 174, in main
from devkit import gui
File "/opt/hyperion/devkit/gui.py", line 15, in <module>
master = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
[79, 80, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 62, 63]
[14, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 30]
(0, 255, 0)
(255, 0, 0)
[(0, 255, 0), (13, 241, 0), (26, 228, 0), (40, 214, 0), (53, 201, 0), (67, 187, 0), (80, 174, 0), (93, 161, 0), (107, 147, 0), (120, 134, 0), (134, 120, 0), (147, 107, 0), (161, 93, 0), (174, 80, 0), (187, 67, 0), (201, 53, 0), (214, 40, 0), (228, 26, 0), (241, 13, 0)]
Traceback (most recent call last):
File "/opt/hyperion/effects/spectrum_dump.py", line 308, in on_message
self.callback(magnitudes)
File "/opt/hyperion/effects/vumeter.py", line 89, in receive_magnitudes
self.update_leds()
File "/opt/hyperion/effects/vumeter.py", line 130, in update_leds
right = self.mag_to_idx(self.magnitudes[2])
IndexError: list index out of range
then i tryed color_spectrum
root@Pi:/opt/hyperion# python main.py --effect color_spectrum --config /etc/hyperion.config.json --json --host 127.0.0.1 --port 19444 --gui
Traceback (most recent call last):
File "main.py", line 197, in <module>
main()
File "main.py", line 174, in main
from devkit import gui
File "/opt/hyperion/devkit/gui.py", line 15, in <module>
master = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
My LEDs starts to blink i curious way o_O not to any beat or something like this. just in a way that is repeating after a few seconds.
@nicedevil007 --gui
opens a window, so you need a screen attached to your pi (or ssh screen forward). But yeah, there's something broken with gstreamer atm, I'll look into it when I have time.
The blinking is something that occurs for me too, it's some bug with gstreamer (color_spectrum effect uses fft instead of volume levels).
UPDATE: Actually tested again and I just had wrong output selected. Tried with spotify which uses default output and it works as before, I get levels above 90:
92.577 | 95.656 | 92.716 | 95.874
92.673 | 95.371 | 93.394 | 95.660
90.040 | 95.014 | 90.913 | 95.303
90.618 | 94.656 | 93.293 | 94.946
91.435 | 94.299 | 91.228 | 94.589
91.909 | 93.942 | 91.457 | 94.231
89.604 | 93.585 | 93.302 | 93.874
92.900 | 93.228 | 91.466 | 93.517
i have the same configuration like @nicedevil007 and it works if i change the audio output in Kodi directly to the loopback device and than use this command line:
osmc@osmc:/usr/local/src/hyperion-audio-effects$ python main.py --config=/opt/hyperion/config/hyperion.config.json --effect=color_spectrum --json
so i get outputs like this
75.326 | 79.194 | 75.920 | 79.184
71.531 | 79.194 | 71.319 | 79.184
69.917 | 79.194 | 65.843 | 79.184
76.072 | 79.194 | 75.122 | 79.184
74.984 | 79.194 | 75.162 | 79.184
66.977 | 79.051 | 68.140 | 79.041
x68.681 | 78.694 | 65.949 | 78.684
74.393 | 78.337 | 74.327 | 78.327
with the vumeter
effect i got no effect - has something to do with the low level?
are you sure thats our .asoundrc
is really match the aplay -l
output?
my loopback device does not work if i switch in Kodi to the alsa default output - but i have still sound on HDMI (also with DTS/AC3 over passtrough)
last question: should it work without the --json parameter
?
@b2un0 Sorry I've adjusted the effect levels to fit my setup. In effects/vumeter.json
you can adjust yours (if volume is already max in Kodi). I should make the levels self-adjusting but for now they are in config. Try first with min-level 0 and max-level 100. My levels varied from 90 to 100 so I set those limits to see more movement in leds. :)
I also had some problems with sound from Kodi (I have a custom linux HTPC) but I use Spotify for music and Kodi for videos only. And I don't use the alsa config anymore since I have elementary OS now instead of Kodibuntu, which has pulseaudio by default. It might take more CPU and have worse sound quality but it's a lot easier to config. Wouldn't recommend it for Pi though.
I think Kodi just doesn't support dual audio (I mean HDMI and Loobpack at the same time): https://discourse.osmc.tv/t/usb-and-hdmi-audio-at-the-same-time/10966/7
Try with some sound file first to see if the alsa config is ok: aplay somemusic.mp3
If that works, then the problem is within Kodi and I don't think it can be solved.
The --json
parameter tells to use hyperion json connection, so yes it must be used. WIthout it you can only see the effect in emulator with --gui
. See python main.py --help
for all options.
My suggestion is to buy a decent HTPC. :)
I've tested with RPi 2 and OSMC, works ok. Not the same performance as a decent PC though. Added instructions to readme.
Thx RanzQ!
Will test it until i find some time :)
Is it realy slow or just not as fast as on PC? I mean, slow as not useable.
@nicedevil007 @b2un0 Actually I've now confirmed the same you did. The loopback setup does not work from Kodi / OSMC. I have no idea why, alsa should split the stream when the "ALSA: default" is selected but wit Kodi I get sound or effect only, not both.
But it is possible to play music with effect using mpd
or some other player. I modified the default settings so that it is usable on Pi 2. CPU usage is high but it doesn't look bad. :)
Hey RanzQ,
tryed a couple times to get your audio-effects working. Some other german mates are trying as well, but we can't get into it.
Maybe you could help a bit out?
first:
my hyperion config is located @ /etc/hyperion.config.json the location of hyperion is /opt/hyperion
I moved all of your files into this folder.
my /etc/modprobe.d/alsa-base.conf doesn't exists before i put in "snd-aloop index=-2". This is the whole content of this file now
the .asoundrc was put into /root this is what aplay -l tells me
if i understand everything right, i have to put in the soundcard i'm actually using, so card 0, device 1 (HDMI).
here the content of .asoundrc
alsa force-reload doesn't run :( i installed it this way
running your python script looks like this now.
Dunno what am I doing wrong. hyperion is just working like it does if i'm watching TV or a movie.