/// <summary> /// Calculate the weighted volume of a sound source. /// NB: this consumes lots of memory for long sources. /// </summary> /// <param name="src"></param> /// <param name="dbSPL"></param> /// <returns>Volume (units, not dB)</returns> public static double WeightedVolume(ISoundObj src, double dbSPL, double dbSPLBase) { double wv = 0; for (ushort c = 0; c < src.NumChannels; c++) { SingleChannel channel = src.Channel(c); wv += Loudness.WeightedVolume1(channel, dbSPL, dbSPLBase); } src.Reset(); wv = wv / src.NumChannels; return(wv); }
public static FilterProfile DifferentialSPL(double phon0, double phon1, double scale) { FilterProfile spl = new FilterProfile(); FilterProfile spl0 = Loudness.SPL(phon0); FilterProfile spl1 = Loudness.SPL(phon1); for (int j = 0; j < spl1.Count; j++) { FreqGain fg = spl1[j]; fg.Gain = scale * (spl0[j].Gain - fg.Gain); spl.Add(fg); } return(spl); }