Let the select to see a spectrogram seekbar instead of the waveform seekbar.
A spectrogram looks like this:
A spectrogram shows the use of frequencies for each point of a track (x-axis = time, y-axis = frequency, coloring = loudness).
This way you can recognize low quality audio files, since they have a large black border at the top, because high frequencies have been cut.
This is interesting, although I have not rendered a spectogram before so I assume it will need some work.
But I guess, you can't use this, since it does not fulfill your needs?!
>>But I guess, you can't use this, since it does not fulfill your needs?!
That one works perfect, but ONLY when rendered in realtime.
This method requires that you feed the function with data for each new position (=realtime playback) which fails completely in two major cases:
1) I need to pre-render the spectogram just as the waveform whilst playing
2) If you skip during rendering, there will be gaps in the spectogram
Therefore it's a must to first render the wavpeaks to a buffer (as for the waveform) and the apply FFT transformations to get the magnitute for each line.
I did some speedtests as well and that's a bit worrying since in a spectorgram each pixel needs to be plotted, lines are simply not allowed.
I checked your code Emil, but it is still using reltime rendering with "BASS_ChannelGetData", since I have a pre-filled buffer I must do the FFT myself on the buffer. Quite complex ;)
yes is not to simple..
do it if you has time for it. :)
Yep, so far I think the FFT calculation eats to much CPU, but I will continue to see if it can be optimized.
The problem with a spectogram is that it cannot be rendered in positions later than the current playing position.
So, assume that I'm playing 0-10, during that time (even if my CPU allows it) I cannot render position 11-30, something I can with the waveform.
The spectogram is based on time (x-axis) and frequency (peaks) and an FFT for each position (each pixel per vertical line) and the current methods only supports it for the current playing position.
Therefore, if I skip position in the playing stream, I will need to create a "gap" in the spectrogram since I advanced in the time scale.
We'll see, the basics must work first, then the rendering will be another thing.
Plotting width*height pixles can be a bit slow, if you need to apply FFT to each pixel.
Simplified, this one became a bit bigger than expected. :)
>>I checked your code Emil, but it is still using reltime rendering
i have send it to you
so you can see i never use decibel for drawing Pixel
decibel is not needed for a spectogram
Mikael.. here any Infos how create spectrogram without playing..
Sorry i can not do it self too little experience with WPF.
Just create a decoding channel (BASS_STREAM_DECODE flag) and in a loop use BASS_ChannelGetData() with one of the FFT flags to get the FFTs. Every returned array is one column for the sonogram/spectogram.
@Emil: I have tested this, and it seems to be quite OK although the calculation of the full-size spectrum is slow, especially for longer files.
I need to see if this can be optimized somehow otherwise it cannot be added.
Realtime is quick since it only render a small position at a time.