LancePutnam / Gamma

Generic (Sound) Synthesis Library
Other
458 stars 54 forks source link

Multiple AudioIO Objects and syncing data #55

Open Demolishun opened 4 years ago

Demolishun commented 4 years ago

I want to be able to bring in audio from multiple AudioIO sources and do processing on the streams in the same space.

I have been reading through the AudioIO.h class and have been thinking I can create a master AudioIO object that has an active callback after calling start(). On additional AudioIO I can open() the device and then call the callback manually to get at the data. Somehow I will want to write this data to a location that the master callback has access to. If I understand correctly these are in different threads when the callback is called. So this makes getting the data from each AudioIO interesting.

Is there a way to use the AudioIO object itself to get a sample/frame? This way I don't have separate threads to pull data from. I will keep the sample rates consistent so it should keep the data itself in sync fairly well.

I was thinking about using this library to make a more sophisticated visual audio tool. It would allow me to connect different objects with wires to build up a synthesizer. However, I am not sure if this library is able to be used that way. Would this library work for this? I am unsure, but this library seems pretty rigid on how it can be used. Is there a different library that might be easier to build a visual editor with?

LancePutnam commented 4 years ago

AudioIO is provided only for convenience, therefore may not fit your use case. To be clear, the audio synthesis/processing components of the library were designed to be completely independent of audio streaming for the exact purpose of making the library non-rigid. You can just as easily do non-real-time stuff, build plugins, etc. Pretty much all synthesis libraries I know of are designed this way. You might need to build up your own audio i/o from PortAudio, RTAudio or whatever to aggregate streams from different devices into one multi-channel sample block. After that, you can use the synthesis objects like you would in any other scenario.

Demolishun commented 4 years ago

Thank you for the clarification. I guess I was just not seeing how to provide input/output for data other than AudioIO. I will keep reading to get my head around the library.

I modified the library to use Qt threading. Do you want those changes? I was hesitant to do a pull request because my editor changed the source file to all spaces instead of tabs.