# Mic input for Asio devices

**URL:** <https://qa.fmod.com/t/mic-input-for-asio-devices/17162>\
**Category:** FMOD Engine\
**Tags:** unity\
**Created:** [May 6, 2021, 12:31pm UTC](https://qa.fmod.com/t/mic-input-for-asio-devices/17162 "2021-05-06T12:31:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Opus.Pier](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/opus.pier/32/2221_2.png) [@Opus.Pier](https://qa.fmod.com/u/Opus.Pier)\
**Post date:** [May 6, 2021, 12:31pm UTC](https://qa.fmod.com/t/mic-input-for-asio-devices/17162/1 "2021-05-06T12:31:41Z")

</div>

I’m working on Unity/Windows, and would like to use the mic from an Asio device.

So far, I’m doing something similar to what’s on this question:

> [@Mic state when recording](https://qa.fmod.com/t/mic-state-when-recording/15977):
>
> Hey there, I recently posted a question and kept digging further. I now got a mic working with FMOD in Unity, and am able to hear myself. There is some weird stuff happening still though. When I talk thru the microphone, it sounds very distorted. Another odd thing that happens is the recording looping back. So after a little while, I hear the recording of before basically. Feel like I’m getting closer to my endpoint, but currently stuck on the mic sounding distorted and the looping. A comple…

With the difference that just before the init, I set up the Asio device.

```
system.setOutput(FMOD.OUTPUTTYPE.ASIO);
system.setDriver(deviceId);
system.setDSPBufferSize(dspBufferSize, dspBuffersCount);

```

If I leave out the first line and select a “normal” (non-Asio) mic, it works fine.  
If I add the first line, I’m always getting 0 from getRecordPosition. There doesn’t seem to be any errors thrown, and isRecording is returning true.

Is there anything else that needs to be set up to use the mic from an Asio Device? Or any suggestion on how to troubleshoot this?  
(I’ll try to clean up and upload a bigger part of the code, if it’s helpful)

By the way, I tested the device in OBS (using this plugin: [GitHub - Andersama/obs-asio: ASIO plugin for OBS-Studio](https://github.com/Andersama/obs-asio)) and it seems to be working fine there, so I’m guessing there are no issues with the drivers or hardware.

Thanks!

---

<div class="post-metadata">

**Author:** ![Opus.Pier](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/opus.pier/32/2221_2.png) [@Opus.Pier](https://qa.fmod.com/u/Opus.Pier)\
**Post date:** [May 7, 2021, 2:04pm UTC](https://qa.fmod.com/t/mic-input-for-asio-devices/17162/2 "2021-05-07T14:04:05Z")

</div>

Turned out that the value that I was using for the dspBufferSize was not correct.  
It didn’t throw an error or anything, but the data was not being captured.  
(Setting clearly wrong values do send an error on init, though.)

After testing for a while, a value of 512 turned to work fine for the device I’m using.  
Since no other value seems to be working, is there a way to programmatically find this value, or has it has to be found by trial and error?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 11, 2021, 6:03am UTC](https://qa.fmod.com/t/mic-input-for-asio-devices/17162/3 "2021-05-11T06:03:10Z")

</div>

FMOD should be setting using the optimal buffer size by default, so you shouldn’t need to set it manually. If you do need to set it manually then you will need the sample rate from [System::getDriverInfo](https://fmod.com/resources/documentation-api?version=2.2&page=core-api-system.html#system_getdriverinfo) to help determine the best buffer size to use.

See [System::setDSPBufferSize](https://fmod.com/resources/documentation-api?version=2.2&page=core-api-system.html#system_setdspbuffersize) for more info.
