Hello,
this is not a bug, this is a question
I'm very new to audio part. i got many questions come in my mind.
1)what is peak?
2)how can i generate peak format data form mp3 using c#
3)Peak data is json array data?
4) and how can i play large(2 hours) audio while loading.
Please help me, i'm getting so much confused.
1) The visualization of the audio.
2) Don't know.
3) No, it's just numbers in an array. Does not have to be JSON.
4) You will need to have your audio load in as a stream from your server...
Take a look at this issue: https://github.com/katspaugh/wavesurfer.js/issues/1141
There you have links and resources explaining how to extract peaks and prepare them for wavesurfer. For playing large files before they download entirely, you can try with MediaElement and a server that supports partial byte range requests (I use cloudfront).
I have also found that large audio files need peak data added in chunks (of their constituent audio data), or there will be memory issues.
@agamemnus , @matixmatix is possible to show waveform half section like this site audio mack
and still i'm looking for solution to convert peaks from wav or mp3 :-(
Hello Guy,
Finally i came to use NAudio library to generate peaks using .net(visual studio). this post may help others or get idea to save peaks with mp3 or wav file.
using(var reader = new AudioFileReader(file))
{
var samples = reader.Length / (reader.WaveFormat.Channels * reader.WaveFormat.BitsPerSample / 8);
var max = 0.0f;
// waveform will be a maximum of 4000 pixels wide:
var batch = (int)Math.Max(40, samples / 4000);
float[] buffer = new float[batch];
int read;
while((read = reader.Read(buffer,0,batch)) == batch)
{
for(int n = 0; n < read; n++)
{
max = Math.Max(Math.Abs(buffer[n]), max);
};
console.write(max);//peak ex: 0.342424, this can be store in array or .peak file
console.write(',');
max = 0;
}
}
source link : https://stackoverflow.com/questions/13629277/analyzing-wav-and-drawing-a-graph
@smohammedyasin have you slove it ? cloud you share your demo ?
Most helpful comment
Hello Guy,
Finally i came to use NAudio library to generate peaks using .net(visual studio). this post may help others or get idea to save peaks with mp3 or wav file.
source link : https://stackoverflow.com/questions/13629277/analyzing-wav-and-drawing-a-graph