マイク (またはライン入力) からオーディオ データを録音し、C# を使用してもう一度再生しようとしています。
これを達成する方法について何か提案はありますか?
マイク (またはライン入力) からオーディオ データを録音し、C# を使用してもう一度再生しようとしています。
これを達成する方法について何か提案はありますか?
NAudioを使用するオープン ソースの.NET Voice Recorderプロジェクトをご覧ください。それがどのように機能するかを説明するCoding4Fun に関する記事があります。
コンソールとマルチスレッドの記録と再生を参照してください
class Program
{
static void Main(string[] args)
{
rex.Data += new RecorderEx.DataEventHandler(rex_Data);
rex.Open += new EventHandler(rex_Open);
rex.Close += new EventHandler(rex_Close);
rex.Format = pcmFormat;
rex.StartRecord();
Console.WriteLine("Please press enter to exit!");
Console.ReadLine();
rex.StopRecord();
}
static RecorderEx rex = new RecorderEx(true);
static PlayerEx play = new PlayerEx(true);
static IntPtr pcmFormat = AudioCompressionManager.GetPcmFormat(1, 16, 44100);
static void rex_Open(object sender, EventArgs e)
{
play.OpenPlayer(pcmFormat);
play.StartPlay();
}
static void rex_Close(object sender, EventArgs e)
{
play.ClosePlayer();
}
static void rex_Data(object sender, DataEventArgs e)
{
byte[] data = e.Data;
play.AddData(data);
}
}