Re: Trying to do audio from CGI

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

 



OMG, I figured it out.  You have to use not just the -o and backend
type, but also -d and the Alsa device.  So this web browser URL:
http://pbp/cgi-bin/jbe?009864
produces this comand:
cmd: '/usr/bin/mpg123 --output alsa -d plughw:1,0,0
"/data/mp3/pink_floyd/1 - Studio Albums/1979 - The Wall/CD 2/Is There
Anybody Out There.mp3" '

No, I'm not sending commands over the web, the scanning program makes
a file number and puts it in the web pages.  When you click a song
link it sends that number to the CGI program which also has the list
and looks it up.

I expect to put it in my collection of stuff on Sourceforge
eventually.  I want to add a stop button and a queue, maybe other
things.  pkill mpg123 works for now.

On 12/27/20, Alan Corey <alan01346@xxxxxxxxx> wrote:
> Well, don't follow those instructions exactly.  I did and broke my
> alsa, but I think I've been here before, had to manually undo stuff.
> This was on a Raspberry Pi before but back in the summer I was doing
> nature recordings and using alsa (with aplay and arecord), sox,
> Audacity.  The Pinebook Pro has about 6 hours battery life even
> running a USB soundcard so I was making 1/2 hour recordings by cron
> jobs.  Using the wall wart it came with gave way too much noise.
>
> Hans Michlmayr was the guy's name, he was probably in the Outback.
> Web site seems to be gone now, he's possibly not still alive.  Did a
> lot with radio interferometry.  You can point an antenna at the sky
> and signals get strong and weak.  But if you have 2 antennas as far
> apart as you can get them, then look at just what's in phase you can
> get much higher resolution.  As the earth rotates it covers 360
> degrees in one plane, summer-winter tilting gives a different plane.
> Signals from over the poles repeat more quickly than those overhead.
> You want as much gain as you can manage without feedback, from gain
> antennas and amplifier gain, like 100 db,.  But you can sweep the sky
> and do plots, looking for quasars mostly.  There are other radio
> sources like Jupiter.  People use a pair of satellite TV dishes
> pointed up.  I was into it 10 years ago, had a pair of antennas out.
> Never actually got anything, I was using an IC-7000 and when you turn
> the AGC off it mostly goes dead so I was imagining signals where there
> weren't any.
>
>
> On 12/26/20, Stuart Longland <stuartl@xxxxxxxxxxxxxxxxxx> wrote:
>> 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.
>>
>
>
> --
> -------------
> Education is contagious.
>


-- 
-------------
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