Example #1
0
        /// <summary>
        /// Generate a Waveform.
        /// </summary>
        /// <param name="bytes">
        /// The bytes.
        /// </param>
        /// <param name="width">
        /// The width.
        /// </param>
        /// <param name="height">
        /// The height.
        /// </param>
        /// <returns>
        /// Waveform image.
        /// </returns>
        public Bitmap Waveform(byte[] bytes, int width, int height)
        {
            Bitmap image;

            using (var recording = new AudioRecording(bytes))
                using (var img = recording.GetWaveFormInDecibels(width, height, WaveFormDbMin))
                {
                    image = new Bitmap(img);
                }

            return(image);
        }
        /// <summary>
        /// Generate a Waveform.
        /// </summary>
        /// <param name="bytes">
        /// The bytes.
        /// </param>
        /// <param name="width">
        /// The width.
        /// </param>
        /// <param name="height">
        /// The height.
        /// </param>
        /// <returns>
        /// Waveform image.
        /// </returns>
        public Image <Rgb24> Waveform(byte[] bytes, int width, int height)
        {
            Image <Rgb24> image;

            using (var recording = new AudioRecording(bytes))
                using (var img = recording.GetWaveFormInDecibels(width, height, WaveFormDbMin))
                {
                    image = img;
                }

            return(image);
        }
Example #3
0
        private static void DrawWaveforms(AudioRecording recording, string path)
        {
            int imageWidth  = 284;
            int imageHeight = 60;
            var image2      = new Image_MultiTrack(recording.GetWaveForm(imageWidth, imageHeight));

            //path = outputFolder + wavFileName + "_waveform.png";
            image2.Save(path);

            double dBMin  = -25.0; //-25 dB appear to be good value
            var    image6 = new Image_MultiTrack(recording.GetWaveFormInDecibels(imageWidth, imageHeight, dBMin));

            //path = outputFolder + wavFileName + "_waveformDB.png"
            image6.Save(path);
        }