Audio I/O Demo 4-- Setting up a microphone feedback loop ============================================================== This demo records microphone input or audio in and plays it back on audio out. DatapixxMicrophoneDemo can be called with argument 1 or 2, where 1 is for a microphone and 2 is for an audio in source. A microphone needs a bigger gain, otherwise the code is very similar for both sources. This is a loopback demo, we record audio at 48 kHz and for a maximum of 20 MB/100 seconds of data ``Datapixx('SetMicrophoneSchedule', 0, 48000, 0, 3, 0, 5e6);``. We then acquire the number of audio frames recorded ``status = Datapixx('GetMicrophoneStatus');`` and ``nFrames = status.newBufferFrames;``, then we play it back with an audio schedule: ``Datapixx('SetAudioSchedule', 0, 48000, nFrames, 3, 0);``. .. literalinclude:: ../DatapixxToolbox/DatapixxDemos/DatapixxMicrophoneDemo.m :language: matlab :emphasize-lines: 28, 51, 52, 69-70, 98-100 :linenos: