Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Microphone.Start

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function Start(deviceName: string, loop: bool, lengthSec: int, frequency: int): AudioClip;
public static AudioClip Start(string deviceName, bool loop, int lengthSec, int frequency);

Parámetros

deviceName The name of the device.
loop Indicates whether the recording should continue recording if lengthSec is reached, and wrap around and record from the beginning of the AudioClip.
lengthSec Is the length of the AudioClip produced by the recording.
frequency The sample rate of the AudioClip produced by the recording.

Valor de retorno

AudioClip The function returns null if the recording fails to start.

Descripción

Start Recording with device.

If you pass a null or empty string for the device name then the default microphone will be used. You can get a list of available microphone devices from the devices property. You can find the range of sample rates supported by a microphone using the GetDeviceCaps property.

Note that if you want to use the Microphone class in the web player, you need to get the user's permission to do so. Call Application.RequestUserAuthorization before calling any Microphone methods.

// Start recording with built-in Microphone and play the recorded audio right away
function Start() {
	var aud = GetComponent.<AudioSource>();
	aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100);
	aud.Play();
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { AudioSource aud = GetComponent<AudioSource>(); aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100); aud.Play(); } }