We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › output different sounds into different channels
Page Index Toggle Pages: 1
output different sounds into different channels (Read 3967 times)
output different sounds into different channels
Aug 25th, 2005, 3:49pm
 
Hi,

I'm doing an interactive sound installation, and I need to playback different sounds into different speakers (more precisely, 15 output channels, small detail...).

Does anybody know if this is possible with Processing?

Recap: keystroke A plays sound A and outputs to channel A, and so forth.

Thanks,
A.
Re: output different sounds into different channel
Reply #1 - Aug 26th, 2005, 2:21am
 
Good to see you are also pursuing this problem, Arlete!  Wink

I know Sonia will allow output to 0 and 1 for LEFT and RIGHT channels, but I don't know whether it extends above that, if you have more channels available on your system.

I've asked Krister about the ESS libraries for Processing, so we'll hopefully see if there is an option with ESS too...

-Brock
Re: output different sounds into different channel
Reply #2 - Nov 17th, 2005, 11:17pm
 
What hardware support 15 channels??
Re: output different sounds into different channel
Reply #3 - Dec 30th, 2005, 8:18pm
 
I have a similar problem, need more channels for both input and output.

I suppose JSyn itself (which Sonia is built upon) is capable of managing multiple sound channels, as discussed here
http://www.softsynth.com/jsyn/support/multichannel.html

However, can't find any method signatures which would permit Sonia's simple processing programming model to be applied to multiple channels - shame. Perhaps somebody else knows the trick here.

As far as devices go, (the last questioner) there are multi-channel sound devices such as this from SEKD http://store.yahoo.com/sekd-store/prodif88.html , which has 4 channels (8 mono channels?) and can be chained together inside a PCI-compliant machine to create 32 synchronized mono channels but is expensive.

For my current project we would like to simultaneously control sampling, through-routing and playback across 16 or more channels.

I have settled on using USB handset interfaces (of the kind which Plantronics sells for use with Skype and iChat). These can be multiplexed indefinitely through USB hubs I believe, giving you as many channels as you want, without much cost. However, I need to verify this by buying up a load of them and trying to plug them into the various hubs.  

These low quality devices can be combined with something like the Behringer HA8000 for amplification if necessary http://www.behringer.com/HA8000/index.cfm?lang=ENG (thanks to Martin Russ for finding this).

Guess at some point there might be a power issue with too many USB power sinks in parallel, but this is fixable. Also sound quality is maybe an issue for fancier projects. It's not really an issue for us.

If anyone is interested http://cefn.com/curiosity/?pagename=pipedreams is the main tracker page for my current project.
Re: output different sounds into different channels
Reply #4 - Mar 11th, 2010, 4:29pm
 
I know this is an old thread, but I spent many hours looking into this and thought I'd share what I learned.

I have a firewire audio device that provides 10 inputs and 10 outputs, and I wanted to be able to address each output separately in order to create some custom audio software for a local theater (surround sound, interactive audio, etc).  The way that Windows sees the device is as five stereo lines.  So, the physical plugs labeled output 1 and output 2 are the left and right channel of the first line, and so on up to 10.

Using Minim, I was able to make this work so that I can add signals to each physical plug separately, which allows me to mix custom audio channels to each plug depending on the speaker configuration and audio design for a given performance.

The trick is to loop through the available output lines and use Minim.setOutputMixer(mixer) when you are initializing the sketch, and then keep a reference to each AudioOutput in an array.  It turns out you can have many AudioOutputs open at the same time without any trouble.  I had to write some custom implementations of the Minim interfaces in order to split the stereo outputs into logical "jacks" for each output on the sound card, but you can indeed use more than one output simultaneously.

One BIG catch though: If you are using more than one sound device, they will likely be way out of sync when playing audio.  For example, I have the firewire audio device and the normal sound device on the motherboard.  When playing a drum beat on both at the same time you can hear that they are WAY off time with each other.  This might not be a problem if you are just playing separate sounds out of each channel, but I was trying to fade a sound from channel to channel (to do surround sound) so they have to be in sync.  I found that as long as I only use outputs on the firewire device, it says in sync.  Based on my very minimal understanding of audio hardware, I believe this is due to the audio devices having their own internal clocks, so as long as you stick to a single device it should stay in sync with itself even if it has many outputs/inputs.

Anyways, just wanted to post my findings since I was unable to find the solution even after many hours of looking around online.  Feel free to send me a note or reply if you want to know more specifics and see code snippets for how I got it working.
Re: output different sounds into different channels
Reply #5 - Mar 23rd, 2010, 11:28am
 
Hi rrrufusss.

I want to control several mono outputs in processing.
For now, i'm only trying to control the Mackbook pro left and right channels separately.
Following your lead, i've found this example in minim manual

code.compartmental.net/minim/examples/Minim/setOutputMixer/ .

I've tried the example in MacOSX and i only see the following mixers:

-  JavaSound Audio Engine;
- Built-in microphone;
- Built-in Input.

Running in windows (on top of parallels) i'm able to see the following mixers:

- Primary sound driver;
- Intel(r) Integrated Audio;
- Primary Sound Capture Driver;
- Intel(r) Integrated Audio;
-  JavaSound Audio Engine;
- Port Intel(r) Integrated Audio.

I also tried to change
Code:
out = minim.getLineOut(Minim.STEREO) 


to
Code:
out = minim.getLineOut(Minim.MONO) 




but i'm not able to make the sound play on left or right speaker separately.

What am i doing wrong? any suggestions?

thanks.
Re: output different sounds into different channels
Reply #6 - Mar 23rd, 2010, 2:46pm
 
It sort of depends on how complicated you want to get.  You could solve that a couple of ways.

First of all, are you just trying to play sounds out of each channel separately

For separate sounds, you can just use a stereo line out, and set the panning on the sounds you want to play.  The AudioPlayer, AudioSnippet, and AudioSample all implement the Controller interface, so they all have the setPan(float p) method.

See javadoc:
http://code.compartmental.net/minim/javadoc/ddf/minim/Controller.html#setPan%28f...

So, you could open the stereo output, load a couple of sound files in, and just set the pan for each one to 1 or -1 to pan them completely apart.

If you are ONLY using two channels, you can also cross-fade by setting the panning value to something between -1 and 1.

For more than two channels, it get's much more complicated because you have to create a custom class that implements AudioSignal and do all the mixing with your own code.  This means generateing a bunch of different mono signals, mapping them to the different left/right pairs, and send them to the different stereo outputs.

That's what I ended up doing so I could use all 8 of the outputs on my firewire sound device and fade sounds between all 8 of them at once to create custom surround-sound speaker layouts.  It's a little convoluted but it works.
Re: output different sounds into different channels
Reply #7 - Mar 24th, 2010, 3:55am
 
Ok, thanks rrrufusss.

Re: output different sounds into different channels
Reply #8 - Apr 6th, 2010, 11:43am
 
hello , pardon for my bad english, I'm trying to do it with my fireface 800, but I can't find a good way, I need to connect 4 different channels and control the start and volume of some wav files, can you give me some examples about how you did it?
many thanks Smiley
Page Index Toggle Pages: 1