filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.14k stars 450 forks source link

Is it possible to plot an linespectrum chart without actually having BasicSpectrum Provider? #448

Open c1Koriginal opened 3 years ago

c1Koriginal commented 3 years ago

Using the code from Closed Issue #273 I can get fft data from all samples in a file. I do calculate an average then, since I need to have an average rate of all frequencies used(debatable, but let's assume I need).

The question is how do I actually plot that data on the graph? It seems like I can't get rid of spectrumProvider(WinformsVisualization:L163 no matter how hard I try).

I also tried playing with GenerateLineSpectrum by passing to it my averageFftBuffer(and forcing all other methods to pass it down until it should be used), having no luck at all.

I've been stuck on this for a while already, so it will be great if you managed to help me:)

Ambusy commented 3 years ago

I had something like that: wanted a different program to plot the data. I copied the LineSpectrum and SpectrumBase classes in my namespace with a different name, added the imports and then rewrote the pieces I wanted. I even combined the 2 classes in 1 new class based on the SpectrumBase's base-class. In the end the only interesting thing is the bitmap that is to be displayed. You can probably simplify the classes much, as you might not need to be so general as Cscore needs to be! If you have the data ready, then CreateSpectrumLineInternal will plot them. You might want to download my Player project to have the working example: http://digilander.libero.it/ambusy/PlayerSimple.zip. You will have to copy the address manually, Github does not allow direct links, I'm sorry for that