Hi, Is it possible to set different sound device for input and output?
I’m using Mac OSX but it would be nice if there’s a cross-platform solution.
Thank you in advance!
yes you need to use 2 ofSoundStrem, one per device and set one of them to only input and the other to only output
I would suggest you to use a bind of either Ableton live, of if you want open source stuff pure data or supercollider, to handle sound within open frameworks. there are a couple of available addons. I wasn’t able to get the Ableton one set and running, but I was able to do so with pd and supercollider. and they are stable, they opensouce, and specially supercollider can be a really nice tool, to get routing throughout complex output routes. it’s not by chance that most wave field synthesis systems use supercollider
Thanks for your answer @arturo but I don’t understand…
Do you mean something like this?
ofSoundStream inputStream, outputStream;
inputStream.setInput();
outputStream.setOutput();
I tried several things but I couldn’t get it to work.
Could you explain a bit more please?
Thanks for your advice!
I am actually using pure data with OF (ofxPd)
And I couldn’t figure out setting the different sound device for input and output.
yeah something like that, it depends on the sñpecifics of your setup but:
inputstream.setDeviceID(0);
inputstream.setup(0,2,44100,4);
outputstream.setDeviceID(1);
outputstream.setup(2,0,44100,4);
inputstream.setInput(this);
outputstream.setOutput(this);
try ofxSupercollier
but the Arturo answer might be as well what you are looking for
with pd I guess if you declare for instance dac~ 3 4 and bind the outputs of pd to openframeworks, that I may perfectly work
hey @cuinjune and others…
I set this two soundStreams, one for input and one for the output. Both are working fine.
Input: to feed the input buffer to my “fft analyser”
Output: running a noise generator taken from the OF\examples\sound\audioOutputExample
void ofApp::audioOut(ofSoundBuffer & buffer){
//...
// ---------------------- noise --------------
for (size_t i = 0; i < buffer.getNumFrames(); i++){
lAudio[i] = buffer[i*buffer.getNumChannels() ] = ofRandom(0, 1);
rAudio[i] = buffer[i*buffer.getNumChannels() + 1] = ofRandom(0, 1);
}
}
and how can you “patch” the input to output?
(to listen the incoming sound signal, not the generated noise)
I want to replace this noise generator, and allow me to listen to the input sound. any idea?
I use the live input to process some FFT and I want to send the “signal” to the out soundStream.
I am using Windows10/VS2017.
I think you just take a copy of what is passed to audioIn, then copy that to the buffer passed to audioOut.
You probably want to protect the buffer you’re using to copy the data with a mutex so audioIn/Out aren’t trying to read/write it at the same time.