示例#1
0
        private static bool SearchDirAndJoin(string directoryPath)
        {
            // locate all left files (and then match pairwise afterwards
            DirectoryInfo di = new DirectoryInfo(directoryPath);

            if (!di.Exists)
            {
                Console.Out.WriteLine("Input directory does not exist! Script canceled.");
                return(false);
            }

            FileInfo[] leftFiles = di.GetFiles("*_L.wav");
            foreach (FileInfo fi in leftFiles)
            {
                string fileNameLeft = fi.Name;
                Console.Out.WriteLine("Left filename:  " + fileNameLeft);

                // parse the left file name
                string tmpName       = Regex.Match(fileNameLeft, @"(.*)_L.wav$").Groups[1].Value;
                string fileNameRight = String.Format("{0}{1}.{2}", tmpName, "_R", "wav");
                Console.Out.WriteLine("Right filename: " + fileNameRight);

                string combinedFileName = String.Format("{0}{1}.{2}", tmpName, "_Quad", "wav");
                Console.Out.WriteLine("Combined filename: " + combinedFileName);

                // locate the matching right file
                string filePathRightFull = Path.Combine(directoryPath, fileNameRight);
                if (File.Exists(filePathRightFull))
                {
                    // skip if file exists
                    string combinedFileNamePath = Path.Combine(directoryPath, combinedFileName);
                    if (!File.Exists(combinedFileNamePath))
                    {
                        // Open the files
                        if (AudioUtilsNAudio.CombineStereoToQuad(fi.FullName, filePathRightFull, combinedFileNamePath))
                        {
                            Console.Out.WriteLine("Sucessfully combined the stereo files to quad.");
                            Console.Out.WriteLine("----------------------");
                        }
                        else
                        {
                            Console.Out.WriteLine("Could not combine the stereo files to quad. Script canceled.");
                            return(false);
                        }
                    }
                    else
                    {
                        Console.Out.WriteLine("{0} already exist. Skipping file.", combinedFileNamePath);
                    }
                }
                else
                {
                    Console.Out.WriteLine("No matching right file found ({0}). Skipping file.", filePathRightFull);
                    Console.Out.WriteLine("----------------------");
                    continue;
                }
            }
            return(true);
        }
        void SaveWAVBtnClick(object sender, EventArgs e)
        {
            // store this in a wav ouput file.
            string wavFilePath = String.Format("audio-data-{0}.wav", StringUtils.GetCurrentTimestamp());

            VstHost host = VstHost.Instance;

            AudioUtilsNAudio.CreateWaveFile(host.RecordedLeft.ToArray(), wavFilePath, new WaveFormat(host.SampleRate, 1));
        }
示例#3
0
        private void SDIR2WavConvert(string inputFilePath, string outputFilePath = null)
        {
            string directoryName = Path.GetDirectoryName(inputFilePath);
            string fileName      = Path.GetFileNameWithoutExtension(inputFilePath);

            if (outputFilePath == null)
            {
                outputFilePath = directoryName + Path.DirectorySeparatorChar + fileName + ".wav";
            }

            SdirPreset sdir = SdirPreset.ReadSdirPreset(inputFilePath);

            if (sdir != null)
            {
                AudioUtilsNAudio.CreateWaveFile(sdir.WaveformData, outputFilePath, new NAudio.Wave.WaveFormat(sdir.SampleRate, sdir.BitsPerSample, sdir.Channels));
                textBox1.AppendText(String.Format("Converted {0}\n", inputFilePath));
            }
        }
示例#4
0
        public static void Main(string[] args)
        {
            string inLeft  = @"F:\SAMPLES\IMPULSE RESPONSES\PER IVAR IR SAMPLES\ALTIVERB-QUAD-IMPULSE-RESPONSES\Scoring Stages (Orchestral Studios)_Todd-AO - California US_st to st wide mics at 18m90_L.wav";
            string inRight = @"F:\SAMPLES\IMPULSE RESPONSES\PER IVAR IR SAMPLES\ALTIVERB-QUAD-IMPULSE-RESPONSES\Scoring Stages (Orchestral Studios)_Todd-AO - California US_st to st wide mics at 18m90_R.wav";

            float[] channel1;
            float[] channel2;
            float[] channel3;
            float[] channel4;
            AudioUtilsNAudio.SplitStereoWaveFileToMono(inLeft, out channel1, out channel2);
            AudioUtilsNAudio.SplitStereoWaveFileToMono(inRight, out channel3, out channel4);

            // find out what channel is longest
            int maxLength = Math.Max(channel1.Length, channel3.Length);

            string outputFile = @"Scoring Stages (Orchestral Studios)_Todd-AO - California US_st to st wide mics at 18m90V2.sir";

            //string cfh_data = @"abe6f4214362.34U4T9yaBCCDEuyH0uCm7T6Pf.z+PqR.kBAoHEfz3DlPB4lX.K4XirMP+3WCzJZ6RYE0ka38ty94e5j858dEG1RUZlT3iZV2EATQgrjIV5ixyF5zA0qasZdXlJpZ8FtlNjwomlnU8lHn+JhPP48khE9n1HPSpVyoJhg5itqiqqKp600.vKJEevIQJ4fXS0aTksgilV6fMkL4wNFPLDn33w5irgZ7lpiNZaJe791OXu1ATcghs1bHHwzElL49JBlnXKYBBeeT8QCedFNXTRbHdVznj7XbHjFhSlLFaURBSgnoA1RJ7UWAwYQSCSew407fANeNiyoYvERkkO.1PVR0vMSTEqnZihvsR6eC5ammIKKcBl.NPeBmsPpDLBjimqMfQB15NVIEpXEZfXflcpdxcd77xh56HaQM9Shz7rIRJa4p+EHo0YfjCv3BeKI87QR6yGIW1qI+hIdM99OMVIuF+7+KqzUe.bo2V9C";
            string cfh_data = @"abe6f42143                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ";

            BinaryFile binaryFile = new BinaryFile(outputFile, BinaryFile.ByteOrder.LittleEndian, true);

            binaryFile.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            binaryFile.Write("\n\n");
            binaryFile.Write("<SirImpulseFile version=\"2.1\" cfh_data=\"");
            binaryFile.Write(cfh_data);
            binaryFile.Write("\"/>");
            binaryFile.Write("\r\n");
            binaryFile.Write((byte)0);

            WriteAudioBlock(binaryFile, channel1, maxLength, "0");
            WriteAudioBlock(binaryFile, channel2, maxLength, "1");
            WriteAudioBlock(binaryFile, channel3, maxLength, "2");
            WriteAudioBlock(binaryFile, channel4, maxLength, "3");

            binaryFile.Close();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
示例#5
0
        public static void TestSpectrograms()
        {
            const int fftWindowSize = 4096;
            const int overlap       = 2048;

            var data = AudioUtilsNAudio.GenerateAudioTestData(44100, 10);

            double[][] spec1  = FFTUtils.CreateSpectrogramLomont(data, fftWindowSize, overlap);
            var        spec1M = new Matrix(spec1);

            spec1M.WriteCSV("spec_lomont.csv");

            double[][] spec2  = FFTUtils.CreateSpectrogramExocortex(data, fftWindowSize, overlap);
            var        spec2M = new Matrix(spec2);

            spec2M.WriteCSV("spec_exocortex.csv");
            Assert.That(spec2, Is.EqualTo(spec1).AsCollection.Within(0.001), "fail at [0]");

            double[][] spec3  = FFTUtils.CreateSpectrogramFFTW(data, fftWindowSize, overlap);
            var        spec3M = new Matrix(spec3);

            spec3M.WriteCSV("spec_fftw.csv");
            //Assert.That(spec3, Is.EqualTo(spec1).AsCollection.Within(0.001), "fail at [0]");

            double[][] spec4  = FFTUtils.CreateSpectrogramFFTWLIB(data, fftWindowSize, overlap);
            var        spec4M = new Matrix(spec4);

            spec4M.WriteCSV("spec_fftwlib.csv");
            //Assert.That(spec4, Is.EqualTo(spec1).AsCollection.Within(0.001), "fail at [0]");

            double[][] spec5  = FFTUtils.CreateSpectrogramFFTWLIB_INPLACE(data, fftWindowSize, overlap);
            var        spec5M = new Matrix(spec5);

            spec5M.WriteCSV("spec_fftwlib_inplace.csv");
            //Assert.That(spec5, Is.EqualTo(spec1).AsCollection.Within(0.001), "fail at [0]");
        }
        void MeasureLFOBtnClick(object sender, EventArgs e)
        {
            MeasureLFOInit();
            VstHost host = VstHost.Instance;

            List <string> lfoAlreadyProcessed = new List <string>();

            // step through the LFO steps
            int count = 0;

            for (float paramValue = 1.0f; paramValue >= 0.0f; paramValue -= 0.020f)
            {
                // time how long this takes
                Stopwatch stopwatch = Stopwatch.StartNew();

                // init the buffers
                host.ClearRecording();
                host.ClearLastProcessedBuffers();

                // start record
                host.Record = true;

                // set the parameter
                PluginContext.PluginCommandStub.SetParameter(SYLENTH_PARAM_LFO1_RATE, paramValue);

                // get param display value
                string paramDisplay = PluginContext.PluginCommandStub.GetParameterDisplay(SYLENTH_PARAM_LFO1_RATE);

                // check if already processed
                if (lfoAlreadyProcessed.Contains(paramDisplay))
                {
                    continue;
                }
                else
                {
                    lfoAlreadyProcessed.Add(paramDisplay);
                }

                // wait until it has started playing
                while (!host.LastProcessedBufferLeftPlaying)
                {
                    // start playing audio
                    Playback.Play();

                    // play midi
                    host.SendMidiNote(host.SendContinousMidiNote, host.SendContinousMidiNoteVelocity);

                    if (stopwatch.ElapsedMilliseconds > 5000)
                    {
                        stopwatch.Stop();
                        System.Console.Out.WriteLine("MeasureLFOBtnClick: Playing Midi Failed!");
                        return;
                    }
                    System.Threading.Thread.Sleep(100);
                }

                // play for approx 1000 ms
                // paramValue: 1 = 1/256 Triple     (count = 0)
                // paramValue: 0 = 8/1 D			(count = 10)
                System.Threading.Thread.Sleep((int)(20 * Math.Pow(count, 2)));

                // stop midi
                host.SendMidiNote(host.SendContinousMidiNote, 0);

                // wait until it has stopped playing
                while (host.LastProcessedBufferLeftPlaying)
                {
                    if (stopwatch.ElapsedMilliseconds > 40000)
                    {
                        System.Console.Out.WriteLine("MeasureLFOBtnClick: Playing never stopped?!");
                        break;
                    }
                }
                // stop playing audio
                Playback.Stop();

                stopwatch.Stop();
                System.Console.Out.WriteLine("MeasureLFOBtnClick: Playing stopped: {0} ms. {1}", stopwatch.ElapsedMilliseconds, paramDisplay);

                // stop recording
                host.Record = false;

                // crop
                CropAudio();

                // store this in a wav ouput file.
                string wavFilePath = String.Format("audio-LFO-{0}-{1}.wav", StringUtils.MakeValidFileName(paramDisplay), StringUtils.GetCurrentTimestamp());
                AudioUtilsNAudio.CreateWaveFile(host.RecordedLeft.ToArray(), wavFilePath, new WaveFormat(host.SampleRate, 1));

                // store as a png
                System.Drawing.Bitmap png = CommonUtils.FFT.AudioAnalyzer.DrawWaveform(host.RecordedLeft.ToArray(), new System.Drawing.Size(1000, 600), 10000, 1, 0, host.SampleRate);
                string fileName           = String.Format("audio-LFO-{0}-{1}.png", StringUtils.MakeValidFileName(paramDisplay), StringUtils.GetCurrentTimestamp());
                png.Save(fileName);

                // clear
                ClearAudio();

                // wait a specfied time
                System.Threading.Thread.Sleep(100);

                stopwatch.Stop();

                count++;
            }
        }
        void MeasureADSRParameter(int paramName, float paramValue, string envName, bool measureRelease = false)
        {
            System.Console.Out.WriteLine("MeasureADSREntry: Measuring {0} at value {1:0.00}...", envName, paramValue);

            VstHost host = VstHost.Instance;

            // time how long this takes
            Stopwatch stopwatch = Stopwatch.StartNew();

            // init the buffers
            host.ClearRecording();
            host.ClearLastProcessedBuffers();

            // start record
            host.Record = true;

            // set the parameter
            PluginContext.PluginCommandStub.SetParameter(paramName, paramValue);
            ((HostCommandStub)PluginContext.HostCommandStub).SetParameterAutomated(paramName, paramValue);

            // wait until it has started playing
            while (!host.LastProcessedBufferLeftPlaying)
            {
                // start playing audio
                Playback.Play();

                // play midi
                host.SendMidiNote(host.SendContinousMidiNote, host.SendContinousMidiNoteVelocity);

                if (stopwatch.ElapsedMilliseconds > 5000)
                {
                    stopwatch.Stop();
                    System.Console.Out.WriteLine("MeasureADSREntry: Playing Midi Failed!");
                    return;
                }
                System.Threading.Thread.Sleep(100);
            }

            if (measureRelease)
            {
                // release is a special case where you only measure the tail after
                // a short midi signal
                // therefore we need to stop the midi message here
                host.SendMidiNote(host.SendContinousMidiNote, 0);
            }

            // wait until it has stopped playing
            stopwatch.Restart();
            while (host.LastProcessedBufferLeftPlaying)
            {
                if (stopwatch.ElapsedMilliseconds > 40000)
                {
                    stopwatch.Stop();
                    System.Console.Out.WriteLine("MeasureADSREntry: Playing never stopped?!");
                    break;
                }
            }

            // stop playing audio
            Playback.Stop();

            stopwatch.Stop();
            System.Console.Out.WriteLine("MeasureADSREntry: Playing stopped: {0} ms.", stopwatch.ElapsedMilliseconds);

            // stop recording
            host.Record = false;

            // wait a specfied time
            System.Threading.Thread.Sleep(100);

            // crop
            CropAudio();

            // store the duration
            RetrieveDuration();

            // store this in a wav ouput file.
            float  param       = PluginContext.PluginCommandStub.GetParameter(paramName);
            string wavFilePath = String.Format("{0}{1:0.00}s-{2}.wav", envName, param, StringUtils.GetCurrentTimestamp());

            AudioUtilsNAudio.CreateWaveFile(host.RecordedLeft.ToArray(), wavFilePath, new WaveFormat(host.SampleRate, 1));

            // store as a png
            System.Drawing.Bitmap png = CommonUtils.FFT.AudioAnalyzer.DrawWaveform(host.RecordedLeft.ToArray(), new System.Drawing.Size(1000, 600), 10000, 1, 0, host.SampleRate);
            string fileName           = String.Format("{0}{1:0.00}s-{2}.png", envName, param, StringUtils.GetCurrentTimestamp());

            png.Save(fileName);

            if (!measureRelease)
            {
                // turn of midi unless we are measuring a release envelope
                // then it should have been turned of immideately after a small signal is generated
                host.SendMidiNote(host.SendContinousMidiNote, 0);
            }

            // clear
            ClearAudio();

            // wait a specfied time
            System.Threading.Thread.Sleep(100);

            stopwatch.Stop();
        }
示例#8
0
 public float[] ReadMonoFromFile(string filename, int samplerate, int milliseconds, int startmilliseconds)
 {
     return(AudioUtilsNAudio.ReadMonoFromFile(filename, samplerate, milliseconds, startmilliseconds));
 }
示例#9
0
        public static void Main(string[] args)
        {
            /*
             * int nFFT = 1024;
             * int samplerate = 44100;
             * int length = samplerate * 10; // 10 sec
             *
             * double freq1, freq2;
             * int i1, i2;
             * for (int i = 0; i < nFFT + 1; i++) {
             *      freq1 = MathUtils.Index2Freq(i, samplerate, nFFT);
             *      freq2 = MathUtils.IndexToFreq(i, samplerate, nFFT);
             *      i1 = MathUtils.Freq2Index(freq1, samplerate, nFFT);
             *      i2 = MathUtils.FreqToIndex((float)freq2, samplerate, nFFT);
             * }
             */

            // http://www.music.mcgill.ca/~gary/307/week5/additive.html
            //SaveColorPaletteBar("c:\\rew-colorbar-generated.png", "c:\\rew-colorbar-generated.csv", ColorPaletteType.REWColorPalette);

            /*
             * List<Color> rew_hsb_gradients = ColorUtils.GetHSBColorGradients(256, ColorUtils.ColorPaletteType.REW);
             * ColorUtils.SaveColorGradients("c:\\rew-hsb-gradients.png", rew_hsb_gradients, 40);
             * List<Color> rew_hsl_gradients = ColorUtils.GetHSLColorGradients(256, ColorUtils.ColorPaletteType.REW);
             * ColorUtils.SaveColorGradients("c:\\rew-hsl-gradients.png", rew_hsl_gradients, 40);
             *
             * List<Color> sox_hsb_gradients = ColorUtils.GetHSBColorGradients(256, ColorUtils.ColorPaletteType.SOX);
             * ColorUtils.SaveColorGradients("c:\\sox-hsb-gradients.png", sox_hsb_gradients, 40);
             * List<Color> sox_hsl_gradients = ColorUtils.GetHSLColorGradients(256, ColorUtils.ColorPaletteType.SOX);
             * ColorUtils.SaveColorGradients("c:\\sox-hsl-gradients.png", sox_hsl_gradients, 40);
             *
             * List<Color> photosounder_hsb_gradients = ColorUtils.GetHSBColorGradients(256, ColorUtils.ColorPaletteType.PHOTOSOUNDER);
             * ColorUtils.SaveColorGradients("c:\\photosounder_hsb_gradients.png", photosounder_hsb_gradients, 40);
             * List<Color> photosounder_hsl_gradients = ColorUtils.GetHSLColorGradients(256, ColorUtils.ColorPaletteType.PHOTOSOUNDER);
             * ColorUtils.SaveColorGradients("c:\\photosounder_hsl_gradients.png", photosounder_hsl_gradients, 40);
             * List<Color> photosounder_rgb_gradients = ColorUtils.GetRGBColorGradients(255, ColorUtils.ColorPaletteType.PHOTOSOUNDER);
             * ColorUtils.SaveColorGradients("c:\\photosounder_rgb_gradients.png", photosounder_rgb_gradients, 40);
             *
             * List<Color> grey_hsb_gradients = ColorUtils.GetHSBColorGradients(256, ColorUtils.ColorPaletteType.BLACK_AND_WHITE);
             * ColorUtils.SaveColorGradients("c:\\grey-hsb-gradients.png", grey_hsb_gradients, 40);
             */

            /*
             * ReadColorPaletteBar(@"C:\Users\perivar.nerseth\SkyDrive\Temp\sox_colorbar.png", "c:\\sox_colorbar.csv");
             * ReadColorPaletteBar(@"C:\Users\perivar.nerseth\SkyDrive\Temp\soundforge_colorbar.png", "c:\\soundforge_colorbar.csv");
             * ReadColorPaletteBar(@"C:\Users\perivar.nerseth\SkyDrive\Temp\rew_colorbar.png", "c:\\rew_colorbar.csv");
             * ReadColorPaletteBar(@"C:\Users\perivar.nerseth\SkyDrive\Temp\sox_colorbar.png", "c:\\sox_colorbar.csv");
             * ReadColorPaletteBar(@"C:\Users\perivar.nerseth\SkyDrive\Temp\thermal_colorbar.png", "c:\\thermal_colorbar.csv");
             * ReadColorPaletteBar(@"C:\rew-gradients.png", "c:\\rew-gradients.csv");
             */

            //String fileName = @"C:\Users\perivar.nerseth\Music\Sleep Away.mp3";
            //String fileName = @"C:\Users\perivar.nerseth\Music\Sleep Away32f.wav";
            String fileName = @"C:\Users\perivar.nerseth\Music\Sleep Away16.wav";

            //String fileName = @"C:\Users\perivar.nerseth\Music\Maid with the Flaxen Hair.mp3";
            //String fileName = @"G:\Cubase and Nuendo Projects\Music To Copy Learn\Britney Spears - Hold It Against Me\02 Hold It Against Me (Instrumental) 1.mp3";

            Console.WriteLine("Analyzer starting ...");

            RepositoryGateway  repositoryGateway = new RepositoryGateway();
            FingerprintManager manager           = new FingerprintManager();

            // VB6 FFT
            double sampleRate      = 44100;                                      // 44100, default 5512
            int    fftWindowsSize  = 16384;                                      //32768 16384 8192 4096 2048, default 256*8 (2048) to 256*128 (32768), reccomended: 256*64 = 16384
            int    secondsToSample = 25;                                         //25, 15;
            int    fftOverlap      = (int)(sampleRate * secondsToSample / 1280); // 32768:990, 16384:990, 8192:990, 4096:990

            //float fftOverlapPercentage = 94.0f; // 99.0f number between 0 and 100
            //float[] wavDataVB6 = repositoryGateway._proxy.ReadMonoFromFile(fileName, (int) sampleRate, secondsToSample*1000, 20*1000 );
            //float[] wavDataVB6 = repositoryGateway._proxy.ReadMonoFromFile(fileName, (int) sampleRate, secondsToSample*1000, 0);
            //MathUtils.NormalizeInPlace(wavDataVB6);
            //Export.exportCSV(@"c:\bass.csv", wavDataVB6);

            float[] wavDataNaudio = AudioUtilsNAudio.ReadMonoFromFile(fileName, (int)sampleRate, secondsToSample * 1000, 0);
            //float[] wavDataNaudio = AudioUtilsNAudio.ReadMonoFromFile(fileName, (int) sampleRate, 0, 0);

            /*
             * float[] wavDataNaudio = new float[(int) (sampleRate*secondsToSample)];
             * BasicOscillatorProvider basic = new BasicOscillatorProvider();
             *
             * int length = (int)(sampleRate*3);
             * int offset = 0;
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(-80);
             * basic.SetFrequency(220);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.SINE);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(-60);
             * basic.SetFrequency(440);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.SQUARE);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(-40);
             * basic.SetFrequency(880);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.TRIANGLE);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(-20);
             * basic.SetFrequency(1760);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.SAW);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(-10);
             * basic.SetFrequency(3520);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.SINE);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * basic.Amplitude = MathUtils.DecibelToAmplitude(0);
             * basic.SetFrequency(1760);
             * basic.SetOscWaveshape(BasicOscillatorProvider.WAVESHAPE.SAW);
             * offset += basic.Read(wavDataNaudio, offset, length);
             *
             * AudioUtilsNAudio.WriteIEEE32WaveFileMono(@"c:\sines.wav", 44100, wavDataNaudio);
             */

            //MathUtils.NormalizeInPlace(wavDataNaudio);
            //Export.exportCSV(@"c:\naudio.csv", wavDataNaudio);

            //VB6Spectrogram vb6Spect = new VB6Spectrogram();
            //vb6Spect.ComputeColorPalette();
            //float[][] vb6Spectrogram = vb6Spect.Compute(wavDataVB6, sampleRate, fftWindowsSize, fftOverlapPercentage);
            //Export.exportCSV (@"c:\VB6Spectrogram-full.csv", vb6Spectrogram);

            // Exocortex.DSP FFT

            /*
             * int numberOfSamples = wavDataNaudio.Length;
             * fftOverlapPercentage = fftOverlapPercentage / 100;
             * long ColSampleWidth = (long)(fftWindowsSize * (1 - fftOverlapPercentage));
             * double fftOverlapSamples = fftWindowsSize * fftOverlapPercentage;
             * long NumCols = numberOfSamples / ColSampleWidth;
             *
             * int fftOverlap = (int)((numberOfSamples - fftWindowsSize) / NumCols);
             * int numberOfSegments = (numberOfSamples - fftWindowsSize)/fftOverlap;
             */
            //System.Console.Out.WriteLine(String.Format("EXO: fftWindowsSize: {0}, Overlap samples: {1:n2}.", fftWindowsSize, fftOverlap ));

            //VIPSLib.Audio.WAVFile wavefile = new VIPSLib.Audio.WAVFile();
            //wavefile.ReadFromFileToDouble(fileName.Substring(0, fileName.LastIndexOf(".")) + ".wav");
            //RiffRead riff = new RiffRead(fileName.Substring(0, fileName.LastIndexOf(".")) + ".wav");
            //riff.Process();

            /*
             * VIPSLib.Audio.MFCC mfcclib = new VIPSLib.Audio.MFCC((float)sampleRate);
             * double[][] data = riff.SoundData;
             * double min;
             * double max;
             * MathUtils.ComputeMinAndMax(data, out min, out max);
             * double[][] mfcc = mfcclib.Process(MathUtils.FloatToDouble(wavDataVB6));
             *
             * float fmin;
             * float fmax;
             * MathUtils.ComputeMinAndMax(wavDataVB6, out fmin, out fmax);
             */

            //double[][] mfcc = mfcclib.Process(riff.SoundData[0]);
            //float[][] mfccFloats = MathUtils.DoubleToFloat(mfcc);

            // GENERATE SPECTROGRAM
            //Bitmap spectro = AudioAnalyzer.GetSpectrogramImage(wavDataNaudio, 1200, 600, sampleRate, fftWindowsSize, fftOverlap, ColorUtils.ColorPaletteType.PHOTOSOUNDER, true);
            //spectro.Save(@"c:\spectrogram-rew.png");

            // The following lines replicate the BtnDrawSpectrumClick method
            // from Soundfingerprinting.SoundTools.DrawningTool
            fileName = @"C:\Users\perivar.nerseth\Music\Maid with the Flaxen Hair.mp3";
            float[]   wavDataBass = AudioUtilsBass.ReadMonoFromFile(fileName, 5512, 0, 0);
            float[][] data        = AudioAnalyzer.CreateSpectrogramLomont(wavDataBass, 2048, 64);
            Bitmap    image       = AudioAnalyzer.GetSpectrogramImage(data, 1000, 800);

            image.Save(@"C:\Users\perivar.nerseth\Music\Maid with the Flaxen Hair_spectrum_2.jpg", ImageFormat.Jpeg);

            //float[][] logSpectrogram = manager.CreateLogSpectrogram(repositoryGateway._proxy, fileName, secondsToSample*1000, 0);
            //Bitmap logspectro = AudioAnalyzer.GetSpectrogramImage(logSpectrogram, 1200, 600, secondsToSample*1000, sampleRate, ColorUtils.ColorPaletteType.REW);
            //logspectro.Save(@"c:\spectrogram-log.png");

            //Bitmap waveform = AudioAnalyzer.DrawWaveform(wavDataVB6, new Size (1200, 600), 0, 1, 0, sampleRate);
            //waveform.Save(@"c:\waveform.png");

            //Bitmap waveform = AudioAnalyzer.DrawWaveform(wavDataNaudio, 1200, 600);
            //waveform.Save(@"c:\waveform.png");

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }