I have a sound card that allows for 24 audio inputs. I can get 2 channels working but am having difficulty getting 8 can anyone help me, I will post the appropriate parts of the code below. I have tried various code for audioReceived and audioRequested methods in the cpp but never get anywhere.
Yes I set it as default and tested it with 2 channels It works easily, (I am on OSX and using a firewire soundcard from Maudio- profire 2626) I get 2 channels in and out fine but when I go to get more I can’t make it work.
I am truly a beginner though and mostly was just guessing on how to get more channels to play out. I dont want to do anything with them except to change the volume and pan (I want them to come back into stereo).
The audio output and input in ofSoundStream is “interleaved”. This means that samples are played back one channel at a time.
e.g. for an 8 channel sound stream (each number represents both a sample value and the current output channel):
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
for stereo (2 channel sound):
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
and quad (4 channel sound):
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
That’s the whole point of the for loop in the audioReceived and audioRequested…to interleave the samples. In the OF example, it’s only using stereo and therefore 2 channels. To extend this to multichannel, you need to add more channels, something like:
In this last example, you divide by 4.0f because you want 4 channels to merge into 1 on each output. I use “4.0f” and not “4” because we are using floats for our audio output.
we have a lot of plans for sound in the next 12 months, like implementing an ofSoundBuffer that will simplify sound data the way ofPixels simplifies pixel data, it will take care of interleaving/non interleaving.