Пример #1
0
        public void LoadWavPart(WavPartInfo wp, int startPos)
        {
            if (startPos < 0 || this.WavData_L.Length - WINDOW_SIZE < startPos)             // ? startPos out of range
            {
                for (int offset = 0; offset < WINDOW_SIZE; offset++)
                {
                    wp.WavPart_L[offset] = 0.0;
                    wp.WavPart_R[offset] = 0.0;
                }
            }
            else
            {
                for (int offset = 0; offset < WINDOW_SIZE; offset++)
                {
                    double rate = offset * 1.0 / (WINDOW_SIZE - 1);
                    double hh   = Hamming(rate);

                    wp.WavPart_L[offset] = this.WavData_L[startPos + offset] * hh;
                    wp.WavPart_R[offset] = this.WavData_R[startPos + offset] * hh;
                }
            }
        }
Пример #2
0
 public double GetSpectrum_R(WavPartInfo wp, int hz)
 {
     return(this.GetSpectrum(hz, wp.WavPart_R));
 }
Пример #3
0
        public double GetSpectrum(WavPartInfo wp, int hz)
        {
            // memo: 左右の波形の位相がずれている可能性を考慮すると、スペクトラムは左右別々に取得する必要がある。

            return((this.GetSpectrum_L(wp, hz) + this.GetSpectrum_R(wp, hz)) / 2.0);
        }