[AudioI] How-to play independent single channels?

Bradley Dawson bdawson at une.edu.au
Wed Jul 21 00:35:32 UTC 2021


Hello Ian,
I have been trying to do the same thing. I tried using the Octo card but gave up in the end because it just shows up as a single device and I couldn't work out how to send different files to its different channels using Python. What I am doing now is based on a project which you can look at here https://www.raspberrypi.org/blog/multiple-sounds-simultaneously-raspberry-pi/
or at github https://github.com/esologic/pear
This uses USB sound cards which doesn't work well for me because they can change device numbers each time you reboot. I am using one USB device and one plug-in sound card (IQaudIO Pi-DAC+) since it is easy to identify each of these in the device list. Just have to modify the Python code in the example above to look for those particular devices. You could probably also use the onboard audio as an extra output since it shows up in the device list as well.
If you ever get Python talking to the Octo, let me know as I would like to use more channels.

Regards,
Brad


________________________________
From: People <people-bounces at lists.audioinjector.net> on behalf of Ian Crawford via People <people at lists.audioinjector.net>
Sent: Wednesday, July 21, 2021 12:27 AM
To: people at lists.audioinjector.net <people at lists.audioinjector.net>
Subject: [AudioI] How-to play independent single channels?

I’m trying to use Python to play simultaneous separate audio files through *individual channels on a single audio device* (either the built in RPi audio output, or an Octo card). For example, playing two mono files at the same time, one in the left channel, one in the right independent of each other.

There are a bunch of Python packages out there that use audio I/O libraries such as PortAudio to play files, and PortAudio for example allows you to pick specific channels for playback in some situations, but not for Raspberry Pi.

It is trivial to play a single sound file on all channels at once  but being able to specifically pick which channels to send to is proving extremely challenging.

I'm also trying to configure the ALSA audio framework to treat the channels of a single
device as multiple separate (virtual) devices - (as described here for example:
https://bootlin.com/blog/audio-multi-channel-routing-and-mixing-using-alsalib/<https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin.com%2Fblog%2Faudio-multi-channel-routing-and-mixing-using-alsalib%2F&data=04%7C01%7Cbdawson%40une.edu.au%7Cd3925b8cb3134fbc043108d94b8a9b70%7C3e104c4f8ef24d1483d8bd7d3b46b8db%7C0%7C0%7C637623881413910397%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=ONaTYoBaxOmkyDfCR9fNYYgGssqLAHj5QG8zbIeOVkw%3D&reserved=0>)
but the instructions in that blog are not clear - I’m having a bit of difficulty figuring out the complete configuration to put in the asound.conf file. (If anyone thinks they’d be able to assist me to
make sense of asound syntax, I’d be very happy!)

Has anyone attempted parallel/thread-driven playback of different audio files on different channels on a RPI’s audio device?

Tanks -
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.audioinjector.net/pipermail/people/attachments/20210721/34c6822f/attachment-0001.htm>


More information about the People mailing list