Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: reading the amplitude of a frame

$
0
0

thank you Mr Mark and thefiloe, I could finally read the data and that's what I wrote

//the open file dialog
//OpenFileDialog open = new OpenFileDialog();

BlockAlignReductionStream stream = null;
MeteringSampleProvider metering = null;

WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(open.FileName));

stream = new BlockAlignReductionStream(pcm);

var wave = new SampleChannel(stream);
metering = new MeteringSampleProvider(wave);

metering.StreamVolume += new EventHandler<StreamVolumeEventArgs>(OnPost);

array = new float[2];

while (pos != stream.Length)
{
    data = metering.Read(array, 0, 2);
    pos = stream.Position;
}

private void OnPost(object sender, StreamVolumeEventArgs e)
{
    richTextBox1.Text += e.MaxSampleValues[0].ToString() + "\t";
}

And here are some values from the read data:

0.2570496

6.103516E-05

but when the application is closed two error messeges appear: "AcmStream Dispose was not called at AcmStream.Finalize()" but when I checked the code it was already called, and the other one is the same but at AcmStreamHeader.Finalize()


Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>