This content has been marked as final. Show 3 replies
I'm running into trouble with my next filter. I want to do mixing. I know people have posted snippets for how to mix stereo audio byteArrays, but not mono channels.
What i'm doing currently is using one filter to generate my sawtooth wave and return a mono-channel byteArray. It works great(using Tinic's disassembler/assembler to hack it). Now, as part of my basic testing, I want to pass in this SingleChannel byteArray into a PB filter, and return a two-channel byteArray, that is written to the AudioBuffer. Basically, a 1:1 input:output ratio.
trace ("p0 length: ",p0.length); //a single channel of audio, filled with 2048 floats, or 8192 bytes.
sawMixer.data.v0.input = p0;
sawMixer.data.v0.width = p0.length/4;
sawMixer.data.v0.height = 1;
var mixJob:ShaderJob = new ShaderJob(sawMixer, e.data, p0.length/4, 2);
Here is the PixelBender code:
input image1 v0;
output float3 dst;
dst.r = sampleNearest(v0, outCoord());
dst.g = sampleNearest(v0, outCoord());
The hope is that it will basically copy p0's single channel into the two audio channels. However, it does not. Can anyone explain why not?
Once p0 is generated, I can go e.data.writeBytes(p0) and get nice clean playback, with no stopping. So, p0 IS a valid byteArray of audio sample data. I don't understand why this is failing.
Added in the ability to control panning per voice:
I had to write the PixelBender kernal from scratch, using Tinic's disassembler/assembler.
roundtrip calc time for all 6 voices is still only 4-6ms!!!