On Mon, Jan 29, 2024 at 04:44 PM, Paul wrote:
Question - is Loopback_2 used by sbitx?
I don't think so.? gives:

So we have plughw device 0 used for the codec, 1 and 2 used for loopback, leaving the third loopback (numbered 3) unused.
The same search gives a hint of how they get used and how they get created:

Line 20 creates three of them, placed at indices 1,2,3.
Line 14: I found it was important to use the full address:port ( 127.0.0.1:4532 ) not just 127.0.0.1?
I edited the wiki page posted earlier so it has this update.
If yes, could we use this one to route analogue audio I/O from card 0 (audioinjectorpi) on SBITX to another audio I/O device such as a USB headset or Bluetooth headset?
Yes.? Below is a proof of concept.
After connecting my USB headset I ran the command again:
pi@sbitx:~ $ aplay -l | awk -F \: '/,/{print $2}' | awk '{print $1}' | uniq
audioinjectorpi
Loopback
Loopback_1
Loopback_2
II
?
Mine gives:
$ aplay -l | awk -F \: '/,/{print $2}' | awk '{print $1}' | uniq
audioinjectorpi
Loopback
Loopback_1
Loopback_2
Device
So it gives the odd name 'Device' to my USB sound card device.
Another way to see it:
$ cat /proc/asound/cards
?0 [audioinjectorpi]: audioinjector-p - audioinjector-pi-soundcard
? ? ? ? ? ? ? ? ? ? ? audioinjector-pi-soundcard
?1 [Loopback? ? ? ?]: Loopback - Loopback
? ? ? ? ? ? ? ? ? ? ? Loopback 1
?2 [Loopback_1? ? ?]: Loopback - Loopback
? ? ? ? ? ? ? ? ? ? ? Loopback 2
?3 [Loopback_2? ? ?]: Loopback - Loopback
? ? ? ? ? ? ? ? ? ? ? Loopback 3
?4 [Device? ? ? ? ?]: USB-Audio - USB PnP Sound Device
? ? ? ? ? ? ? ? ? ? ? C-Media Electronics Inc. USB PnP Sound Device at usb-0000:01:00.0-1.2.2, full s
These suggest it looks promising, the devil is in the detail
Great, I get to play satan!
I am trying to avoid the use of PulseAudio as that has been replaced in newer distributions using Pipewire and Wireplumber, however both of these sit on top of ALSA. Based on this will focus my efforts on using Alsa if possible to minimise complication. Might not be possible but it is a starting point with help from the references above.
Research continues - if I get the answer and tested, it will be added here to begin with and then the wiki page as a Howto
If anyone already solved it then please add to the topic.
I've done a small proof of concept to play sound from sbitx's loop device out to my usb sound card.
What I did to try to make progress was to set up and test wsjt-x using the settings in the wiki page posted earlier.
That told me what device names to use.
Then I tried a few things but in the end what worked for me was to set up a gnuradio flowgraph using its audio source and audio sink.
This is what it looks like:

?
The stuff in the bottom right shows the variables I created, the same stuff is in the text under each variable block.
To be honest I guessed incorrectly based on what wsjt-x refers to as sound card input vs output.??
I used the 'QT GUI Sink' to show a FFT and waterfall of the data and changed names around and it worked.
This is what is known as the FAFO method (f-around, find out).
Then to show it worked, I moved over to the linux CLI and did:
$ arecord -D "plughw:CARD=Loopback,DEV=1" | aplay -D "plughw:CARD=Device,DEV=0"
and this worked, it records from the loopback device sbitx writes to and plays to the usb device.
In your case, substitute Device with II and I think it should work.
The sound ain't great.? There's things like gains to work out and re-sampling to avoid (hint: plughw is doing resampling if it needs to).
But it is a proof-of-concept, for at least one direction.
Another hint is that the 'sox' program can do this all in one command more efficiently, and can do things like apply gain factors and filtering, etc.
The syntax for 'sox' is pretty unfriendly, though, IMO.
The other direction should just be a matter of putting the right source and destination devices into the same commands.
--
Regards,
Dave, N1AI