Exemple #1
0
        public void Test_Make_CommonColormaps()
        {
            (int sampleRate, double[] audio) = WavFile.ReadMono("../../../../../data/cant-do-that-44100.wav");
            int fftSize = 1 << 12;
            var spec    = new Spectrogram(sampleRate, fftSize, stepSize: 700, maxFreq: 2000);

            spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
            spec.Add(audio);

            // delete old colormap files
            foreach (var filePath in System.IO.Directory.GetFiles("../../../../../dev/graphics/", "hal-*.png"))
            {
                System.IO.File.Delete(filePath);
            }

            foreach (var cmap in Colormap.GetColormaps())
            {
                spec.SetColormap(cmap);
                spec.SaveImage($"../../../../../dev/graphics/hal-{cmap.Name}.png", intensity: .5);
                Debug.WriteLine($"![](dev/graphics/hal-{cmap.Name}.png)");
            }
        }
Exemple #2
0
 private void cbColormap_SelectedIndexChanged(object sender, EventArgs e)
 {
     spec.SetColormap(cmaps[cbColormap.SelectedIndex]);
 }