문제

몇 일 이후,나는 기음#을 사용하여 이퀄라이저를 만들려고하고있다.나 디오 꽤 많은 시간을 본,하지만 난 나 디오와 함께 작동 할 모든 작업 이퀄라이저를 찾을 수 없습니다.이제 며칠 후,나는 마침내 여기에 있습니다@스택 오버 플로우 그리고 잘하면,당신은 다음을 사용하여 이퀄라이저를 만드는 방법을 알고 있습니다.

추신:나는 또한 시스템을 시험해 보았다.미디어사운드 플레이어.하지만 그 사운드플레이어는 디스파이와 관련된 어떤 것도 지원하지 않습니다.그래서 외부에"순수한"오디오와 함께 작동하는 또 다른 오디오 라이브러리가 있습니까?

도움이 되었습니까?

해결책

그래서 외부에"순수한"오디오와 함께 작동하는 또 다른 오디오 라이브러리가 있습니까?

네,하나 있어요: https://cscore.codeplex.com

에 따르면 이퀄라이저 샘플,당신은 그런 이퀄라이저를 사용할 수 있습니다:

using CSCore;
using CSCore.Codecs;
using CSCore.SoundOut;
using CSCore.Streams;
using System;
using System.Threading;

...

private static void Main(string[] args)
{
    const string filename = @"C:\Temp\test.mp3";
    EventWaitHandle waitHandle = new AutoResetEvent(false);

    try
    {
        //create a source which provides audio data
        using(var source = CodecFactory.Instance.GetCodec(filename))
        {
            //create the equalizer.
            //You can create a custom eq with any bands you want, or you can just use the default 10 band eq.
            Equalizer equalizer = Equalizer.Create10BandEqualizer(source);

            //create a soundout to play the source
            ISoundOut soundOut;
            if(WasapiOut.IsSupportedOnCurrentPlatform)
            {
                soundOut = new WasapiOut();
            }
            else
            {
                soundOut = new DirectSoundOut();
            }

            soundOut.Stopped += (s, e) => waitHandle.Set();

            IWaveSource finalSource = equalizer.ToWaveSource(16); //since the equalizer is a samplesource, you have to convert it to a raw wavesource
            soundOut.Initialize(finalSource); //initialize the soundOut with the previously created finalSource
            soundOut.Play();

            /*
             * You can change the filter configuration of the equalizer at any time.
             */
            equalizer.SampleFilters[0].SetGain(20); //eq set the gain of the first filter to 20dB (if needed, you can set the gain value for each channel of the source individually)

            //wait until the playback finished
            //of course that is optional
            waitHandle.WaitOne();

            //remember to dispose and the soundout and the source
            soundOut.Dispose();
        }
    }
    catch(NotSupportedException ex)
    {
        Console.WriteLine("Fileformat not supported: " + ex.Message);
    }
    catch(Exception ex)
    {
        Console.WriteLine("Unexpected exception: " + ex.Message);
    }
}

당신은 당신이 원하는 것을 이퀄라이저를 구성 할 수 있습니다.그리고 실시간으로 100%실행되기 때문에 모든 변경 사항이 즉시 적용됩니다.필요한 경우,별도로 각 채널을 수정 액세스 할 수있는 가능성도있다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top