Taking a single sample is not that good for a VUmeter (it often misses peaks). Do you have suggestions about how many samples to take? It is better, in your opinion, to take the average or the peak among them?

I’ll do a few experments, but if someone expert already knows what’s best …

[quote:3bt6v29r]Don’t use the average of the values, use the max value of the abs() of the data, you will see why if you plot each method (ie the average of a full volume sine wave is 0!)[/quote:3bt6v29r]

Yes, I was thinking about the average of abs() 😳

Well, given a 44100 sampling rate, and a lowest significative frequency of 30 Hz to be sure to catch at least a peak you should take 735 samples. A little experimenting shows me that 128 values are fine enough for a nice visualization.