Re: Trying to do audio from CGI

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

 



On 27/12/20 11:04 am, Alan Corey wrote:
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:

I'm willing to tolerate PulseAudio on my desktop/laptop because it does conveniently share the sound card between applications and allows me to re-route applications between sound interfaces (something JACK does not do well).

I have a Raspberry Pi 3 which spends most of its day with a RTL2832 SDR stick plugged in decoding DAB+: I tried PulseAudio there (since it insisted on coming along for the ride), but found it just wanted to "stutter" its way though, making things unlistenable.

PortAudio applications refused to talk to the on-board sound directly, so I wound up using JACK, which is working well enough now.

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.

Easy enough to forget that. Also, beware of command line injection with your `system()` calls. An internal trusted network reduces the risk quite a bit, but it's worth being paranoid here.

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.

Yep, well, one thing you might run into with a Raspberry Pi… some software, notably anything that uses PortAudio (e.g. Audacity), last time I tried it a few months back, would _not_ talk to the on-board sound interface via ALSA directly.

https://www.raspberrypi.org/forums/viewtopic.php?t=276247#p1750552

I haven't had the time to debug it further, but it's related to changes in the ALSA kernel driver used. Other audio devices like `snd-usb-audio` are not affected.

`libao`-based stuff like `mpg123` may be fine. If you're not doing any other "audio"-related things, again, you probably don't need PulseAudio. If you find your program isn't finding the on-board sound card, JACK may work, but then again, I've also never tried that in a CGI context.

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.

Heh, probably not in my neck of the woods (NW Brisbane). You'd never hear E.T. over the top of 10000 el cheapo switch-mode wall warts, solar inverters, traffic lights and plasma television sets. VHF can be noisy too being so close to Mt. Coot-tha: I've accidentally tuned into ABC Classic FM with a plain analogue amplifier (yaay for accidental slope detection!) more times than I care to count,
--
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




[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