public static int FreqToIndex(double freq, int frame_size, int sample_rate) { return (int)Math.Round(frame_size * freq / sample_rate); }