Spectrogram in Numpy

Post Reply
vigician
Posts: 3
Joined: Tue Dec 17, 2019 4:12 pm

Spectrogram in Numpy

Post by vigician »

Hi, first of all, thanks for the great app!

I am currently working on a school project and I want to do image processing on the spectrogram. I am recording the raw data in the CSV files for AF7 and AF8, but I am not sure how I can generate the spectrogram in e.g Numpy. I want to use the CSV files because there I have timestamps and I can synchronize with a video.

Is that possible/easy to do?
User avatar
James
Site Admin
Posts: 1089
Joined: Wed Jan 02, 2013 9:06 pm

Re: Spectrogram in Numpy

Post by James »

I've not heard of Numpy.

The spectrogram is a color mapped fft plot. You will need to set the recording interval to constant to have enough data for an fft.

If you Google fft code there are many examples, but it's quite complex math. If you just want a video of the spectrogram from the app then I would recommend recording it with Reflector by Air Squirrels which you can get for Mac and PC.
vigician
Posts: 3
Joined: Tue Dec 17, 2019 4:12 pm

Re: Spectrogram in Numpy

Post by vigician »

Thanks! I figured out how to make it by using this function: https://docs.scipy.org/doc/scipy/refere ... ogram.html
The only thing I don't understand is the [1., 3.] range that is configurable in the app. Do you just clip all values above those or do you normalize all values in this range?
User avatar
James
Site Admin
Posts: 1089
Joined: Wed Jan 02, 2013 9:06 pm

Re: Spectrogram in Numpy

Post by James »

vigician wrote: Fri Dec 27, 2019 2:58 am The only thing I don't understand is the [1., 3.] range that is configurable in the app.
If you're talking about "Magnitude Min" and "Magnitude Max" then this is the visibly graphed range. It doesn't affect calculations, streamed or recorded values.
vigician
Posts: 3
Joined: Tue Dec 17, 2019 4:12 pm

Re: Spectrogram in Numpy

Post by vigician »

Got it! Just .clip in Numpy does the trick. Awesome! I will update here with my Github repo when I am ready with the whole project, but I managed to create a similar graph with Numpy/Scipy. Thanks!
Post Reply