예제 #1
0
 public PcmFormat(PcmFormat rhs)
 {
     NumChannels = rhs.NumChannels;
     ChannelId   = rhs.ChannelId;
     SampleRate  = rhs.SampleRate;
     NumSamples  = rhs.NumSamples;
 }
예제 #2
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     var r = new PcmFormat(inputFormat);
     r.SampleRate *= Factor;
     r.NumSamples *= Factor;
     return r;
 }
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            var r = new PcmFormat(inputFormat);

            r.SampleRate *= Factor;
            r.NumSamples *= Factor;
            return(r);
        }
예제 #4
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mPcmFormat     = new PcmFormat(inputFormat);
            mFftLength     = WWUtil.NextPowerOf2(mPcmFormat.SampleRate);
            mOverlappedFft = new OverlappedFft(mFftLength);

            return(inputFormat);
        }
예제 #5
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            SampleRate = inputFormat.SampleRate;
            DesignCutoffFilter();
            mIfftAddBuffer = null;
            mFirstFilterDo = true;

            return(new PcmFormat(inputFormat));
        }
예제 #6
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            SampleRate     = inputFormat.SampleRate;
            mFilterFreq    = ButterworthFilter.Design(SampleRate, CutoffFrequency, FFT_LEN, FilterSlopeDbOct);
            mIfftAddBuffer = null;
            mFirstFilterDo = true;

            return(new PcmFormat(inputFormat));
        }
예제 #7
0
        private static PcmFormat FilterSetup(AudioData from, int ch, List <FilterBase> filters)
        {
            var fmt = new PcmFormat(from.meta.channels, ch, from.meta.sampleRate, from.meta.totalSamples);

            foreach (var f in filters)
            {
                fmt = f.Setup(fmt);
            }
            return(fmt);
        }
예제 #8
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mInputPcmFormat = inputFormat;

            var r = new PcmFormat(inputFormat);

            r.SampleRate *= Factor;
            r.NumSamples *= Factor;

            mOutputPcmFormat = r;

            SetupCoeffs();
            return(r);
        }
예제 #9
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mInputPcmFormat = inputFormat;

            var r = new PcmFormat(inputFormat);

            r.SampleRate *= Factor;
            r.NumSamples *= Factor;

            mOutputPcmFormat = r;

            DesignFreqFilter();

            return(r);
        }
예제 #10
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            if (Int32.MaxValue <= inputFormat.NumSamples)
            {
                MessageBox.Show("Input PCM data is too long");
                return(null);
            }

            /*
             *  ジッター発生の原理
             *  ①ジッターによって揺さぶられたクロックで時を刻む。
             *  ②①の各時刻について、音声信号の波高値をSincリサンプラーにより算出する。
             *
             *  sampleRate        == 96000 Hz
             *  jitterFrequency   == 50 Hz
             *  jitterPicoseconds == 1 ps の場合
             *
             *  サンプル位置posのθ= 2 * PI * pos * 50 / 96000 (ラジアン)
             *
             *  サンプル間隔= 1/96000秒 = 10.4 μs
             *
             *  1ms = 10^-3秒
             *  1μs= 10^-6秒
             *  1ns = 10^-9秒
             *  1ps = 10^-12秒
             *
             *  1psのずれ                     A サンプルのずれ
             *  ───────────── = ─────────
             *  10.4 μs(1/96000)sのずれ      1 サンプルのずれ
             *
             *  1psのサンプルずれA = 10^-12 ÷ (1/96000) = 10^-12 * 96000 (サンプルのずれ)
             *
             *  サンプルを採取する位置= pos + Asin(θ)
             */

            mTotalSamples  = inputFormat.NumSamples;
            mSampleRate    = inputFormat.SampleRate;
            mSineJitterAmp = 1.0e-9 * SineJitterNanosec * inputFormat.SampleRate * Math.Sqrt(2);
            mTpdfJitterAmp = 1.0e-9 * TpdfJitterNanosec * inputFormat.SampleRate * 2;
            mRpdfJitterAmp = 1.0e-9 * RpdfJitterNanosec * inputFormat.SampleRate;

            PrepareResamplePosArray(inputFormat.SampleRate, (int)inputFormat.NumSamples);
            return(new PcmFormat(inputFormat));
        }
예제 #11
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            if (inputFormat.NumChannels != mCoeffNumChannels)
            {
                MessageBox.Show("Crossfeed NumChannels Mismatch!");
                return(null);
            }
            if (inputFormat.SampleRate != mCoeffSampleRate)
            {
                MessageBox.Show("Crossfeed SampleRate Mismatch! (among crossfeed coefficient file and input pcm file)");
                return(null);
            }
            mNumSamples  = inputFormat.NumSamples;
            mNumChannels = inputFormat.NumChannels;
            mChannelId   = inputFormat.ChannelId;

            mPcmAllChannels = new double[mNumChannels][];
            return(inputFormat);
        }
예제 #12
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mInputPcmFormat = inputFormat;

            var r = new PcmFormat(inputFormat);
            r.SampleRate *= Factor;
            r.NumSamples *= Factor;

            mOutputPcmFormat = r;

            SetupCoeffs();
            return r;
        }
예제 #13
0
 public PcmFormat(PcmFormat rhs)
 {
     NumChannels = rhs.NumChannels;
     ChannelId   = rhs.ChannelId;
     SampleRate  = rhs.SampleRate;
     NumSamples  = rhs.NumSamples;
 }
예제 #14
0
 /// <summary>
 /// perform setup task, set pcm format and returns output format
 /// </summary>
 /// <param name="inputFormat">input pcm format</param>
 /// <returns>output pcm format</returns>
 public virtual PcmFormat Setup(PcmFormat inputFormat)
 {
     return new PcmFormat(inputFormat);
 }
예제 #15
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     mMask = 0xffffff00U << (24 - TargetBitsPerSample);
     return new PcmFormat(inputFormat);
 }
예제 #16
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mPcmFormat = new PcmFormat(inputFormat);
            mFftLength = WWUtil.NextPowerOf2(mPcmFormat.SampleRate);
            mOverlappedFft = new OverlappedFft(mFftLength);

            return inputFormat;
        }
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     return new PcmFormat(inputFormat);
 }
예제 #18
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     return(new PcmFormat(inputFormat));
 }
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     DesignFilter();
     return inputFormat;
 }
예제 #20
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     mNumSamples = inputFormat.NumSamples;
     return new PcmFormat(inputFormat);
 }
예제 #21
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     mMask = 0xffffff00U << (24 - TargetBitsPerSample);
     return(new PcmFormat(inputFormat));
 }
예제 #22
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            if (inputFormat.NumChannels != mCoeffNumChannels) {
                MessageBox.Show("Crossfeed NumChannels Mismatch!");
                return null;
            }
            if (inputFormat.SampleRate != mCoeffSampleRate) {
                MessageBox.Show("Crossfeed SampleRate Mismatch! (among crossfeed coefficient file and input pcm file)");
                return null;
            }
            mNumSamples  = inputFormat.NumSamples;
            mNumChannels = inputFormat.NumChannels;
            mChannelId   = inputFormat.ChannelId;

            mPcmAllChannels = new double[mNumChannels][];
            return inputFormat;
        }
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            SampleRate = inputFormat.SampleRate;
            DesignCutoffFilter();
            mIfftAddBuffer = null;
            mFirstFilterDo = true;

            return new PcmFormat(inputFormat);
        }
예제 #24
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            SampleRate = inputFormat.SampleRate;
            mFilterFreq = ButterworthFilter.Design(SampleRate, CutoffFrequency, FFT_LEN, FilterSlopeDbOct);
            mIfftAddBuffer = null;
            mFirstFilterDo = true;

            return new PcmFormat(inputFormat);
        }
예제 #25
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            mInputPcmFormat = inputFormat;

            var r = new PcmFormat(inputFormat);
            r.SampleRate *= Factor;
            r.NumSamples *= Factor;

            mOutputPcmFormat = r;

            DesignFreqFilter();

            return r;
        }
예제 #26
0
 /// <summary>
 /// perform setup task, set pcm format and returns output format
 /// </summary>
 /// <param name="inputFormat">input pcm format</param>
 /// <returns>output pcm format</returns>
 public virtual PcmFormat Setup(PcmFormat inputFormat)
 {
     return(new PcmFormat(inputFormat));
 }
예제 #27
0
        public override PcmFormat Setup(PcmFormat inputFormat)
        {
            if (Int32.MaxValue <= inputFormat.NumSamples) {
                MessageBox.Show("Input PCM data is too long");
                return null;
            }
            /*
                ジッター発生の原理
                ①ジッターによって揺さぶられたクロックで時を刻む。
                ②①の各時刻について、音声信号の波高値をSincリサンプラーにより算出する。

                sampleRate        == 96000 Hz
                jitterFrequency   == 50 Hz
                jitterPicoseconds == 1 ps の場合

                サンプル位置posのθ= 2 * PI * pos * 50 / 96000 (ラジアン)

                サンプル間隔= 1/96000秒 = 10.4 μs

                1ms = 10^-3秒
                1μs= 10^-6秒
                1ns = 10^-9秒
                1ps = 10^-12秒

                1psのずれ                     A サンプルのずれ
                ───────────── = ─────────
                10.4 μs(1/96000)sのずれ      1 サンプルのずれ

                1psのサンプルずれA = 10^-12 ÷ (1/96000) = 10^-12 * 96000 (サンプルのずれ)

                サンプルを採取する位置= pos + Asin(θ)
            */

            mTotalSamples = inputFormat.NumSamples;
            mSampleRate    = inputFormat.SampleRate;
            mSineJitterAmp = 1.0e-9 * SineJitterNanosec * inputFormat.SampleRate * Math.Sqrt(2);
            mTpdfJitterAmp = 1.0e-9 * TpdfJitterNanosec * inputFormat.SampleRate * 2;
            mRpdfJitterAmp = 1.0e-9 * RpdfJitterNanosec * inputFormat.SampleRate;

            PrepareResamplePosArray(inputFormat.SampleRate, (int)inputFormat.NumSamples);
            return new PcmFormat(inputFormat);
        }
예제 #28
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     DesignFilter();
     return(inputFormat);
 }
예제 #29
0
 public override PcmFormat Setup(PcmFormat inputFormat)
 {
     mNumSamples = inputFormat.NumSamples;
     return(new PcmFormat(inputFormat));
 }
예제 #30
0
 private static PcmFormat FilterSetup(AudioData from, int ch, List<FilterBase> filters)
 {
     var fmt = new PcmFormat(from.meta.channels, ch, from.meta.sampleRate, from.meta.totalSamples);
     foreach (var f in filters) {
         fmt = f.Setup(fmt);
     }
     return fmt;
 }