filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.15k stars 451 forks source link

How to apply Equalizer to soundInSource created by WASAPICapture or WASAPILoopbackCapture? #381

Closed JohnsonGao closed 5 years ago

JohnsonGao commented 5 years ago

Hi Florian, I can play the captured stream now, but failed to append an Equalizer for the SoundInSource, So where is the problem for this? How should I apply EQ to a captured stream? Codes here but it doesn't work. Thanks a lot!

var _soundInSource = new SoundInSource(_soundIn) { FillWithZeros = true };

_soundInSource
.ToSampleSource() .AppendSource(Equalizer.Create10BandEqualizer, out _equalizer) .ToWaveSource();

var soundOut = new WasapiOut(); soundOut.Initialize(soundInSource); soundOut.Play();

filoe commented 5 years ago

Hi @JohnsonGao, you have to initialize the soundOut with the result of the whole chain. That means:

IWaveSource source = _soundInSource
.ToSampleSource()
.AppendSource(Equalizer.Create10BandEqualizer, out _equalizer)
.ToWaveSource();
...
soundOut.Initialize(source);
...