jirisko / amixer-webui Goto Github PK
View Code? Open in Web Editor NEWWeb application for control ALSA volume
License: MIT License
Web application for control ALSA volume
License: MIT License
JiriSko,
Been using this for a while. We recently made some changes and wanted to share with you. I am not a coder, so it took me a while to get this working, but when using the python flask app on port 8080, there is always a message in the log about it being insecure. We are running nginx and we made these changes to get it all working as a uwsgi socket
...
# add uwsgi for amixer-webui
server {
listen 8080;
listen [::]:8080;
location /
{
root /usr/share/amixer-webui;
# logging and control is in the amixer-webui.ini file
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/amixer-webui.sock;
}
} # end amixer-webui section
...
We install it in /srv/http/amixer and have these config files:
wsgi.py:
from alsamixer_webui import app
if __name__ == "__main__":
app.run()
amixer-webui.ini
[uwsgi]
module = wsgi
module = alsamixer_webui:app
plugins = python
processes = 1
#threads = 2
# the user and group id of the process once it’s started
uid = http
gid = http
socket = /run/uwsgi/%n.sock
#http = 0.0.0.0:8080 # for testing
master = true
chdir = /srv/http/amixer
# Logging
#logto = /var/log/amixer-webui.log
logto = /dev/null
log-5xx = true
disable-logging = true
# clear environment on exit
vacuum = true
die-on-term = true
In the systemd service file, we use this as the execute line:
ExecStart=/usr/bin/uwsgi --ini /srv/http/amixer/amixer-webui.ini
I installed this via the .deb file on my RPi4 and it seems to be having an issue with a device that doesn't exist. Here is the error that is listed in the syslog. Below that is what is returned when I do an aplay -l
. Audio plays fine via the device otherwise, I just wanted to get the webui working so I could control it easily since it is a headless setup. Any suggestions would be appreciated.
syslog
ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL pulse amixer: Control device pulse open error: No such file or directory 192.168.0.6 - - [26/Sep/2020 11:58:32] "GET /cards/ HTTP/1.1" 200 - [2020-09-26 11:58:32,413] ERROR in app: Exception on /controls/ [GET] Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/share/amixer-webui/alsamixer_webui.py", line 235, in get_controls data = json.dumps(app.__get_controls__()) File "/usr/share/amixer-webui/alsamixer_webui.py", line 145, in __get_controls__ channel_desc = self.__get_channel_name__(amixer_chandesc, interface["name"], i) File "/usr/share/amixer-webui/alsamixer_webui.py", line 61, in __get_channel_name__ if name.split(" ")[-2] in line: IndexError: list index out of range 192.168.0.6 - - [26/Sep/2020 11:58:32] "GET /controls/?1601139511142 HTTP/1.1" 500 - ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL equal amixer: Mixer attach equal error: No such file or directory ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL equal amixer: Control equal open error: No such file or directory 192.168.0.6 - - [26/Sep/2020 11:58:33] "GET /equalizer/ HTTP/1.1" 200 -
aplay -l results
**** List of PLAYBACK Hardware Devices **** card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0
Ran into this a number of times and reverted to an old version which had been hacked on a bit by another user then, recently, noticed that USB devices do not always show up. We are not using pulse, but only alsa. The recent hack in the display of names is this:
gearhead/RuneUI@29fcfe9
We made a few attempts and finally got it to be reaosnable. The names display as
Which is more closely aligned with the display in aplay -l
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: J380 [Jabra Link 380], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Not sure if there's a better place for this, but I thought I'd share.
I had a need to only display capture devices. I created this fork: addCaptureOnlyArgument.
Additionally, this fork needed to expand the ability to parse arguments. And I also added functionality to specify the config file location.
Thanks to Jiří for an excellent project to hack! I learned a bunch.
I am using this on a raspberry pi. I had it working and have changed something and now it will not display. The RPi is running Arch Linux. If I launch it from the command line it all works. If I launch it as a systemd service, I get nothing. All that is dipslayed is:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
I know this is not a problem with the application, but am at a loss as to what to do to diagnose this... The service file I am using is:
[Unit]
Description=Amixer-WebUI Service
After=audio.target
[Service]
ExecStart=/usr/bin/python2 /usr/share/amixer-webui/alsamixer_webui.py -p8080
ExecReload=/usr/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20
[Install]
WantedBy=multi-user.target
i have to run „/etc/init.d/amixer-webui start” manually every time after startup
Sorry, no idea if there is a forum - but is alsaloop controlable from within the GUI here? I would like to loopback the input from one line in to a line out.
This is on multiple raspberry pis. command line seems fine. but the web based solution seems to strugggle with python2:
Mar 13 10:31:45 labrune python2[181]: ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL pulse
Mar 13 10:31:45 labrune python2[181]: amixer: Control device pulse open error: No such file or directory
Mar 13 10:31:45 labrune python2[181]: 10.10.1.118 - - [13/Mar/2019 10:31:45] "GET /cards/ HTTP/1.1" 200 -
Mar 13 10:31:45 labrune python2[181]: 10.10.1.118 - - [13/Mar/2019 10:31:45] "GET /controls/?1552491103027 HTTP/1.1" 200 -
Mar 13 10:31:46 labrune python2[181]: ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL equal
Mar 13 10:31:46 labrune python2[181]: amixer: Mixer attach equal error: No such file or directory
Mar 13 10:31:46 labrune python2[181]: ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL equal
Mar 13 10:31:46 labrune python2[181]: amixer: Control equal open error: No such file or directory
Mar 13 10:31:46 labrune python2[181]: 10.10.1.118 - - [13/Mar/2019 10:31:46] "GET /equalizer/ HTTP/1.1" 200 -
I can check, but I remember it running better with Python3. Since this is on a Pi, we want to minimize packages installed. Currently using python2 as samba installs it and uses it, still (in 2019) and rather not have to install 3. The OS is Arch Linux. We do not have pulseaudi installed as we are only using alsa.
Hi!
I want to use amixer web UI with M-Audio FastTrack Ultra - it's a external USB sound card, it has 8 input channels + 8 playback channels that can be mixed to 8 outputs. In amixer this is presented as 128 sliders :)
Would be nice, if one could filter out only some of these sliders and may be group them somehow.
Hi !
Nice app you made! Nice layout even on a smartphone!
The Makefile will crash if /etc/init.d doesn't exist (old sysVinit). Most distros now use systemd now for service startup. I'll try to make a PR asap if you're interested.
Hi I am a total noob.
Just wondering I tried to install amixer-webui on my raspberrypi zero w and I am using phat dac by pimroni. I am using alsa as well.
I cloned the whole directory to my pi and ran install command. I believe amixer-webui has been installed and I tried to configure the conf file in which I wrote my address of the pi running amixer-webui and the port.
But I cannot connect to it at all, on Chrome it says something went wrong and I have also tried the android app. None of them work all I get is a spin and after a while a blank white page.
Can someone please help me?
Thanks.
I'm using your webui on daily basis and wonder if you would be interrested in a WSGI version of your application ?
I'm planning to do it for my needs anyway but should i stay close to your code or you are not interrested at all and you won't be merging this evolution anyway ?
Thanks in advance :-)
Corrected startup script a little bit, to be able to run under particular user...
amixer-webui.zip
Due to array ranges out of ranges and unexpected empty strings.
Already have a fix available.
Also have to figure out how to enable the equalizer: Maybe parse asound.conf?
Maybe will add some logging.
is it planned, or even possible to integrate this fine piece of software as plugin for kde connect? kde connect can be run under different systems/de and is not limited to plasma.
desktop accessed from systems browser or android app show empty page
Hello JiriSko,
What about support for alsaequal in your nice webui? ;)
All the best
On Raspberry 1 the mixer shows strange values like -4500% (right slider), or only 0 to 2 % (left slider).
The mute-Button is working, and also on the right slider if you come about 100%, it seems to do something (but not 0-100% in correct scale).
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
Python 2.7.9
Linux raspi 4.4.13+ #894 Mon Jun 13 12:43:26 BST 2016 armv6l GNU/Linux
Hi !
I'm in need of a way to see if and which processes are accessing soundcards.
Polling with lsof could be a way to do that:
lsof -Fpc /dev/snd/pcm*
What do you think about this feature ? I'm willing to work on it in a few days.
Thanks for you answer and happy new year :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.