# about recordStart on unity

**URL:** https://qa.fmod.com/t/about-recordstart-on-unity/13122
**Category:** Unity
**Created:** [April 20, 2017, 7:42am UTC](https://qa.fmod.com/t/about-recordstart-on-unity/13122 "2017-04-20T07:42:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chhh](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chhh](https://qa.fmod.com/u/chhh)
#### Post date: [April 20, 2017, 7:42am UTC](https://qa.fmod.com/t/about-recordstart-on-unity/13122/1 "2017-04-20T07:42:25Z")

</div>

Hi, Guys.  
Sorry for my poor English.  
I come across a problem. I have an app that attempting to record sounds through microphone.but I found that it can’t work well.And here is my code:

```
public void OnRecordClick(GameObject go)
 {
    FMOD.RESULT m_Result;

    if (Application.platform == RuntimePlatform.Android)
    {
        FMODUnity.RuntimeManager.LowlevelSystem.setOutput(FMOD.OUTPUTTYPE.OPENSL);
    }

     CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO();
     exinfo.cbsize = Marshal.SizeOf(exinfo);
     exinfo.numchannels = 1;
     exinfo.format = SOUND_FORMAT.PCM16;
     exinfo.defaultfrequency = 44100;
     exinfo.length = (uint)(exinfo.defaultfrequency * exinfo.numchannels*sizeof(short))*8;

     FMOD.MODE soundMode = MODE.OPENUSER | MODE.LOOP_NORMAL ;
     m_Bytes = new byte[exinfo.length + 1];

     m_Result = FMODUnity.RuntimeManager.LowlevelSystem.createSound(m_Bytes, soundMode, ref exinfo, out m_Sound);

    if (m_Result != FMOD.RESULT.OK)
     {
         UnityEngine.Debug.Log("failed to createSound:" + m_Result);
         return;
     }

     FMOD.RESULT result = FMODUnity.RuntimeManager.LowlevelSystem.recordStart(0, m_Sound, true);

    if (result != FMOD.RESULT.OK)
    {
        UnityEngine.Debug.Log("failed to startrecord:" + result);         
    }else
    {
        m_isrecording = true;
        UnityEngine.Debug.Log("OnRecordClick" + result);
    }
}

```

I have alreay added "android.permission.RECORD\_AUDIO"to the “AndroidManifest.xml” file.

When runnint the function: LowlevelSystem.recordStart the result it that “failed to startrecord:ERR\_INVALID\_PARAM”.

what is more, the fmod.log info as follow:

[LOG] AsyncThread::threadFunc : Finished Asynchronous operation on sound 0000000021A36B48  
[LOG] SoundI::getSubSound : sound 0000000021A36B48. Subsound index 0 / 1  
[LOG] SystemI::updateRecordCache : Enumerating 2 record drivers  
[LOG] SystemI::updateRecordCache : 0. Found record driver: ‘S/PDIF (M-Audio Delta AP 192)’  
[LOG] SystemI::updateRecordCache : 1. Found record driver: ‘Line 1/2 (M-Audio Delta AP 192)’  
[LOG] SystemI::createSoundInternal : filename = : mode 00000402  
[LOG] SystemI::createSoundInternal : exinfo-\>cbsize = 232  
[LOG] SystemI::createSoundInternal : exinfo-\>numchannels = 1  
[LOG] SystemI::createSoundInternal : exinfo-\>defaultfrequency = 44100  
[LOG] SystemI::createSoundInternal : exinfo-\>format = 2  
[LOG] SystemI::createSoundInternal : Format has 0 subsounds.  
[LOG] SystemI::createSoundInternal : Create as FMOD\_CREATESAMPLE  
[LOG] SystemI::createSoundInternal : creating subsound 0/0  
[LOG] SystemI::createSample : mode 00000402 length 0 samples, lengthbytes 0  
[LOG] SystemI::createSample : channels = 1  
[LOG] SystemI::createSample : output = 00000000217C76A8  
[LOG] OutputSoftware::createSample : lengthpcm 0, lengthbytes 0, channels 1, format 2, freq 44100, mode 0000040a  
[LOG] SystemI::createSoundInternal : No name found in file, use filename.  
[LOG] SystemI::createSoundInternal : done. OpenState now = FMOD\_OPENSTATE\_READY.

[ERR] SystemI::recordStart : Invalid sound, must be an FMOD::Sound with positive length created as FMOD\_CREATESTREAM.  
c:\jk\workspace\Build\_\_1.8\_\_UnityLibs\_Win\lowlevel\_api\src\fmod\_system.cpp(1265) : [LOG] FMOD\_RESULT = 31 – An invalid parameter was passed to this function.  
[LOG] SystemI::mixerSuspend : Suspending output.  
[LOG] SystemI::mixerResume : Resuming output.

I’m entirely unsure what else to do. Help?

---

<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: [April 21, 2017, 5:33am UTC](https://qa.fmod.com/t/about-recordstart-on-unity/13122/2 "2017-04-21T05:33:43Z")

</div>

This has been fixed in a patch since 1.08.04, updating to the latest 1.08 version will solve the issue.

---

<div class="post-metadata">

### Author: ![chhh](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chhh](https://qa.fmod.com/u/chhh)
#### Post date: [April 25, 2017, 6:34am UTC](https://qa.fmod.com/t/about-recordstart-on-unity/13122/3 "2017-04-25T06:34:53Z")

</div>

> [@](#):
>
> This has been fixed in a patch since 1.08.04, updating to the latest 1.08 version will solve the issue.

thanks for your help!

I upgrade to the latest FMOD Unity Integration fmodstudio10904\_v2.unitypackage.

And the recordStart function works well on the windows platform.

But thrown out an error: FMOD.RESULT.ERR\_INTERNAL when running on the android platform.

---

<div class="post-metadata">

### Author: ![chhh](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@chhh](https://qa.fmod.com/u/chhh)
#### Post date: [April 25, 2017, 7:51am UTC](https://qa.fmod.com/t/about-recordstart-on-unity/13122/4 "2017-04-25T07:51:13Z")

</div>

oh, It’s my fault.I forget to add the " android.permission.RECORD\_AUDIO " to the AndroidManifest.xml. Sorry.
