첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System;
using System.Threading;

using NAudio.Wave;
using NAudio.Wave.SampleProviders;

string sourceAudioFilePath = @"D:\source.mp3";
double semitone            = Math.Pow(2, 1.0 / 12);
double upOneTone           = semitone * semitone;
double downOneTone         = 1.0 / upOneTone;

using(MediaFoundationReader reader = new MediaFoundationReader(sourceAudioFilePath))
{
    SmbPitchShiftingSampleProvider provider = new SmbPitchShiftingSampleProvider(reader.ToSampleProvider());

    provider.PitchFactor = (float)upOneTone;

    using(WaveOutEvent waveOutEvent = new WaveOutEvent())
    {
        waveOutEvent.Init(provider.Take(TimeSpan.FromSeconds(10)));

        waveOutEvent.Play();

        while(waveOutEvent.PlaybackState == PlaybackState.Playing)
        {
            Thread.Sleep(500);
        }
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요