Closed yfangel closed 1 year ago
This problem is really bothering me. Please help me solve it. Thank you! @karasusan
can you help me?Because my boss is eager for me to solve this problem. @karasusan
@yfangel First of all, could you try the latest version of our package? You are using the old version.
@karasusan I have tried the latest version 3.0.0-pre.4, but it still doesn't work.
As long as the microphone is used for local recording while playing the audio stream from the remote device, there will be a lot of echo. It should be a local recording that also recorded the audio stream from the remote device.
I am a novice developer of Unity. Is there any way to solve this problem of recording while playing? thank you very much!
related issue Unity-Technologies/UnityRenderStreaming#563 #587 #651
memo: WRS-152
thank you ,I have looked at it, but I don't see a solution
@karasusan hi,I tried writing the following code in start() ,and it seems that the noise has decreased significantly.
AudioConfiguration config = AudioSettings.GetConfiguration();
//"Best Latency", 256 , "Good Latency", 512,, "Best Performance", 1024
config.dspBufferSize = 1024;
AudioSettings.Reset(config);
if (!AudioSettings.Reset(config))
{
Debug.LogError("yfange----Failed changing Audio Settings");
}
I didn't set it up before. I saw it on Google, but I don't know why it's set up like this, what's the purpose?
You can also change this line here to make it better for webrtc.
while (!(Microphone.GetPosition(deviceName) > 0)) { }
to
while (!(Microphone.GetPosition(deviceName) > 480)) { }
That will produce a bit more latency, but gives the webrtc more stuff to buffer.
I had the same problem and it was reproducible: https://github.com/Unity-Technologies/com.unity.webrtc/issues/839
You can also change this line here to make it better for webrtc.
while (!(Microphone.GetPosition(deviceName) > 0)) { }
towhile (!(Microphone.GetPosition(deviceName) > 480)) { }
That will produce a bit more latency, but gives the webrtc more stuff to buffer.
Okay, I'll give it a try. Thank you
@ZenBre4ker by the way,Would it be better to change the duration in the following code from 1 to 10?
var micClip = Microphone.Start(deviceName, true, 1, 48000);
@yfangel yes, as I said in https://github.com/Unity-Technologies/com.unity.webrtc/issues/839
@yfangel yes, as I said in #839
ok,Thank you, buddy.
Package version
3.0.0-pre.1
Environment
Steps To Reproduce
my code:
1.Obtain local audio from the microphone and transmit it to remote users:
private IEnumerator CaptureAudioStart() { var deviceName = Microphone.devices[0]; var micClip = Microphone.Start(deviceName, true, 1, 48000); // set the latency to “0” samples before the audio starts to play. while (!(Microphone.GetPosition(deviceName) > 0)) { } sourceAudio.clip = micClip; sourceAudio.loop = true; sourceAudio.reverbZoneMix = 0; audioStreamTrack = new AudioStreamTrack(sourceAudio); yield return null; }
2, Obtain audio streams from remote users for real-time playback:
Current Behavior
Why is there a lot of noise when using a microphone to obtain local audio and then simultaneously playing the remote audio stream?
Expected Behavior
No response
Anything else?
No response