Way back in Nov 2016, I posted a query about playing two mp3 files simultaneously through two independent USB audio adaptors for my local Model Town. I got it to work, see viewtopic.php?f=38&t=164784&p=1066454#p1066454, but then fell at the next hurdle because all the adaptors that I could source at that time had the same ID, so it was impossible to determine which was which when directing the audio to the right channel. In the end, I abandoned using a Pi Zero and used a Pi 3 instead because it had an independent audio jack that could be identified and the USB adaptor then stayed on the same channel.
However.... All in the garden is not rosy. During the summer season the system began to suffer from cross-talk and very noticeable hum; a problem that I put down in part at least to the fact that the original 12 V Power Brick for the audio amps failed and the new one is noisy compared to the old one. I've now filtered this and the problem is much reduced, but is still apparent. The real problem seems to be that the Pi itself introduces a hum loop and the audio is modulated onto the hum and so appears on both channels. In an effort to solve this once and for all I bought a new set of USB audio adaptors from a different source and joy of joys they have a different ID to the originals.
My problem now is how to translate the information from dmesg, lsusb and aplay -l to allow me to discover the hw: numbers for the two devices programatically.
With both adaptors plugged into this desktop machine, here is the output of lsusb:
Code: Select all
[email protected]:~$ lsusb Bus 002 Device 006: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller Bus 002 Device 005: ID 045e:0084 Microsoft Corp. Basic Optical Mouse Bus 002 Device 004: ID 046a:0023 Cherry GmbH CyMotion Master Linux Keyboard G230 Bus 002 Device 003: ID 046d:09a2 Logitech, Inc. QuickCam Communicate Deluxe/S7500 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 8086:0808 Intel Corp. Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Here is aplay -l:
Code: Select all
[email protected]:~$ 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
As you can see there is no clue as to which [USB PnP Sound Device] is the C-Media one and which is the intel one.
Here is dmesg:
Code: Select all
[email protected]:~$ dmesg | grep PnP [ 0.107560] pnp: PnP ACPI init [ 0.108176] pnp: PnP ACPI: found 6 devices [ 7168.666002] usb 1-1.3: Product: USB PnP Sound Device [ 7168.686080] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:8086:0808.0004/input/input15 [ 7168.744309] hid-generic 0003:8086:0808.0004: input,hidraw3: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-0000:00:1a.0-1.3/input3 [ 7174.537970] usb 2-1.7: Product: USB PnP Sound Device [ 7174.558015] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.3/0003:0D8C:013C.0005/input/input16 [ 7174.616030] hid-generic 0003:0D8C:013C.0005: input,hidraw4: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-0000:00:1d.0-1.7/input3
What I can't quite see is how I can extract from dmesg and / or lsusb the link that tells me the Card and Subdevice numbers that I can use to play the file using aplay or mpg321. The output from lsusb seems to bear no relation to the Card numbers and the output from dmesg is frankly gobblygook to me.
Can anyone help with the necessary alchemy?