Re: Trying to do audio from CGI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Uh-oh, I do have PulseAudio installed, didn't intend to.  Using a
Daniel Thompson Debian Bullseye on a Piinebook Pro.  It's been up less
than 4 days.  Getting PulseAudio and alsa to coexist is a pain because
Pulse wants to break alsa.  I did it once following some instructions
but I have no reason to keep Pulse.  I just tried:

cmd: '/usr/bin/mpg123 --output alsa "/data/mp3/pink_floyd/1 - Studio
Albums/1979 - The Wall/CD 2/Comfortably Numb.mp3" '

Which I thought I'd tried before, but that was before changing the
group.  Didn't hear anything but nothing in the Apache error log
either.  lsof should show the mp3  file open I think.  Or maybe ps ax.
Could be something in Apache's security but it's calling my CGI
program OK.  Oh, I'm calling mpg123 from a system() call and not
checking the return, I was rushing it.

The eventual machine will probably be a Raspberry Pi that will get
used for other things but not at the same time.  I like having it on
the web (NATed LAN actually) because there are phones, Kindles.
computers in the house which could all control it.  That part's mostly
written, trying to actually hear audio was the last part.  I have just
over 10k MP3 files, but my loader will scan them and make web pages.
In about 1/2 a second on this nvme SSD so it's painless to generate.
I'm into writing these recursive directory climbers in c sometimes.

Oh, Australia, land of radio astronomy.  I'm ab1jx.  Haven't been on
the air in 10 years or so but I keep the license up.



On 12/26/20, Stuart Longland <stuartl@xxxxxxxxxxxxxxxxxx> wrote:
> On 27/12/20 7:33 am, Alan Corey wrote:
>> Directory:/data/mp3/Queen/-- Studio Albums --/(1975) A Night at the
>> Opera/
>> Playing MPEG stream 1 of 1: 11 Queen - Bohemian Rhapsody.mp3 ...
>> [src/libout123/modules/portaudio.c:120] error: Failed to open
>> PortAudio default stream: Device unavailable
>> main: [src/mpg123.c:323] error: out123 error 7: failed to open device
>>
>> Why is it now trying PortAudio?  And failing - Audacity works with it.
>> Could it be something not in www-data's path?
>
> It might be a default for `mpg123` or `libao` (the back-end library used
> by `mpg123`).  I haven't used `mpg123` for a long time now but I think
> in the man page, there's a documented flag to point it at a different
> back-end such as ALSA directly.  (I switched to Ogg/Vorbis to "clean"
> out the illegally downloaded files I had in that format, and because
> MP3's licensing was a pain back in 2004.  As a bonus, storage
> requirements shrunk by 40%.)
>
> If the machine is acting as a music jukebox and nothing else, it
> probably makes sense to disable PulseAudio in this situation since
> there's only the one "user" of the sound card, PulseAudio really doesn't
> offer much other than maybe Bluetooth speaker connectivity (and there
> are ways to do that without PulseAudio too).
>
> PulseAudio will need the user that runs it, to have "real-time" rights
> (configured in `/etc/security/limits.conf`).  Not sure if `www-data`
> will have those rights as it's a rare requirement for CGI scripts.
> Alternatively, I think PulseAudio can be run in a "system" mode, have a
> read of its documentation, maybe that might work in your situation.
>
> The other option you might want to look into, rather than trying to make
> PulseAudio or ALSA work as the CGI user, instead look at making a
> back-end daemon look after whistling up `mpg123` to play music, and have
> the CGI script talk to it via some IPC mechanism (SysV IPC, Unix domain
> sockets, private HTTP API, Redis/AMQP/MQTT whatever).
>
> I'd strongly suggest having a look at `mpd`, as while there's probably
> some educational value to re-inventing the wheel, it looks like
> someone's done the work for you: `mpd` itself can act as that back-end
> service, and there are already web-based front-ends to talk to it.
> --
> Stuart Longland (aka Redhatter, VK4MSL)
>
> I haven't lost my mind...
>    ...it's backed up on a tape somewhere.
>
>
> _______________________________________________
> Alsa-user mailing list
> Alsa-user@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/alsa-user
>


-- 
-------------
Education is contagious.


_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux