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

Re: Persistent names for audio devices.



On Tue 28 Sep 2021 at 13:49:37 (-0700), peter@easthope.ca wrote:
>     From: ghe2001 <ghe2001@protonmail.com>
>     Date: Tue, 28 Sep 2021 17:24:57 +0000
> > Try alsamixer.  You can select the audio device there.  It works for my
> 
> >From the alsamixer manual, 
> "DESCRIPTION
>        alsamixer is an ncurses mixer program for use with the  ALSA  soundcard
>        drivers. It supports multiple soundcards with multiple devices."
> 
> A terminal with an ncurses display is necessary to listen to an audio message?

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.

> Now that the PCI sound card is gone, disambiguation appears to be unnecessary.
> This command works. 
> play a42.WAV
> 
> Something odd in the sox manual.
>        -d, --default-device
>               This  can  be  used  in  place of an input or output filename to
>               specify that the default audio device (if  one  has  been  built
>               into  SoX)  is to be used.  This is akin to invoking rec or play
>               (as described above).
> 
> What is the sense in telling a software to use a default?  In absence of 
> an output specification, what else would be used?

How otherwise would you make explicit what you're happy to use
implicitly? (When I write a script, I try to be as explicit as
possible, avoiding short-cuts, abbreviations, assumptions, etc.)

> peter@joule:/home/peter$ sox  /home/peter/a42.WAV /dev/snd/pcmC0D0c
> sox FAIL formats: can't determine type of `/dev/snd/pcmC0D0c'
> 
> Can sox specify a sound device for output? 

Yes:    sox /home/peter/a42.WAV -t alsa default

I define a function that saves typing, which I use when I'm checking
effects/timings etc.

function soxy {
    [ -z "$1" ] && printf '%s\n' "Usage:	${FUNCNAME[0]} path-to/sound-file-of-any-type [trim 20 2]
	runs sox to play the file with any arguments given.
	The example is a reminder for arguments in full." >&2 && return 1
    local From="$1"
    shift
    sox -q "$From" -t alsa default "$@"
}

Cheers,
David.


Reply to: