Spectrum Good Plugin

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Spectrum Good Plugin

Cole
Hello,

I am using the spectrum good plugin with gstreamermm and it is working really well. I just have one question that doesn't seem to be answered in the documentation for it here. What is the frequency range it analyzes? If i set bands = 10, what frequency does the first and the last band cover? Is it 20-20K Hz?

Thanks for any insight.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Spectrum Good Plugin

Sebastian Dröge-3
On Di, 2016-05-17 at 11:34 -0400, Cole Bush wrote:
> Hello,
>
> I am using the spectrum good plugin with gstreamermm and it is
> working really well. I just have one question that doesn't seem to be
> answered in the documentation for it here. What is the frequency
> range it analyzes? If i set bands = 10, what frequency does the first
> and the last band cover? Is it 20-20K Hz?

It depends on the samplerate. If you have 48kHz, it will be 0Hz to
24kHz (0 to nyquist frequency) and the bands are equally spaced over
that range. So with 10 bands, the first band would be 0 to 2.4kHz.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Spectrum Good Plugin

Cole
Interesting. First, sameplerate is the same as 1 / "interval", right? 

For context, I am outputting this data onto a RGB matrix from my raspberry pi. Visually, it seems that an interval of 50 million nanoseconds is a good speed for the matrix's refresh rate. This would mean my sample rate is 20 Hz, correct? With 10 bands, would that make each band represent 1 Hz covering 0-10Hz? 

On Tue, May 17, 2016 at 11:46 AM, Sebastian Dröge <[hidden email]> wrote:
On Di, 2016-05-17 at 11:34 -0400, Cole Bush wrote:
> Hello,
>
> I am using the spectrum good plugin with gstreamermm and it is
> working really well. I just have one question that doesn't seem to be
> answered in the documentation for it here. What is the frequency
> range it analyzes? If i set bands = 10, what frequency does the first
> and the last band cover? Is it 20-20K Hz?

It depends on the samplerate. If you have 48kHz, it will be 0Hz to
24kHz (0 to nyquist frequency) and the bands are equally spaced over
that range. So with 10 bands, the first band would be 0 to 2.4kHz.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Spectrum Good Plugin

Sebastian Dröge-3
On Di, 2016-05-17 at 12:53 -0400, Cole Bush wrote:
> Interesting. First, sameplerate is the same as 1 / "interval",
> right? 

It will generate a message every "interval" nanoseconds, but this
message will contain the average of multiple spectrums. The number of
samples per spectrum is controlled by the number of bands.

> For context, I am outputting this data onto a RGB matrix from my
> raspberry pi. Visually, it seems that an interval of 50 million
> nanoseconds is a good speed for the matrix's refresh rate. This would
> mean my sample rate is 20 Hz, correct? With 10 bands, would that make
> each band represent 1 Hz covering 0-10Hz? 

If your samplerate is 20kHz, then you will have frequencies from 0 to
10kHz (the nyquist frequency is half the samplerate). Each band then
will be evenly spaced over that range, i.e.

0-1kHz
1-2kHz
2-3kHz
...
9-10kHz

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Spectrum Good Plugin

Cole
The second half makes sense, but i don't understand how to calculate the samplerate. 

> It will generate a message every "interval" nanoseconds, but this
> message will contain the average of multiple spectrums. The number of
> samples per spectrum is controlled by the number of bands.

I would like to determine the exact samplerate so i can then find the width of each band. Is there a way to find what the value of "multiple spectrums" is? I am getting 20 messages a second, x spectrums a message, and 100 bands per spectrum. If i multiply these, i should get the samplerate, correct?

I appreciate your help.


On Wed, May 18, 2016 at 8:39 AM, Sebastian Dröge <[hidden email]> wrote:
On Di, 2016-05-17 at 12:53 -0400, Cole Bush wrote:
> Interesting. First, sameplerate is the same as 1 / "interval",
> right? 

It will generate a message every "interval" nanoseconds, but this
message will contain the average of multiple spectrums. The number of
samples per spectrum is controlled by the number of bands.

> For context, I am outputting this data onto a RGB matrix from my
> raspberry pi. Visually, it seems that an interval of 50 million
> nanoseconds is a good speed for the matrix's refresh rate. This would
> mean my sample rate is 20 Hz, correct? With 10 bands, would that make
> each band represent 1 Hz covering 0-10Hz? 

If your samplerate is 20kHz, then you will have frequencies from 0 to
10kHz (the nyquist frequency is half the samplerate). Each band then
will be evenly spaced over that range, i.e.

0-1kHz
1-2kHz
2-3kHz
...
9-10kHz

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Spectrum Good Plugin

Sebastian Dröge-3
On Mi, 2016-05-18 at 09:51 -0400, Cole Bush wrote:

> The second half makes sense, but i don't understand how to calculate the samplerate. 
>
> > It will generate a message every "interval" nanoseconds, but this
> > message will contain the average of multiple spectrums. The number of
> > samples per spectrum is controlled by the number of bands.
>
> I would like to determine the exact samplerate so i can then find the
> width of each band. Is there a way to find what the value of
> "multiple spectrums" is? I am getting 20 messages a second, x
> spectrums a message, and 100 bands per spectrum. If i multiply these,
> i should get the samplerate, correct?
>
> I appreciate your help.
The samplerate is a property of the audio stream you have, and you can
get that from the caps on the pads of the spectrum element for example.

Each spectrum is with (2 * bands - 2) samples IIRC. The spectrum
element is just doing a normal FFT of a specific length based on the
number of bands you want to have in the end.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment