naudio相关代码

产生风鸣 静音 风鸣

var beep1 = (new SignalGenerator(){ Frequency = 1000, Gain = 0.2}).Take(TimeSpan.FromSeconds(2));
var silence = new SilenceProvider(beep1.WaveFormat).ToSampleProvider().Take(TimeSpan.FromSeconds(2));
var beep2 = (new SignalGenerator() { Frequency = 1500, Gain = 0.2 }).Take(TimeSpan.FromSeconds(2));
var concat = beep1.FollowedBy(silence).FollowedBy(beep2);
using (var wo = new WaveOutEvent())
{
    wo.Init(concat);
    wo.Play();
    while(wo.PlaybackState == PlaybackState.Playing)
    {
        Thread.Sleep(500);
    }
}

 pcm码

采样率

db

short float

posted @ 2023-08-16 11:13  simadi  阅读(6)  评论(0编辑  收藏  举报