gpt4 book ai didi

c# - 如何使用C#播放PC扬声器的音高

转载 作者:行者123 更新时间:2023-12-03 01:22:59 25 4
gpt4 key购买 nike

我正在一个学习项目中,我想更改传入现场音频的音调。我的逻辑是仅更改扬声器的音高,而不更改输入的音频。
我发现这段代码对麦克风传入的音频效果很好。
但是我正在通过LAN连接到另一台PC。

 private void MainForm_Load(object sender, EventArgs e)
{
//Find sound capture devices and fill the cmbInput combo
MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator();
mInputDevices = deviceEnum.EnumAudioEndpoints(DataFlow.Capture, DeviceState.Active);
MMDevice activeDevice = deviceEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Communications);

foreach (MMDevice device in mInputDevices)
{
cmbInput.Items.Add(device.FriendlyName);
if (device.DeviceID == activeDevice.DeviceID) cmbInput.SelectedIndex = cmbInput.Items.Count - 1;
}

//Find sound render devices and fill the cmbOutput combo
activeDevice = deviceEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
mOutputDevices = deviceEnum.EnumAudioEndpoints(DataFlow.Render, DeviceState.Active);
foreach (MMDevice device in mOutputDevices)
{
cmbOutput.Items.Add(device.FriendlyName);
if (device.DeviceID == activeDevice.DeviceID) cmbOutput.SelectedIndex = cmbOutput.Items.Count - 1;
}

}
This is the link of the complete project.
任何人都可以看一下这段代码。

最佳答案

最有可能的是,您需要搜索有关编写/更改驱动程序或扩展音频驱动程序的信息。

关于c# - 如何使用C#播放PC扬声器的音高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60751023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com