This project has moved. For the latest updates, please go here.

Complet Wavform of a song

Nov 19, 2008 at 1:44 PM
First of all, thank you for your excellent library NAudio for NET.

I want to develop a application that can show the full view of waveform from MP3 and WAV files with horizontal zoom in and zoom out functions. A try to use your Waveformpainter GUI component by using your demo sample but this component display only the waveform according to the reading (display only the progression of playing). I try too the WaveViewer GUI component without success, i don't recognize the data (waveform) display on it.

I don't find documentations regarding you components (using and/or class implementation), i suppose that is due to "under development" state of you library.

Could you give me some help (example, tips or explanation) to release this...

Note : I progarm in Visual Studio 2008 for C#

Thanks for your help...
Coordinator
Nov 25, 2008 at 9:04 AM
hi there,

NAudio does not currently support a zoomable view of an entire WAV file. It is something I would like to add, but it is not currently at the top of the agenda. It is not that hard to implement, but to get something that is memory efficient and performs well is a little more tricky. I know a lot of the pro DAW apps create temporary "peak" files to optimise their drawing.

Mark

Nov 26, 2008 at 9:58 AM
Thanks for your answer Mark,

In fact i just want to create my own "peak" file and display by myself the waveform. For that i use parts of your library (i don't ask you to finish your promising project in one night :-)). After some empirical tests i found a solution to generate the usefull data for a "peak waveform creation" to hijack the NAudioDemo, but i have a last problem "to complet my plan" :

It's seem have a bug in your library to determine the exact lenght of mp3 files : the wavestream.lenght value is wrong, by consequence the total time duration display in screen is wrong too. For Wav files the wavestream.lenght is correct but not for mp3 files. The "time quantity of error" depends to the quality of MP3 encoding (kbps).

I don't not if the error of ".lenght" is occured after this code :

WaveStream mp3Reader = new Mp3FileReader(fileName);

or after this one :

WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(mp3Reader);

Could you help me to find a solution to resolve this?

Thanks again for your help.

Yann
Jul 13, 2011 at 8:01 AM

Hi.

 

Again, first of all thank for your work Mark.

 

Yann,

I am also trying to create my own "peak" file, so I wanted to know if you  finally manage to do it; and if you would accept to give me some advice.

 

Thanks for your help.

Jul 13, 2011 at 9:41 AM

Hi,

I have found a solution to manage my own "peak" file and my own waveform view, but it's not a standard management of "peak" data and waveform, it's too many specific of my program needs. A second and probably more important problem it is that my "peak" code and my waveform view code are not isolated in independant file code, and it would be too long to extract this code to the main code. It's why i can not give you a sample code like that. If i have time in the futur, i will extract "peak" and waveform generator in independant lib with more universal functions, but i have no plan this soon...

I suggest you to use other source sample code like http://wpfsvl.codeplex.com/ , very good code to view full waveform of audio file. With this code you can easily hack your own "peak" file generator by filtering data used to visualize waveform... You can also use markheath's sample code NAudioDemo or NAudioWpfDemo to hack waveform view control with same technic as wpf sound visualisation library...

Nov 8, 2011 at 8:20 AM

Hi,

 

Sorry, long time before answering.

 

In the end, I did not need any peak file: my problem was that during the zoom, my application was very slow, but I discovered it was a different problem.

Thank again for your help.

(I still have some issues with the managing of the thread that deals with the sound reader, but I'll come to that later).