c#调整播放的wav文件的音量 [英] c# adjust volume of played wav file
本文介绍了c#调整播放的wav文件的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C#visual studio windows窗体项目。
是否可以使用System.Media命名空间调整播放的wav文件的音量?
我可以使用microsoft.com上的代码播放该文件,但我无法找到将音量设置为给定级别的方法。
C# visual studio windows form project.
Is it possible to adjust the volume of a played wav file with the System.Media namespace ?
I'm able to play the file with the code found on microsoft.com, but I can't find a way to set the volume at a given level.
private void playSimpleSound()
{
SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
simpleSound.Play();
}
推荐答案
它没有自己的音量。您可以执行以下两项操作之一:调整系统音量或修改要播放的波形音量。
在系统音量控制上,请参阅: http://www.dreamincode.net/forums/topic/45693- control-sound-volume-in-c%23 [ ^ ]。
您还可以动态重新计算波形音量并输出新波形。请参阅: https ://social.msdn.microsoft.com/Forums/vstudio/en-US/42b46e40-4d4a-48f8-8681-9b0167cfe781/attenuating-soundplayer-volume?forum = csharpgeneral [ ^ ]。
-SA
It does not have its own volume. You can do one of two things: adjust the system volume level or modify the volume of the waveform you want to play.
On the system volume control, please see: http://www.dreamincode.net/forums/topic/45693-controlling-sound-volume-in-c%23[^].
You can also recalculate the waveform volume on the fly and output new waveform. Please see: https://social.msdn.microsoft.com/Forums/vstudio/en-US/42b46e40-4d4a-48f8-8681-9b0167cfe781/attenuating-soundplayer-volume?forum=csharpgeneral[^].
—SA
这篇关于c#调整播放的wav文件的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文