This message was deleted.
# helpdesk
s
This message was deleted.
a
yeah for high-quality audio you should try these settings: https://docs.livekit.io/guides/hi-fi-audio/
(which incl. disabling echo cancellation and noise reduction)
i
Okay, how would I set these options in the Unity WebGL SDK via C#? Here is my current C# code to initiate screen share:
Copy code
private IEnumerator BeginScreenShareRoutine()
{
	TrackPublishOptions trackPublishOptions = new TrackPublishOptions
	{
		Name = "ScreenShare_" + GameManager.Instance.GetUserID()
	};

	ScreenShareCaptureOptions screenShareCaptureOptions = new ScreenShareCaptureOptions
	{
		Audio = true    // <-Need to do this in order for screen share to have audio.
		//AudioOptions = new AudioCaptureOptions
		//{
			// TO DO
		//},
		//Resolution = new VideoResolution  // Commenting this out because adjusting framerate appears to break screen share...
		//{
			//FrameRate = 60
		//}
	};

	yield return room.LocalParticipant.SetScreenShareEnabled(true, screenShareCaptureOptions, trackPublishOptions);
}
Does it involve setting stuff up in AudioCaptureOptions? If so, looks like these are all of the options available for AudioCaptureOptions:
Copy code
public struct AudioCaptureOptions
    {
        [JsonProperty("autoGainControl")]
        public ConstrainBoolean? AutoGainControl;

        [JsonProperty("channelCount")]
        public ConstrainULong? ChannelCount;

        [JsonProperty("deviceId")]
        public ConstrainDOMString? DeviceId;

        [JsonProperty("echoCancellation")]
        public ConstrainBoolean? EchoCancellation;

        [JsonProperty("latency")]
        public ConstrainDouble? Latency;

        [JsonProperty("noiseSuppression")]
        public ConstrainBoolean? NoiseSuppression;

        [JsonProperty("sampleRate")]
        public ConstrainULong? SampleRate;

        [JsonProperty("sampleSize")]
        public ConstrainULong? SampleSize;
    }
What should I set all of the above to?
Looks like I can also set
TrackPublishOptions
:
Copy code
public struct TrackPublishOptions
    {
        [JsonProperty("name")]
        public string Name;
        [JsonProperty("source")]
        public TrackSource? Source;

        // TrackPublishDefaults copied (no struct inheritance)
        [JsonProperty("videoEncoding")]
        public VideoEncoding? videoEncoding;
        [JsonProperty("screenShareEncoding")]
        public VideoEncoding? ScreenShareEncoding;
        [JsonProperty("videoCodec")]
        public VideoCodec? VideoCodec;
        [JsonProperty("audioBitrate")]
        public int? AudioBitrate;
        [JsonProperty("dtx")]
        public bool? DTX;
        [JsonProperty("simulcast")]
        public bool? Simulcast;
        [JsonProperty("stopMicTrackOnMute")]
        public bool? StopMicTrackOnMute;
        [JsonProperty("videoSimulcastLayers")]
        public VideoPreset[] VideoSimulcastLayers;
        [JsonProperty("screenShareSimulcastLayers")]
        public VideoPreset[] ScreenShareSimulcastLayers;
    }
So, now, I think I just need advice for how to properly translate the information for hi-fi audio to the Unity WebGL SDK via
AudioCaptureOptions
and
TrackPublishOptions
. Right? It looks like some of the settings are available, such as
ChannelCount
,
EchoCancellation
,
NoiseSuppression
, and
DTX
, however I don't see anything for
audioPreset
or
red
. I do see
AudioBitrate
though. Could you please advise? Thanks!
Hey @acoustic-engineer-41666, just wanted to follow up about this one! Would @boundless-energy-78552 be the right person to ask for the Unity way to apply settings for hi-fi audio? Do I just need to change this:
Copy code
private IEnumerator BeginScreenShareRoutine()
{
	TrackPublishOptions trackPublishOptions = new TrackPublishOptions
	{
		Name = "ScreenShare_" + GameManager.Instance.GetUserID()
	};

	ScreenShareCaptureOptions screenShareCaptureOptions = new ScreenShareCaptureOptions
	{
		Audio = true    // <-Need to do this in order for screen share to have audio.
		//AudioOptions = new AudioCaptureOptions
		//{
			// TO DO
		//}
	};

	yield return room.LocalParticipant.SetScreenShareEnabled(true, screenShareCaptureOptions, trackPublishOptions);
}
To this?
Copy code
private IEnumerator BeginScreenShareRoutine()
{
	TrackPublishOptions trackPublishOptions = new TrackPublishOptions
	{
		Name = "ScreenShare_" + GameManager.Instance.GetUserID(),
        DTX = false,
        AudioBitrate = 320000  //???
	};

	ScreenShareCaptureOptions screenShareCaptureOptions = new ScreenShareCaptureOptions
	{
		Audio = true,    // <-Need to do this in order for screen share to have audio.
		AudioOptions = new AudioCaptureOptions
		{
			ChannelCount = 2,
            EchoCancellation = false,
            NoiseSuppression = false
		}
	};

	yield return room.LocalParticipant.SetScreenShareEnabled(true, screenShareCaptureOptions, trackPublishOptions);
}
Is this the right way to do it, and am I missing any important settings?