I'd like to run a Matlab algorithm (using the Audio System Toolbox) between the audio IO peripherals (i.e. a mic and a loudspeaker) and an external application.
Essentially, I'd like to get the mic signal of my laptop, process it through Matlab and send it to the audio input of the app. Similarly, I'd like to get the audio output of the app, process it through Matlab and send it to the loudspeaker of my laptop.
I managed to get a working framework using an external sound card (and external mic/loudspeaker, i.e. not those of my laptop) in something like what is shown in the following figure. To do so, I create an audioPlayerRecorder object with 2 inputs and 2 outputs and I physically loop back the signals in the 2nd block I denoted as External soundcard. Not very pretty but it works.
However, I'd like to avoid using the external sound card and external mic/loudspeaker, leading to something similar to this
My initial idea was that of using a virtual audio routing program, like JACK or the like, but I didn't have much luck with it. Is there a way to handle such a situation directly from Matlab? Or do you have any suggestion?
I'd like to know if anybody had to do something similar before and how(if) they managed.