Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Hamish MB
Potential solution:

If both speakers are in roughly the same place, does it matter which one each 
sound is played through? You could just play music though one of them, and do 
the bells with whichever speaker isn't already in use.

Hamish
On 14 Jan 2018, at 18:07, Hamish MB 
> wrote:
Weird that it keeps cutting it off!

I've been having email problems with this mailing list too - I've tried to 
reply to people a few times but it doesn't seem to work.

This is sent directly to you as well as the list Terry, so please let me know 
if you get this message twice :)

Hamish
On 14 Jan 2018, at 18:05, Terry Coles < 
d-...@hadrian-way.co.uk> wrote:

On Sunday, 14 January 2018 18:02:40 GMT you wrote:



 On Sunday, 14 January 2018 17:57:26 GMT Terry Coles wrote:

 Some stuff:



 This is weird, I think something is cutting off the information that I have

 been putting at the end of the message.  One more time:




I'll post it on the Raspberry Pi Forum later; have to go to dinner now.
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 18:03:56 GMT you wrote:
> I'll post it on the Raspberry Pi Forum later; have to go to dinner now.

Done.

-- 



Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Hamish MB
Weird that it keeps cutting it off!

I've been having email problems with this mailing list too - I've tried to 
reply to people a few times but it doesn't seem to work.

This is sent directly to you as well as the list Terry, so please let me know 
if you get this message twice :)

Hamish
On 14 Jan 2018, at 18:05, Terry Coles 
> wrote:

On Sunday, 14 January 2018 18:02:40 GMT you wrote:
 On Sunday, 14 January 2018 17:57:26 GMT Terry Coles wrote:
 Some stuff:

 This is weird, I think something is cutting off the information that I have
 been putting at the end of the message.  One more time:

I'll post it on the Raspberry Pi Forum later; have to go to dinner now.
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 18:02:40 GMT you wrote:
> On Sunday, 14 January 2018 17:57:26 GMT Terry Coles wrote:
> Some stuff:
> 
> This is weird, I think something is cutting off the information that I have
> been putting at the end of the message.  One more time:

I'll post it on the Raspberry Pi Forum later; have to go to dinner now.

-- 



Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 17:57:26 GMT Terry Coles wrote:
Some stuff:

This is weird, I think something is cutting off the information that I have 
been 
putting at the end of the message.  One more time:

*terry@OptiPlex*:*~*$ aplay -l 


-- 



Terry Coles
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 17:51:51 GMT Terry Coles wrote:
> On Sunday, 14 January 2018 17:40:14 GMT Andrew wrote:
> > The IDs in lsusb won't help, they are the vendor ID and device ID for
> > that type of card, not that instance in your machine.
> 
> They would if I could tie the ID to the hw: channel in aplay, because I know
> which ID is plugged into the tower and which into the nave.
> 
> That's what I've been unable to do.
> 
> > It looks like aplay -D can use the whole device string, eg.
> > "plughw:CARD=Device,DEV=0" but mpg123 can't...
> > 
> > I've done some more experimenting and I can see how to do it... I think...
> > First list devices with 'aplay -l' (lowercase). On here I get this:
> > 
> > card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
> > 
> >Subdevices: 1/1
> >Subdevice #0: subdevice #0
> > 
> > card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
> > 
> >Subdevices: 1/1
> >Subdevice #0: subdevice #0
> > 
> > card 2: Device [USB Sound Device], device 0: USB Audio [USB Audio]
> > 
> >Subdevices: 1/1
> >Subdevice #0: subdevice #0
> > 
> > There's three cards here, and each has one device.
> > The middle one (HDMI), is card 1, device 3. I can play through that with:
> > mpg123 -o alsa -a hw:1,3 /path/to/audio
> > 
> > Or if I want the USB device:
> > mpg123 -o alsa -a hw:2,0 /path/to/audio
> > 
> > If I wanted the internal card that would be hw:0,0, but there's nothing
> > plugged in to it right now... :)
> 
> Yes.  I understand that.  I posted my version of aplay -l at the Raspberry
> Pi Forum, but here it is again:
> 
> terry@OptiPlex:~$ aplay -l
>  List of PLAYBACK Hardware Devices 
> card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
>   Subdevices: 0/1
>   Subdevice #0: subdevice #0
> card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 2: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 3: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 4: Device_1 [USB PnP Sound Device], device 0: USB Audio [USB Audio]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> 
> and here is what I got just now, with the same adaptors plugged into the
> same USB ports:
> 
> *terry@OptiPlex*:*~*$ aplay -l
Oops the thing didn't go through properly.  Here is the latest one again.

*terry@OptiPlex*:*~*$ aplay -l 


-- 



Terry Coles
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 17:40:14 GMT Andrew wrote:
> The IDs in lsusb won't help, they are the vendor ID and device ID for
> that type of card, not that instance in your machine.

They would if I could tie the ID to the hw: channel in aplay, because I know 
which ID is 
plugged into the tower and which into the nave.

That's what I've been unable to do.

> It looks like aplay -D can use the whole device string, eg.
> "plughw:CARD=Device,DEV=0" but mpg123 can't...
> 
> I've done some more experimenting and I can see how to do it... I think...
> First list devices with 'aplay -l' (lowercase). On here I get this:
> 
> card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
>Subdevices: 1/1
>Subdevice #0: subdevice #0
> card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
>Subdevices: 1/1
>Subdevice #0: subdevice #0
> card 2: Device [USB Sound Device], device 0: USB Audio [USB Audio]
>Subdevices: 1/1
>Subdevice #0: subdevice #0
> 
> There's three cards here, and each has one device.
> The middle one (HDMI), is card 1, device 3. I can play through that with:
> mpg123 -o alsa -a hw:1,3 /path/to/audio
> 
> Or if I want the USB device:
> mpg123 -o alsa -a hw:2,0 /path/to/audio
> 
> If I wanted the internal card that would be hw:0,0, but there's nothing
> plugged in to it right now... :)

Yes.  I understand that.  I posted my version of aplay -l at the Raspberry Pi 
Forum, but here 
it is again:

terry@OptiPlex:~$ aplay -l
 List of PLAYBACK Hardware Devices 
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
   
card 4: Device_1 [USB PnP Sound Device], device 0: USB Audio [USB Audio]
   
  Subdevices: 1/1   
   
  Subdevice #0: subdevice #0

and here is what I got just now, with the same adaptors plugged into the same 
USB ports:

*terry@OptiPlex*:*~*$ aplay -l 


That's my problem.


-- 



Terry Coles
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Andrew

I've just re-read your forum post and can see your output of 'aplay -l'.

So you have:
Internal (I guess it's internal):
hw:0,0
HDMI 0:
hw:2,3
HDMI 1:
hw:2,7
USB:
hw:3,0
USB:
hw:4,0

It would be nice if the output of aplay -l actually showed these rather 
than having the know how to put them together!
I believe it's possible to specify the subdevice with another comma, if 
needed.


--

Andrew.


--
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Andrew

On 14/01/18 17:13, Terry Coles wrote:
I have used both aplay -l and aplay -L, but neither help. Here is a 
couple of

segments from the relevant output for the two devices:



sysdefault:CARD=Device
 USB PnP Sound Device, USB Audio
 Default Audio Device

..

plughw:CARD=Device,DEV=0
 USB PnP Sound Device, USB Audio
 Hardware device with all software conversions


sysdefault:CARD=Device_1
 USB PnP Sound Device, USB Audio
 Default Audio Device
front:CARD=Device_1,DEV=0



plughw:CARD=Device_1,DEV=0
 USB PnP Sound Device, USB Audio
 Hardware device with all software conversions


As you can see, the only difference between the two entries is the _1 after
Card=Device.  That doesn't tie up with the ID Numbers in lsusb either.

Of course, if I knew the name of the device that was connected to the channel
that I wanted, then aplay -D might be useful.  :-)



The IDs in lsusb won't help, they are the vendor ID and device ID for 
that type of card, not that instance in your machine.


It looks like aplay -D can use the whole device string, eg. 
"plughw:CARD=Device,DEV=0" but mpg123 can't...


I've done some more experimenting and I can see how to do it... I think...
First list devices with 'aplay -l' (lowercase). On here I get this:

card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

There's three cards here, and each has one device.
The middle one (HDMI), is card 1, device 3. I can play through that with:
mpg123 -o alsa -a hw:1,3 /path/to/audio

Or if I want the USB device:
mpg123 -o alsa -a hw:2,0 /path/to/audio

If I wanted the internal card that would be hw:0,0, but there's nothing 
plugged in to it right now... :)


--

Andrew.


--
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
On Sunday, 14 January 2018 16:49:17 GMT Andrew wrote:
> Ideally you want a balanced audio output. I would give you a link to the
> USB to XLR audio device I bought many years ago, but I can't seem to
> find them any more! There's lots around with a single input but the one
> I got has two inputs and two outputs.
> There is this for the Raspberry Pi, however I'm not sure if you can have
> more than one on the same machine:
> 
> https://www.hifiberry.com/shop/boards/hifiberry-dac-pro-xlr/
> 
> Then you'd need a balanced amplifier and cables, and that should get rid
> of any hum at all.

We looked at these devices before we went with the solution that we chose.  
The problem is that they cost significantly more than the Raspberry Pi itself 
and an order of magnitude more than the USB Audio Adaptors.  Also, we're not 
looking for HiFi, just a reasonable rendition of organ music and bells.

I haven't given up with the hum problem, but the two USB adaptors solve the 
problem perfectly; as long as someone is there to iteratively discover which 
adaptor has been attached to which channel.  Not a practical proposition of 
course in a system runs 24/7 and has to cope with the odd power cut.

> I think you want 'aplay -L', not 'aplay -l'. Then you'll see the device
> names, something like "plughw:CARD=Device,DEV=0".
> 
>  From the man page:
> 
> -l, --list-devices
>List all soundcards and digital audio devices
> 
> -L, --list-pcms
>List all PCMs defined
> 
> -D, --device=NAME
>Select PCM by name

I have used both aplay -l and aplay -L, but neither help.  Here is a couple of 
segments from the relevant output for the two devices:



sysdefault:CARD=Device
USB PnP Sound Device, USB Audio
Default Audio Device

..

plughw:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Hardware device with all software conversions


sysdefault:CARD=Device_1
USB PnP Sound Device, USB Audio
Default Audio Device
front:CARD=Device_1,DEV=0



plughw:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Hardware device with all software conversions


As you can see, the only difference between the two entries is the _1 after 
Card=Device.  That doesn't tie up with the ID Numbers in lsusb either. 

Of course, if I knew the name of the device that was connected to the channel 
that I wanted, then aplay -D might be useful.  :-)

-- 



Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Andrew

Hi Terry,

On 14/01/18 11:27, Terry Coles wrote:

Everything in the garden was lovely until the 12 V (Audio Amp) PSU Brick failed 
in August
and the replacement turned out to be noisy.  There was always a bit of a hum 
loop, but it
was acceptable until the extra noisy PSU came along.


Ideally you want a balanced audio output. I would give you a link to the 
USB to XLR audio device I bought many years ago, but I can't seem to 
find them any more! There's lots around with a single input but the one 
I got has two inputs and two outputs.
There is this for the Raspberry Pi, however I'm not sure if you can have 
more than one on the same machine:


https://www.hifiberry.com/shop/boards/hifiberry-dac-pro-xlr/

Then you'd need a balanced amplifier and cables, and that should get rid 
of any hum at all.



I managed to obtain a couple of USB Audio Adaptors with a different ID string 
to the
original ones, so I thought that we could revert to plan A.  However, I can't 
work out how
to identify the channel from the info available from lsusb, aplay -l and dmesg.
I think you want 'aplay -L', not 'aplay -l'. Then you'll see the device 
names, something like "plughw:CARD=Device,DEV=0".


From the man page:

   -l, --list-devices
  List all soundcards and digital audio devices

   -L, --list-pcms
  List all PCMs defined

   -D, --device=NAME
  Select PCM by name

--

Andrew.


--
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

[Dorset] Using Two USB Audio Adaptors and Selecting the Right One Programatically

2018-01-14 Thread Terry Coles
Hi,

You may remember my queries in November of last year regarding the use of two 
USB 
Audio Adaptors with a Raspberry Pi; one to play the chimes and one to play the 
organ 
music inside the Wimborne Model Town Minster.  At the time it was suggested 
that I could 
discriminate between the two adaptors by reading their ID string.

In the event that solution didn't work for two reasons: first the USB Hub in a 
Pi Zero is a 
single-TT port and the other is because the two adaptors had the same ID string 
;-(

At the time we solved this by changing to a Pi 3 which has a (crude) audio jack 
so I could 
send the bells to that channel and the music to a USB Audio Adaptor plugged 
into one of 
the four available USB Ports.  (BTW, the Pi 3 has a multi-TT port).

Everything in the garden was lovely until the 12 V (Audio Amp) PSU Brick failed 
in August 
and the replacement turned out to be noisy.  There was always a bit of a hum 
loop, but it 
was acceptable until the extra noisy PSU came along.

I managed to obtain a couple of USB Audio Adaptors with a different ID string 
to the 
original ones, so I thought that we could revert to plan A.  However, I can't 
work out how 
to identify the channel from the info available from lsusb, aplay -l and dmesg.

I've published the question on the Raspberry Pi Forums at:

https://www.raspberrypi.org/forums/viewtopic.php?f=38=202382

  but there haven't been any responses to date.

Anyone here got any ideas?  For convenience, I'm working with the two adaptors 
plugged 
into my desktop PC (Dell Optiplex), but should be able to transfer the 
technique to the Pi 
once I've worked out the trick.  (BTW aplay -L gives a lot more info but I 
couldn't see 
anything in there to tie the hw: channel to the Adaptor's ID string.)

-- 



Terry Coles
-- 
Next meeting:  Bournemouth, Tuesday, 2018-01-09 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR