The phase is scaled to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi.
The phase is scaled to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi.
Relative functions:
Functions | |
dsp16_t | dsp16_gen_cos (dsp16_t *vect1, int size, int f, int fs, dsp16_t phase) |
16-bit fixed point version of the cosinusoidal signal generation. | |
void | dsp16_gen_dcomb (dsp16_t *vect1, int size, int f, int fs, dsp16_t delay) |
16-bit fixed point version of the dirac comb signal generation. | |
void | dsp16_gen_dirac (dsp16_t *vect1, int size, int dirac_index) |
16-bit fixed point version of the dirac comb signal generation. | |
void | dsp16_gen_noise (dsp16_t *vect1, int size, dsp16_t amp) |
16-bit fixed point version of the noise generation. | |
void | dsp16_gen_ramp (dsp16_t *vect1, int size, dsp16_t increment) |
16-bit fixed point version of the ramp signal generation. | |
void | dsp16_gen_rect (dsp16_t *vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay) |
16-bit fixed point version of the rectangular signal generation. | |
dsp16_t | dsp16_gen_saw (dsp16_t *vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay) |
16-bit fixed point version of the saw tooth signal generation. | |
dsp16_t | dsp16_gen_sin (dsp16_t *vect1, int size, int f, int fs, dsp16_t phase) |
16-bit fixed point version of the sinusoidal signal generation. | |
static void | dsp16_gen_sqr (dsp16_t *vect1, int size, int f, int fs, dsp16_t delay) |
16-bit fixed point version of the square signal generation. | |
void | dsp16_gen_step (dsp16_t *vect1, int size, dsp16_t intial_value, dsp16_t final_value, int step_index) |
16-bit fixed point version of the dirac comb signal generation. | |
dsp32_t | dsp32_gen_cos (dsp32_t *vect1, int size, int f, int fs, dsp32_t phase) |
32-bit fixed point version of the cosinusoidal signal generation. | |
void | dsp32_gen_dcomb (dsp32_t *vect1, int size, int f, int fs, dsp32_t delay) |
32-bit fixed point version of the dirac comb signal generation. | |
void | dsp32_gen_dirac (dsp32_t *vect1, int size, int dirac_index) |
32-bit fixed point version of the dirac comb signal generation. | |
void | dsp32_gen_noise (dsp32_t *vect1, int size, dsp32_t amp) |
32-bit fixed point version of the noise generation. | |
void | dsp32_gen_ramp (dsp32_t *vect1, int size, dsp32_t increment) |
32-bit fixed point version of the ramp signal generation. | |
void | dsp32_gen_rect (dsp32_t *vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay) |
32-bit fixed point version of the rectangular signal generation. | |
dsp32_t | dsp32_gen_saw (dsp32_t *vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay) |
32-bit fixed point version of the saw tooth signal generation. | |
dsp32_t | dsp32_gen_sin (dsp32_t *vect1, int size, int f, int fs, dsp32_t phase) |
32-bit fixed point version of the sinusoidal signal generation. | |
static void | dsp32_gen_sqr (dsp32_t *vect1, int size, int f, int fs, dsp32_t delay) |
32-bit fixed point version of the square signal generation. | |
void | dsp32_gen_step (dsp32_t *vect1, int size, dsp32_t intial_value, dsp32_t final_value, int step_index) |
32-bit fixed point version of the dirac comb signal generation. |
16-bit fixed point version of the cosinusoidal signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
phase | The phase of the output signal. |
Definition at line 53 of file gen_cosinusoidal.c.
References dsp16_op_cos(), and DSP16_QB.
00054 { 00055 int t; 00056 dsp16_t s, angle; 00057 00058 angle = phase; 00059 // Calculate the angle "s" which is used to increment the argument of the cosine each transition in the loop 00060 s = (((S32) f) << (DSP16_QB + 1))/fs; 00061 00062 // Main loop 00063 for(t=0; t<size; t++) 00064 { 00065 vect1[t] = dsp16_op_cos(angle); 00066 // Increment the argument of the cosine 00067 angle += s; 00068 } 00069 00070 // Return the current phase of the generated signal 00071 return angle; 00072 }
16-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 56 of file gen_diraccomb.c.
References DSP16_Q, DSP16_QB, and MIN.
00057 { 00058 int i; 00059 int t_inc, t_low, cp; 00060 int t_delay; 00061 00062 // Number of sample per period 00063 t_inc = fs / f; 00064 // Number of sample for the delay 00065 t_delay = (((S32) delay) * ((S32) t_inc)) >> DSP16_QB; 00066 00067 // Number of sample per low signal 00068 t_inc--; 00069 00070 i = 0; 00071 t_low = t_delay; 00072 00073 // Main loop 00074 while(i < size) 00075 { 00076 // Low part 00077 cp = MIN(t_low, size); 00078 for(; i<cp; i++) 00079 vect1[i] = DSP16_Q(0.); 00080 // High part 00081 if (i < size) 00082 vect1[i++] = DSP16_Q(1.); 00083 00084 t_low = t_inc + i; 00085 } 00086 }
void dsp16_gen_dirac | ( | dsp16_t * | vect1, | |
int | size, | |||
int | dirac_index | |||
) |
16-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
dirac_index | The index in the buffer, where the dirac appears. |
Definition at line 53 of file gen_dirac.c.
References DSP16_Q, and dsp16_vect_zeropad().
00054 { 00055 // Fill the buffer with zeros 00056 dsp16_vect_zeropad(vect1, size, size); 00057 // Set the dirac pic 00058 vect1[dirac_index] = DSP16_Q(1.); 00059 }
16-bit fixed point version of the noise generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
amp | The amplitude of the signal. |
Definition at line 53 of file gen_noise.c.
References dsp16_op_rand(), DSP16_Q, and DSP16_QB.
00054 { 00055 int t; 00056 00057 // If amp == 1. then the signal is much faster to compute 00058 if (amp == DSP16_Q(1.)) 00059 { 00060 // Main loop 00061 for(t=0; t<size; t++) 00062 vect1[t] = dsp16_op_rand(); 00063 } 00064 else 00065 { 00066 // Main loop 00067 for(t=0; t<size; t++) 00068 // Get a pseudo-random sample and scale it with the desired amplitude 00069 vect1[t] = ((S32) dsp16_op_rand())*((S32) amp) >> DSP16_QB; 00070 } 00071 }
16-bit fixed point version of the ramp signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
increment | The incrementation of the signal per vector's element. |
Definition at line 53 of file gen_ramp.c.
References DSP16_Q.
00054 { 00055 int i = 0; 00056 dsp16_t t, limit_t; 00057 00058 // Limit of the signal 00059 limit_t = DSP16_Q(1.) - increment; 00060 if ((((S32) increment) * ((S32) size)) < ((S32) limit_t)) 00061 limit_t = increment * size; 00062 00063 // Ramp loop 00064 for(t = DSP16_Q(0.); t < limit_t; t += increment) 00065 vect1[i++] = t; 00066 // Filling loop 00067 for(; i<size; i++) 00068 vect1[i] = DSP16_Q(1.); 00069 }
16-bit fixed point version of the rectangular signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
duty | The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 56 of file gen_rectangular.c.
References DSP16_Q, DSP16_QB, and MIN.
Referenced by dsp16_gen_sqr().
00057 { 00058 int i = 0; 00059 int t_low_inc, t_high_inc, cp; 00060 int t_low, t_high, t_delay; 00061 00062 // Number of sample per period 00063 t_low_inc = fs / f; 00064 // Number of sample per high signal 00065 t_high_inc = (((S32) duty) * ((S32) t_low_inc)) >> DSP16_QB; 00066 // Number of sample for the delay 00067 t_delay = (((S32) delay) * ((S32) t_low_inc)) >> DSP16_QB; 00068 // Number of sample per low signal 00069 t_low_inc -= t_high_inc; 00070 00071 i = 0; 00072 00073 // For the delay 00074 t_high = MIN(t_high_inc, t_delay - t_low_inc); 00075 t_low = MIN(t_low_inc, t_delay); 00076 if (t_high > 0) 00077 t_low += t_high; 00078 00079 // Main loop 00080 while(i < size) 00081 { 00082 // High part 00083 cp = MIN(t_high, size); 00084 for(; i<cp; i++) 00085 vect1[i] = DSP16_Q(1.); 00086 00087 // Low part 00088 cp = MIN(t_low, size); 00089 for(; i<cp; i++) 00090 vect1[i] = DSP16_Q(-1.); 00091 00092 t_high = t_high_inc + i; 00093 t_low = t_high + t_low_inc; 00094 } 00095 00096 }
16-bit fixed point version of the saw tooth signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
duty | The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 51 of file gen_sawtooth.c.
References DSP16_Q, DSP16_QB, and Max.
00052 { 00053 int i = 0; 00054 S32 t_low_inc, t_high_inc, t; 00055 dsp16_t delta_rise, delta_decrease, delta; 00056 00057 // Number of sample per period 00058 t_low_inc = fs / f; 00059 // Number of sample per high signal 00060 t_high_inc = (((S32) duty) * ((S32) t_low_inc)) >> DSP16_QB; 00061 // Number of sample for the delay 00062 t = (((S32) delay) * ((S32) t_low_inc)) >> DSP16_QB; 00063 // Number of sample per low signal 00064 t_low_inc -= t_high_inc; 00065 00066 // Calculate the delta coefficient of the rising edge of the saw tooth 00067 delta_rise = (DSP16_Q(1.) / t_high_inc) * 2; 00068 // Calculate the delta coefficient of the decreasing edge of the saw tooth 00069 delta_decrease = (DSP16_Q(1.) / t_low_inc) * 2; 00070 00071 // Compute the initial value 00072 if (t < t_high_inc) 00073 delta = DSP16_Q(-1.) + t * delta_rise; 00074 else 00075 delta = DSP16_Q(1.) - (t - t_high_inc) * delta_decrease; 00076 00077 while(i < size) 00078 { 00079 int lim, j; 00080 00081 if (i) 00082 t = 0; 00083 00084 lim = Max(0, Min(t_high_inc - t, size - i)); 00085 for(j=0; j<lim; j++) 00086 vect1[i++] = (delta += delta_rise); 00087 t += lim; 00088 00089 if (j) 00090 delta = DSP16_Q(1.); 00091 00092 lim = Min(t_high_inc + t_low_inc - t, size - i); 00093 for(j=0; j<lim; j++) 00094 vect1[i++] = (delta -= delta_decrease); 00095 t += lim; 00096 00097 delta = DSP16_Q(-1.); 00098 } 00099 00100 return (t << DSP16_QB) / (t_high_inc + t_low_inc); 00101 }
16-bit fixed point version of the sinusoidal signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
phase | The phase of the output signal. |
Definition at line 53 of file gen_sinusoidal.c.
References dsp16_op_sin(), and DSP16_QB.
Referenced by generate_signal().
00054 { 00055 int t; 00056 dsp16_t s, angle; 00057 00058 angle = phase; 00059 // Calculate the angle "s" which is used to increment the argument of the sine each transition in the loop 00060 s = (((S32) f) << (DSP16_QB + 1))/fs; 00061 00062 // Main loop 00063 for(t=0; t<size; t++) 00064 { 00065 vect1[t] = dsp16_op_sin(angle); 00066 // Increment the argument of the sine 00067 angle += s; 00068 } 00069 00070 // Return the current phase of the generated signal 00071 return angle; 00072 }
static void dsp16_gen_sqr | ( | dsp16_t * | vect1, | |
int | size, | |||
int | f, | |||
int | fs, | |||
dsp16_t | delay | |||
) | [inline, static] |
16-bit fixed point version of the square signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 244 of file dsp_signal_generation.h.
References dsp16_gen_rect(), and DSP16_Q.
00244 { dsp16_gen_rect(vect1, size, f, fs, DSP16_Q(0.5), delay); }
void dsp16_gen_step | ( | dsp16_t * | vect1, | |
int | size, | |||
dsp16_t | intial_value, | |||
dsp16_t | final_value, | |||
int | step_index | |||
) |
16-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 16-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
intial_value | The initial value of the signal. | |
final_value | The final value of the signal. | |
step_index | The index in the buffer, where the step appears. |
Definition at line 53 of file gen_step.c.
00054 { 00055 int i; 00056 00057 for(i = 0; i < step_index; i++) 00058 vect1[i] = intial_value; 00059 for(; i < size; i++) 00060 vect1[i] = final_value; 00061 }
32-bit fixed point version of the cosinusoidal signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
phase | The phase of the output signal. |
Definition at line 81 of file gen_cosinusoidal.c.
References dsp32_op_cos(), and DSP32_QB.
00082 { 00083 int t; 00084 dsp32_t s, angle; 00085 00086 angle = phase; 00087 // Calculate the angle "s" which is used to increment the argument of the cosine each transition in the loop 00088 s = (((long long) f) << (DSP32_QB + 1))/fs; 00089 00090 // Main loop 00091 for(t=0; t<size; t++) 00092 { 00093 vect1[t] = dsp32_op_cos(angle); 00094 // Increment the argument of the cosine 00095 angle += s; 00096 } 00097 00098 // Return the current phase of the generated signal 00099 return angle; 00100 }
32-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 94 of file gen_diraccomb.c.
References DSP32_Q, DSP32_QB, and MIN.
00095 { 00096 int i; 00097 int t_inc, t_low, cp; 00098 int t_delay; 00099 00100 // Number of sample per period 00101 t_inc = fs / f; 00102 // Number of sample for the delay 00103 t_delay = (((S64) delay) * ((S64) t_inc)) >> DSP32_QB; 00104 00105 // Number of sample per low signal 00106 t_inc--; 00107 00108 i = 0; 00109 t_low = t_delay; 00110 00111 // Main loop 00112 while(i < size) 00113 { 00114 // Low part 00115 cp = MIN(t_low, size); 00116 for(; i<cp; i++) 00117 vect1[i] = DSP32_Q(0.); 00118 // High part 00119 if (i < size) 00120 vect1[i++] = DSP32_Q(1.); 00121 00122 t_low = t_inc + i; 00123 } 00124 }
void dsp32_gen_dirac | ( | dsp32_t * | vect1, | |
int | size, | |||
int | dirac_index | |||
) |
32-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
dirac_index | The index in the buffer, where the dirac appears. |
Definition at line 67 of file gen_dirac.c.
References DSP32_Q, and dsp32_vect_zeropad().
00068 { 00069 // Fill the buffer with zeros 00070 dsp32_vect_zeropad(vect1, size, size); 00071 // Set the dirac pic 00072 vect1[dirac_index] = DSP32_Q(1.); 00073 }
32-bit fixed point version of the noise generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
amp | The amplitude of the signal. |
Definition at line 80 of file gen_noise.c.
References dsp32_op_rand(), DSP32_Q, and DSP32_QB.
00081 { 00082 int t; 00083 00084 // If amp == 1. then the signal is much faster to compute 00085 if (amp == DSP32_Q(1.)) 00086 { 00087 // Main loop 00088 for(t=0; t<size; t++) 00089 vect1[t] = dsp32_op_rand(); 00090 } 00091 else 00092 { 00093 // Main loop 00094 for(t=0; t<size; t++) 00095 // Get a pseudo-random sample and scale it with the desired amplitude 00096 vect1[t] = ((S64) dsp32_op_rand())*((S64) amp) >> DSP32_QB; 00097 } 00098 }
32-bit fixed point version of the ramp signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
increment | The incrementation of the signal per vector's element. |
Definition at line 77 of file gen_ramp.c.
References DSP32_Q.
00078 { 00079 int i = 0; 00080 dsp32_t t, limit_t; 00081 00082 // Limit of the signal 00083 limit_t = DSP32_Q(1.) - increment; 00084 if ((((S64) increment) * ((S64) size)) < ((S64) limit_t)) 00085 limit_t = increment * size; 00086 00087 // Ramp loop 00088 for(t = DSP32_Q(0.); t < limit_t; t += increment) 00089 vect1[i++] = t; 00090 // Filling loop 00091 for(; i<size; i++) 00092 vect1[i] = DSP32_Q(1.); 00093 }
32-bit fixed point version of the rectangular signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
duty | The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 104 of file gen_rectangular.c.
References DSP32_Q, DSP32_QB, and MIN.
Referenced by dsp32_gen_sqr().
00105 { 00106 int i = 0; 00107 int t_low_inc, t_high_inc, cp; 00108 int t_low, t_high, t_delay; 00109 00110 // Number of sample per period 00111 t_low_inc = fs / f; 00112 // Number of sample per high signal 00113 t_high_inc = (((S64) duty) * ((S64) t_low_inc)) >> DSP32_QB; 00114 // Number of sample for the delay 00115 t_delay = (((S64) delay) * ((S64) t_low_inc)) >> DSP32_QB; 00116 // Number of sample per low signal 00117 t_low_inc -= t_high_inc; 00118 00119 i = 0; 00120 00121 // For the delay 00122 t_high = MIN(t_high_inc, t_delay - t_low_inc); 00123 t_low = MIN(t_low_inc, t_delay); 00124 if (t_high > 0) 00125 t_low += t_high; 00126 00127 // Main loop 00128 while(i < size) 00129 { 00130 // High part 00131 cp = MIN(t_high, size); 00132 for(; i<cp; i++) 00133 vect1[i] = DSP32_Q(1.); 00134 00135 // Low part 00136 cp = MIN(t_low, size); 00137 for(; i<cp; i++) 00138 vect1[i] = DSP32_Q(-1.); 00139 00140 t_high = t_high_inc + i; 00141 t_low = t_high + t_low_inc; 00142 } 00143 00144 }
32-bit fixed point version of the saw tooth signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
duty | The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 109 of file gen_sawtooth.c.
References DSP32_Q, DSP32_QB, and Max.
00110 { 00111 int i = 0; 00112 S32 t_low_inc, t_high_inc, t; 00113 dsp32_t delta_rise, delta_decrease, delta; 00114 00115 // Number of sample per period 00116 t_low_inc = fs / f; 00117 // Number of sample per high signal 00118 t_high_inc = (((S64) duty) * ((S64) t_low_inc)) >> DSP32_QB; 00119 // Number of sample for the delay 00120 t = (((S64) delay) * ((S64) t_low_inc)) >> DSP32_QB; 00121 // Number of sample per low signal 00122 t_low_inc -= t_high_inc; 00123 00124 // Calculate the delta coefficient of the rising edge of the saw tooth 00125 delta_rise = (DSP32_Q(1.) / t_high_inc) * 2; 00126 // Calculate the delta coefficient of the decreasing edge of the saw tooth 00127 delta_decrease = (DSP32_Q(1.) / t_low_inc) * 2; 00128 00129 // Compute the initial value 00130 if (t < t_high_inc) 00131 delta = DSP32_Q(-1.) + t * delta_rise; 00132 else 00133 delta = DSP32_Q(1.) - (t - t_high_inc) * delta_decrease; 00134 00135 while(i < size) 00136 { 00137 int lim, j; 00138 00139 if (i) 00140 t = 0; 00141 00142 lim = Max(0, Min(t_high_inc - t, size - i)); 00143 for(j=0; j<lim; j++) 00144 vect1[i++] = (delta += delta_rise); 00145 t += lim; 00146 00147 if (j) 00148 delta = DSP32_Q(1.); 00149 00150 lim = Min(t_high_inc + t_low_inc - t, size - i); 00151 for(j=0; j<lim; j++) 00152 vect1[i++] = (delta -= delta_decrease); 00153 t += lim; 00154 00155 delta = DSP32_Q(-1.); 00156 } 00157 00158 return (t << DSP32_QB) / (t_high_inc + t_low_inc); 00159 }
32-bit fixed point version of the sinusoidal signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
phase | The phase of the output signal. |
Definition at line 81 of file gen_sinusoidal.c.
References dsp32_op_sin(), and DSP32_QB.
00082 { 00083 int t; 00084 dsp32_t s, angle; 00085 00086 angle = phase; 00087 // Calculate the angle "s" which is used to increment the argument of the sine each transition in the loop 00088 s = (((long long) f) << (DSP32_QB + 1))/fs; 00089 00090 // Main loop 00091 for(t=0; t<size; t++) 00092 { 00093 vect1[t] = dsp32_op_sin(angle); 00094 // Increment the argument of the sine 00095 angle += s; 00096 } 00097 00098 // Return the current phase of the generated signal 00099 return angle; 00100 }
static void dsp32_gen_sqr | ( | dsp32_t * | vect1, | |
int | size, | |||
int | f, | |||
int | fs, | |||
dsp32_t | delay | |||
) | [inline, static] |
32-bit fixed point version of the square signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
f | The frequency of the output signal. | |
fs | The sampling frequency of the output signal. | |
delay | The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T. |
Definition at line 254 of file dsp_signal_generation.h.
References dsp32_gen_rect(), and DSP32_Q.
00254 { dsp32_gen_rect(vect1, size, f, fs, DSP32_Q(0.5), delay); }
void dsp32_gen_step | ( | dsp32_t * | vect1, | |
int | size, | |||
dsp32_t | intial_value, | |||
dsp32_t | final_value, | |||
int | step_index | |||
) |
32-bit fixed point version of the dirac comb signal generation.
vect1 | A pointer on a 32-bit vector which is the output buffer of this function. | |
size | The number of elements of the output vector. | |
intial_value | The initial value of the signal. | |
final_value | The final value of the signal. | |
step_index | The index in the buffer, where the step appears. |
Definition at line 69 of file gen_step.c.
00070 { 00071 int i; 00072 00073 for(i = 0; i < step_index; i++) 00074 vect1[i] = intial_value; 00075 for(; i < size; i++) 00076 vect1[i] = final_value; 00077 }