使用NAudio Nuget包,很容易实现录制系统音频。
首先将NAudio Nuget包安装到项目中。
Demo使用的是WPF,WinForm实现一样。
简单的界面,一个Button和一个TextBlock。
<Window x:Class="NAudioCaptureSystemAudioWPFTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:NAudioCaptureSystemAudioWPFTest"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center