rbn42 / panon

An Audio Visualizer Widget in KDE Plasma
GNU General Public License v3.0
191 stars 31 forks source link

use internal audio system, not only microphone #6

Closed kupiqu closed 4 years ago

kupiqu commented 4 years ago

not sure it is an issue in panon or something that is misconfigured in my system, but if I mute the microphone I don't see any spectrum even though I have audio signals going on.

for the case it is important, my audio system is based on pulseaudio.

rbn42 commented 4 years ago

Can you checkout the latest master branch and try to run the script test/test1.sh? If it works, it shows a colorful image. I mean after you mute the microphone, run this script.

kupiqu commented 4 years ago

Unfortunately the script does not work for me:

bash test1.sh 
Make sure you are playing music when run this script.
You are expected to see a colorful image.
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
config {'fps': 30}
Error in connection handler
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/websockets/server.py", line 116, in handler
    yield from self.ws_handler(self, path)
  File "panon/panon/server.py", line 64, in hello
    await websocket.send(data)
  File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 330, in send
    yield from self.ensure_open()
  File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 422, in ensure_open
    raise ConnectionClosed(self.close_code, self.close_reason)
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1000, no reason.

** (/usr/lib/firefox/firefox): WARNING **: Unable to connect to dbus: Permission Denied
Make sure you are playing music when run this script.
You are expected to see a colorful image.
rbn42 commented 4 years ago

Unfortunately the script does not work for me:

The error was caused by kill. It is expected.

Did you get a colorful image or a black image?

kupiqu commented 4 years ago

I see. I didn't get any image, just an empty page (blank page)

rbn42 commented 4 years ago

OK, I will write another simple python test script. And if that script failed too, then I think you can report this error to pyaudio.

rbn42 commented 4 years ago

Can you try to run this in the latest master branch?

cd test
python3 test_pyaudio.py
kupiqu commented 4 years ago

It doesn't work either (but all I see is ALSA related, whereas my system uses pulse, not sure this may contribute to the issue):

python3 test_pyaudio.py 
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Make sure you are playing music when run this script
0 0 0
failed to catch audio
rbn42 commented 4 years ago

but all I see is ALSA related

My audio configuration is ArchLinux default (so it is pulse I guess), and I see this

ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Make sure you are playing music when run this script
625 -648 -596957
succeeded to catch audio
rbn42 commented 4 years ago

So I cannot help at this stage. This issue belongs to upstream. https://people.csail.mit.edu/hubert/pyaudio/

kupiqu commented 4 years ago

Thank you for the link and help.

What version of python3-pyaudio do you have? Mine is 0.2.11

Wondering, do you have any virtual audio output? I thought this could be having an impact.

Another possibility is that I'm missing some other python3 library that it is needed.

rbn42 commented 4 years ago

Same as you here.

community/python-pyaudio 0.2.11-2 [installed]

do you have any virtual audio output?

I don't know, if there is any virtual audio output, then they are from the default configuration of ArchLinux.

kupiqu commented 4 years ago

Got it working!!

For the case it is useful for others:

I had to install pavucontrol, edit your test1.sh script to remove the kill statement to have time enough to change how the ALSA plug-in records audio, from the intern audio, to the monitor of the intern audio.

Why one works and the other doesn't is out of my comprehension.

Unfortunately KDE's audio system does give you access to all that.

rbn42 commented 4 years ago

Glad to know.

Although I don't understand, does my applet work as test1.sh did? While python3 test_pyaudio.py still don't work? Because there is not kill statement in test_pyaudio.py

edit: never mind

kupiqu commented 4 years ago

I think I was not clear enough.

Your scripts work in my system, assumed audio settings of ALSA plug-in recording are changed from Internal audio to Monitor of internal audio something that I could only do with pavucontrol (no KDE system settings)

Removing the kill instruction is not really important, but it help so I had time to change settings in pavucontrol before the ALSA plug-in vanished.

EDIT:

Why one works and the other doesn't is out of my comprehension.

This was referred to the ALSA plug-in setting Monitor of internal audio vs. Internal audio in pavucontrol. Sorry for the confusion

kupiqu commented 4 years ago

Mmm, I just realized that this change between Monitor of internal audio vs. Internal audio is actually selecting between the stream of the actual internal audio and the audio that only comes from the microphone. This association is quite weird actually.

Somehow I cannot have access to both at once, but anyways, if I have to choose, I prefer the former option above than the latter.

Just out of curiosity, is the spectrum in your system working for both options at once (micro alone with no internal audio playing, as well as muted micro with some internal audio playing)?

rbn42 commented 4 years ago

is the spectrum in your system working for both options at once

Sorry, I don't have a microphone, cannot test.

kupiqu commented 4 years ago

I see, thank you anyway. Perhaps some other user may say...