- Home /
Prevent Feedback while recording audio RT
Im trying to use a in-game talk system. problem is Microphone
also records from speaker and it makes a loop back... here is a piece of code I started with:
using UnityEngine;
using System.Collections;
public class AudioInput : MonoBehaviour {
public AudioSource _AudioSource;
// Use this for initialization
void Start () {
BeginListener (0);
}
// Update is called once per frame
void Update () {
}
public void BeginListener(int index)
{
_AudioSource = GetComponent<AudioSource> ();
int min = 0;
int max = 0;
Microphone.GetDeviceCaps(Microphone.devices[index], out min, out max);
_AudioSource.clip = Microphone.Start(Microphone.devices[index], true, 10, max);
while (!(Microphone.GetPosition(Microphone.devices[index]) > 1))
{
// Wait until the recording has started
}
Debug.Log (Microphone.devices.Length);
_AudioSource.loop = true;
_AudioSource.Play();
}
}
there will be atleast 5 players speakin to each other. I think I need to play while not recording or record while not playing (is it possible to miss some audio if I do this? ).
how can I check if audio is recording/playing and how can I then playing/recording ?
work with a threshhold? i’d guess the loop is something common in audioengenering, which you propably have to search in this field.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182404im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to calculate buffer size of OnAudioFilterRead? 1 Answer
Problem with audio 1 Answer
Trying to monitor the incoming audio from external usb interface 0 Answers
3D audio not working on trigger 0 Answers
In-game sound turns off when I play 0 Answers