# Frequency modulation in GRC

**URL:** <https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942>\
**Category:** GNU Radio\
**Created:** [May 23, 2014, 6:27am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942 "2014-05-23T06:27:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 23, 2014, 6:27am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/1 "2014-05-23T06:27:49Z")

</div>

Hi,  
I have made the flowgraph as attached…It is showing the modulation in  
scope but in fft block it’s continuously changing so I am still unable  
to  
find out that what are the max and min frequencies??I know how to find  
that  
in theory but i want to prove it from my results…

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 23, 2014, 10:21am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/2 "2014-05-23T10:21:30Z")

</div>

Well, when I use the same sensitivity as u, I cant see, but with higher  
value u can see.U can use average option but still with that sensitivity  
u  
will not see much.

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 23, 2014, 10:30am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/3 "2014-05-23T10:30:09Z")

</div>

I was experimenting with this the other day. I used  
the wide band FM modulator instead, since the  
deviation can be set. Here’s the flow graph.

[http://www.w6rz.net/fmtest.grc](http://www.w6rz.net/fmtest.grc)

The test audio files. sine01.wav is 0.1 Hz and  
sine15k.wav is 15000 Hz.

[https://www.w6rz.net/sine01.wav](https://www.w6rz.net/sine01.wav)

[https://www.w6rz.net/sine15k.wav](https://www.w6rz.net/sine15k.wav)

Some C code to generate audio files at other frequencies.

[http://www.w6rz.net/sine.c](http://www.w6rz.net/sine.c)

Ron

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 24, 2014, 9:24am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/4 "2014-05-24T09:24:36Z")

</div>

Another question related to my flowgraph that when i use the’ Frequency  
Mod’ block…then it will take the center frequency as 50Hz(the freq of  
the  
signal coming in)??

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 24, 2014, 9:48am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/5 "2014-05-24T09:48:34Z")

</div>

Correction not 50 Hz but whatever the rate is after interpolation

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 24, 2014, 12:20pm UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/6 "2014-05-24T12:20:00Z")

</div>

Ali,

again: there is no center frequency in a baseband simulation. Your  
sawtooth-repeat combination will give you a step signal, where the  
amplitude is constant for 500 items. All frequencies that you set are  
only used to calculate what will happen in one sample.

The frequency mod is but an input amplitude controlled complex sine.  
It outputs a signal, which has a momentary phase increase that is  
proportional to sensitivity and input amplitude; see the doxygen  
documentation for the frequency\_modulator block.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 26, 2014, 1:10pm UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/7 "2014-05-26T13:10:41Z")

</div>

You still seem to have no real grasp on what the frequency\_modulator  
block does.  
Read my reply, and the documentation to that block again:

> > The frequency mod is but an input amplitude controlled complex sine.  
> > It outputs a signal, which has a momentary phase increase that is  
> > proportional to sensitivity and input amplitude; see the doxygen  
> > documentation for the frequency\_modulator block.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 26, 2014, 9:37pm UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/8 "2014-05-26T21:37:05Z")

</div>

On Mon, May 26, 2014 at 10:20 AM, Activecat [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Says, your sampling rate is samp\_rate
> 
> Assuming the lowest input value to the FM block is zero, then  
> minimum frequency of the FM output = samp\_rate \* sensitivity / ( 2 \* PI )
> 
> Assuming the highest input value to the FM block is Vmax, then  
> maximum frequency of the FM output = samp\_rate \* ( sensitivity + Vmax )  
> / ( 2 \* PI)

To avoid disagreement, the sampling rate (samp\_rate) refers to the  
number  
of elements produced by this FM block per second.  
If there is no speed-limiting element (throttle, usrp, sound card etc)  
in  
the flowgraph, then someone may say that samp\_rate becomes meaningless,  
if  
this is the case then in fact frequency also becomes quite meaningless..

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 26, 2014, 9:25pm UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/9 "2014-05-26T21:25:24Z")

</div>

On 25.05.2014 20:01, jason sam wrote:

> > But if it is doing FM then there should be some min and max  
> > frequencies between which the signal will be switching?

If you refer to the source code of the frequency\_modulator\_fc\_impl.cc,  
then  
the min and max frequencies could be calculated.

Says, your sampling rate is samp\_rate

Assuming the lowest input value to the FM block is zero, then  
minimum frequency of the FM output = samp\_rate \* sensitivity / ( 2 \*  
PI )

Assuming the highest input value to the FM block is Vmax, then  
maximum frequency of the FM output = samp\_rate \* ( sensitivity + Vmax  
) /  
( 2 \* PI)

For reference, the work function of the FM block is as below.

```
int
frequency_modulator_fc_impl::work( int noutput_items,
                  gr_vector_const_void_star &input_items,
                  gr_vector_void_star &output_items)
{
      const float *in = (const float*)input_items[0];
      gr_complex *out = (gr_complex*)output_items[0];

      for(int i = 0; i < noutput_items; i++)
      {
            d_phase = d_phase + d_sensitivity * in[i];

            while (d_phase > (float)(M_PI))
              d_phase -= (float)(2.0 * M_PI);

            while (d_phase < (float)(-M_PI))
              d_phase += (float)(2.0 * M_PI);

            float oi, oq;

            gr_int32 angle = gr::fxpt::float_to_fixed (d_phase);
            gr::fxpt::sincos(angle, &oq, &oi);
            out[i] = gr_complex(oi, oq);
      }

      return noutput_items;
}

```

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 27, 2014, 1:46am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/10 "2014-05-27T01:46:15Z")

</div>

Hi Ali,

I’m talking about  
[http://gnuradio.org/doc/doxygen/classgr\_1\_1analog\_1\_1frequency\_\_modulator\_\_fc.html](http://gnuradio.org/doc/doxygen/classgr_1_1analog_1_1frequency __modulator__ fc.html)

This is the and thus only comprehensive documentation.  
But really, all this block does is, like I in text [1] and activecat in  
text and code[2] tried to explain,  
is increase the phase of its output signal by sensitivity\*input .  
I get the feeling this has been discussed exceedingly enough, and would  
like to close this thread.

Greetings,  
Marcus

[1] It outputs a signal, which has a momentary phase increase that is  
proportional to sensitivity and input amplitude  
[2] d\_phase = d\_phase + d\_sensitivity \* in[i];

---

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [May 27, 2014, 1:51am UTC](https://www.ruby-forum.com/t/frequency-modulation-in-grc/229942/11 "2014-05-27T01:51:47Z")

</div>

ok got it
