周波数特性クラス。
Inheritance: ICloneable
Beispiel #1
0
		/// <summary>
		/// 遅延 δ[i - delay] の周波数特性を作成する。
		/// </summary>
		/// <param name="delay">遅延サンプル数</param>
		/// <returns>作成された周波数特性</returns>
		public static Spectrum FromDelay(double delay, int length)
		{
			Spectrum s = new Spectrum(length);
			length /= 2;
			s.x[0] = 1;
			s.x[1] = Math.Cos(-Math.PI * delay);
			double dt = -Math.PI * delay / length;
			double t = dt;
			for(int i=1; i<length; ++i, t += dt)
			{
				s[i] = Complex.FromArg(t);
			}

			return s;
		}
Beispiel #2
0
		/// <summary>
		/// Left/Right ch 信号を設定。
		/// </summary>
		/// <param name="middle">M ch</param>
		/// <param name="side">S ch</param>
		public virtual void SetLR(Spectrum left, Spectrum right)
		{
			this.Left = left;
			this.Right = right;
		}
Beispiel #3
0
		/// <summary>
		/// データの特性を取得。
		/// </summary>
		/// <param name="spectrum">スペクトル</param>
		/// <param name="type">特性の種類</param>
		/// <returns>特性</returns>
		public static double[] GetData(Spectrum spectrum, Property type)
		{
			switch(type)
			{
				case Property.Amplitude:
				{
					double[] tmp = spectrum.GetPower();
					Spectrum.Smooth(tmp);
					return tmp;
				}
				case Property.Phase:
				{
					double[] tmp = spectrum.GetPhase();
					Spectrum.Unwrap(tmp);
					Spectrum.Smooth(tmp);
					return tmp;
				}
				case Property.MinimumPhase:
				{
					double[] tmp = spectrum.GetMinimumPhase();
					Spectrum.Smooth(tmp);
					return tmp;
				}
				case Property.AllPassPhase:
				{
					double[] tmp  = spectrum.GetPhase();
					double[] tmp2 = spectrum.GetMinimumPhase();
					for(int i=0; i<tmp.Length; ++i) tmp[i] += tmp2[i];
					Spectrum.Unwrap(tmp);
					Spectrum.Smooth(tmp);
					return tmp;
				}
				/*
				case Property.PhaseDelay:
				{
					double[] tmp = spectrum.GetPhase();
					Spectrum.Unwrap(tmp);
					Spectrum.Smooth(tmp);
					return Spectrum.GetPhaseDalay(tmp, 48000);
				}
				case Property.GroupDelay:
				{
					double[] tmp = spectrum.GetPhase();
					Spectrum.Unwrap(tmp);
					Spectrum.Smooth(tmp);
					return Spectrum.GetGroupDalay(tmp, 48000);
				}
				*/
				default:
					return spectrum.TimeSequence;
			}
		}//GetData
Beispiel #4
0
		/// <summary>
		/// Left/Right を s で割る。
		/// </summary>
		/// <param name="s">周波数特性</param>
		public virtual void Div(Spectrum s)
		{
			this.Left /= s;
			this.Right /= s;
		}
Beispiel #5
0
		/// <summary>
		/// Left/Right に s を掛ける。
		/// </summary>
		/// <param name="s">周波数特性</param>
		public virtual void Mul(Spectrum s)
		{
			this.Left *= s;
			this.Right *= s;
		}
Beispiel #6
0
		/// <summary>
		/// Middle/Side ch 信号を設定。
		/// </summary>
		/// <param name="middle">M ch</param>
		/// <param name="side">S ch</param>
		public virtual void SetMS(Spectrum middle, Spectrum side)
		{
			this.Left  = 0.5 * (middle + side);
			this.Right = 0.5 * (middle - side);
		}
Beispiel #7
0
		public override void Div(Spectrum s)
		{
			this.Left /= s;
		}
Beispiel #8
0
		public override void Mul(Spectrum s)
		{
			this.Left *= s;
		}
Beispiel #9
0
		public override void SetMS(Spectrum left, Spectrum right)
		{
			this.l = (0.5 * (left + right)).TimeSequence;
		}
Beispiel #10
0
		public WaveFrequency(FormatHeader header, Spectrum l, Spectrum r) : base(header)
		{
			this.l = l;
			this.r = r;
		}
Beispiel #11
0
		public override void Div(Spectrum s)
		{
			this.m /= s;
			this.s /= s;
		}
Beispiel #12
0
		public override void Mul(Spectrum s)
		{
			this.m *= s;
			this.s *= s;
		}
Beispiel #13
0
		public override void SetMS(Spectrum middle, Spectrum side)
		{
			this.m = middle;
			this.s = side;
		}
Beispiel #14
0
		public override void SetLR(Spectrum left, Spectrum right)
		{
			this.m = left + right;
			this.s = left - right;
		}
Beispiel #15
0
		public WaveMS(FormatHeader header, Spectrum m, Spectrum s) : base(header)
		{
			this.m = m;
			this.s = s;
		}
Beispiel #16
0
 /// <summary>
 /// 位相特性(アンラップしたもの)を取得。
 /// </summary>
 /// <param name="skip">最初 skip サンプルはアンラップしない</param>
 public double[] GetUnwrapPhase(int skip)
 {
     double[] tmp = this.GetPhase();
     Spectrum.Unwrap(tmp, skip);
     return(tmp);
 }