void DrawFrequencyBands()
    {
        DrawHeader("Beat Frequency Bands");

        int indexToDelete = -1;

        for (int i = 0; i < detector.subBands.Count; i++)
        {
            FrequencyBand band = detector.subBands[i];
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i.ToString());

            float frequency;
            EditorGUI.BeginChangeCheck();
            frequency = EditorGUILayout.FloatField(band.lowerFrequency);
            EndChangeCheck(() =>
            {
                band.lowerFrequency = frequency;
            });

            EditorGUI.BeginChangeCheck();
            frequency = EditorGUILayout.FloatField(band.higherFrequency);
            EndChangeCheck(() =>
            {
                band.higherFrequency = frequency;
            });

            if (GUILayout.Button("X", EditorStyles.miniButton))
            {
                indexToDelete = i;
            }

            EditorGUILayout.EndHorizontal();
        }

        if (indexToDelete >= 0)
        {
            Undo.RecordObject(detector, "Deleted a band in the beat dector");
            detector.subBands.RemoveAt(indexToDelete);
        }

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Add BeatBand"))
        {
            detector.subBands.Add(new FrequencyBand());
        }
        if (GUILayout.Button("Beat Band Editor"))
        {
            SpectogramWindow.OpenWindow(detector);
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
    }
 public static void OpenWindow(BeatDetector detector)
 {
     window          = GetWindow <SpectogramWindow>();
     window.detector = detector;
 }
 public static void OpenWindow(BeatDetector detector)
 {
     window = GetWindow<SpectogramWindow>();
     window.detector = detector;
 }