Python Script Sends Each Speaker Its Own Sound File

When it comes to audio, the number of speakers you want is usually governed by the number of tracks or channels your signal has. One for mono, two for stereo, four for quadrophonic, five or more for surround sound and so on. But all of those speakers are essentially playing different tracks from a “single” audio signal. What if you wanted a single audio device to play eight different songs simultaneously, with each song being piped to its own speaker? That’s the job [Devon Bray] was tasked with by interdisciplinary artist [Sara Dittrich] for one of her “Giant Talking Ear” installation project. He built a device to play multiple sound files on multiple output devices using off the shelf hardware and software.

But maybe a hack like this could be useful in many applications other than just art installations. It could be used in an Escape room, where you may want the various audio streams to start in synchronicity at the same time, or as part of a DJ console, sending one stream to the speakers and another to the head phones, or a game where you have to run around a room full of speakers in the right sequence and speed to listen to a full sentence for clues.

His blog post lists links for the various pieces of hardware required, although all of it is pretty generic, and the github repository hosts the code. At the heart of the project is the Sounddevice library for python. The documentation for the library is sparse, so [Bray]’s instructions are handy. His code lets you “take a directory with .wav files named in numeric order and play them over USB sound devices attached to the host computer over and over forever, looping all files once the longest one finishes”. As a bonus, he shows how to load and play sound files automatically from an attached USB drive. This lets you swap out your playlist on the Raspberry Pi without having a use a keyboard/mouse, SSH or RDP.

Check the video after the break for a quick roundup of the project.

 

8 thoughts on “Python Script Sends Each Speaker Its Own Sound File

    1. Tool also used this effect on their album 10000 Days. The track 10000 Days is supposed to be played concurrently with Viginti Tres followed by Wings for Marie. The latter two songs are kinda weird on their own (especially Viginti Tres), but make way more sense when played like this.

  1. Stereo means two or more!

    stereoDictionary result for stereo
    /ˈstɛrɪəʊ,ˈstɪərɪəʊ/Submit
    noun
    1.
    sound that is directed through two or more speakers so that it seems to surround the listener and to come from more than one source; stereophonic sound.

      1. “So you could direct a mono- source through multiple speakers and suddenly it’s stereo?” – Yes!

        And it doesn’t just refer to sound. You can also have stereo vision which can refer to have 2 or more cameras.

  2. Audacity can play multiple channels and with a timer play-record command but only one event not many. I now have a discreet quad system so I need to experiment. However just the other day I got a bug that has me miffed. Wasapi recording mode does not work now, no help on the web. Another salvo in the copy-wrong people war? Remember ‘stereo mix’ and ‘what you hear’ on every sound card, they disappeared to keep us from recording what is streaming online. Now windoze seems to be guilty here as Audacity is not at fault.

    So! How to get around recording the web now, search. In keeping with the theme of this post I found Voicemeeter Banana and Potato. They are like Jack in Linux but for Windows. A slick looking interface, 3 in 3 out mixer! You can route the stream to any “device”. They mention using multiple sound cards! Something that windoze has always had a problem with. I haven’t downloaded yet but check it out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.