naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.46k stars 1.09k forks source link

WaveViewer display issue in WinForms #993

Open mkane7 opened 1 year ago

mkane7 commented 1 year ago

Here is 1 sec of sound plotted image Here is 2 seconds. Note the truncation. image

AutoScroll, is true but I'm not seeing any scrollbars. AutoSize is true but seems to have no effect either.

The code I'm using is

        int secs = 0;
         private void button1_Click(object sender, EventArgs e)
        {
           // Display the waveform of an extract of the file
            var reader = new MediaFoundationReader("sample.mp3");
            var stream = new WaveOffsetStream(reader, TimeSpan.Zero, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(secs)); 
            waveViewer1.WaveStream = stream; 
            secs++;
        }

How do I get the wave viewer control to fit the data to the width of the control?

mkane7 commented 1 year ago

The following video details how to implement a FitToScreen.feature which is what I was looking for. C# Audio Tutorial 11 - Plotting Audio Waveforms Part 2 Video https://www.youtube.com/watch?v=BP2MhB2KQe0 Source Tutorial11.zip This issue may be closed.