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

Re: Persistent names for audio devices.



On Wed 29 Sep 2021 at 12:25:49 (-0700), peter@easthope.ca wrote:
>     From: David Wright <deblis@lionunicorn.co.uk>
>     Date: Tue, 28 Sep 2021 18:31:34 -0500
> > No, you'd use alsamixer where you were taking an active rôle during
> > record/playback, or for discovering, inspecting and setting up a
> > system. Typically, you'd play "an audio message", or anything else,
> > with some sort of application, unless it was a disembodied
> > notification, say.
> > 
> > Some applications include volume/balance controls and so on; others
> > don't. I have keys set up for adjusting the volume on the various
> > controls, using the multimedia keys XF86Audio{Mute,LowerVolume,RaiseVolume}
> > (F1/F2/F3 where not present), with Ctrl/Alt/Shift to select between
> > Master/Speakers/Headphones/PCM.
> 
> Understood, but to listen to an audio message from VoIP (not opera) a 
> simple command should suffice. (play ~/a42.WAV) Speakers rather than 
> headphones for a voice message.  I'd rather not  adjust volume except 
> maybe "play ~/a42.WAV gain 1".  A typical message is "Please call J. 
> Doe."  In a worst case I might shut off the RCA AM radio made in 1960 
> to hear the message better.  =8~)  Seems we're at crossed purposes 
> here.

Not really. A disembodied notification is like an answerphone that
plays a message out loud during the call, whereas your case is like
playing it later by pressing a key.

As for the gain, you might always start at some default, but it would
surely be useful to be able to adjust it for mumblers and shouters
while it was playing.

You can of course just play the message with play, but there are
advantages in popping up a player of some sort; for example, you
can jog it backwards if you miss, say, an unclear word, and jog it
forward if you're replaying a somewhat rambling message.

> > How otherwise would you make explicit what you're happy to use
> > implicitly?
> 
> No offense but isn't that analogous to saying to a ten year old 
> "Johnny, please eat your lunch with your mouth."  =8~) 
> 
> A default which isn't unique is a bad default.  If it is unique, 
> there's nothing to disambiguate.  Crossed purposes again?  

More like "Breathe through your nose!"

> > (When I write a script, I try to be as explicit as
> > possible, avoiding short-cuts, abbreviations, assumptions, etc.)
> 
> Absolutely good policy.  I try to follow it also but tend to fail.  =8~)
> 
> > sox /home/peter/a42.WAV -t alsa default
> 
> Good. 
> 
> The machine here has sound hardware on the system board.  Also it can 
> have a PCI sound card.  Sound devices reported here. 
> https://lists.debian.org/debian-user/2021/07/msg01272.html
> 
> Assume speakers are plugged to output on the system board; headphones 
> plugged to the PCI card.  A Linphone ring and a voice message (play 
> ~/a42.WAV) should always go to the speakers.  VoIP I/O (a 
> conversation) and ring can be configured in Linphone; no problem.  
> "play ~/a42.WAV" delivering to the headphones in random cases is an 
> unacceptable failure. How would you make it work without frequent 
> configuration adjustments?  

It depends how imaginative you want to be about setting it up.
I'd start with the ~/a42.WAV business. If VoIP calls are being
recorded, I'd use a fixed directory, with files named by the
calls' starting times, like 2021-09-29-123456.wav. That would
give the flexibility to play/skip/delete messages in some sort
of circular fashion with a minimal number of key bindings.

As for what happens when you press your play key, it would run
a script that would first set the audio controls to a set of
initial values. These have been determined using alsamixer when
setting this up (see top of post), and are set with commands like

  amixer -c "$Card" -- sset "Speaker" 70% on

where $Card is the appropriate card number. The script would then
run play (which you've cracked) or sox (where "default" doesn't
point to the desired output device) on an appropriate file.

Examples of the latter would be:

$ sox -q foo.wav -t alsa plughw:0              (my AiO PC)
$ sox -q foo.wav -t alsa plughw:PCH            (the same, using card name)
$ sox -q foo.wav -t alsa plughw:PCH,0          (this AiO's PCH only has one device: 0)
$ sox -q foo.wav -t alsa plughw:XXX

XXX could be any of Live, ICH5, Set (headphones), but not
U0x46d0x807 I think, as that looks like only an input.
Alsamixer would help you determine which is which, if you don't
already know. (I thought you had already determined this in, eg,
https://lists.debian.org/debian-user/2021/08/msg00133.html
but it's difficult to follow both the threading and which
commands make noises from which actual physical things).

I think this thread has been around for a couple of years now.
I assume the penny dropped that names like Live and ICH5 are
the persistent items you were looking for.

Disclaimers: I don't know anything about the hardware you're using,
and I've ignored your pulseaudio because I don't use it.

Cheers,
David.


Reply to: