# Start(string, bool, int, int)

> Start Recording with device.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AudioModule

```csharp
public static AudioClip Start(string deviceName, bool loop, int lengthSec, int frequency)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the device.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Indicates whether the recording should continue recording if lengthSec is reached, and wrap around and record from the beginning of the AudioClip.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Is the length of the AudioClip produced by the recording.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The sample rate of the AudioClip produced by the recording. Use [\_outputSampleRate](/engine/6000.7/script-reference/unityengine/audiosettings/outputsamplerate.md) so the recording matches the project's output sample rate.

### Returns

| Type                                                                  | Description                                                |
| --------------------------------------------------------------------- | ---------------------------------------------------------- |
| [AudioClip](/engine/6000.7/script-reference/unityengine/audioclip.md) | The function returns null if the recording fails to start. |

### Remarks

If you pass a null or empty string for the device name then the default microphone is used. You can get a list of available microphone devices from the [\_devices](/engine/6000.7/script-reference/unityengine/microphone/devices.md) property and the range of sample rates supported by a microphone from the [Microphone.GetDeviceCaps](/engine/6000.7/script-reference/unityengine/microphone/getdevicecaps.md) property.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    // Start recording with built-in Microphone and play the recorded audio right away
    void Start()
    {
        AudioSource audioSource = GetComponent<AudioSource>();
        audioSource.clip = Microphone.Start("Built-in Microphone", true, 10, AudioSettings.outputSampleRate);
        audioSource.Play();
    }
}
```
