[chuck-users] phase modulation and hard sync?

mario buoninfante mario.buoninfante at gmail.com
Mon Jun 5 02:13:16 EDT 2017

Hi Alexandre,

mea culpa, you were right about the modulation index using Phasor! :D

here we are the 2 implementation, one with Phasor and SinOsc sync(1) (in 
the previous mail I said sync(2) but I meant sync(1) ), and one without 
Phasor but just with 2 SinOsc:

Phasor phasor => Gain g => SinOsc carrier => dac;
SinOsc mod => g;

modInd(5,200); //change parameters here and listen the result

while( true ){

     second => now;

fun void modInd( int i, int fm ){ //arguments: modulation index, 
modulation frequency
     float am;

     i/6.283185307 => am;



// m = mod osc;  c = carrier osc;
SinOsc m => Gain g => SinOsc c => dac;
Step cm => g; //cm = carrier freq in Hz

while( true ){
     modInd(5, 200); //change parameters here and listen the result
     second => now;

fun void modInd( float i, float f ){ //arg: modInd, freq mod
     float am;

     i*f => am; //(modInd = Am/Fm), then (Am = modInd*Fm)

On 04/06/17 22:44, Alexandre Torres Porres wrote:
> 2017-06-04 13:59 GMT-03:00 mario.buoninfante 
> <mario.buoninfante at gmail.com <mailto:mario.buoninfante at gmail.com>>:
>     Now 2pi is needed only if you deal with a ramp, with a phasor.
>     Cause Phasor*2pi gives you a sine. If you already have a sine
>     there is no need to use 2pi.
> Hi, let me try to be clearer. Phasor * 2pi going through a sine 
> function gives you a sine wave. SinOsc can also be drive by a Phasor. 
> Such as this.
> Phasorp => SinOscosc => dac;
> 440=>p.freq;
> 1=>osc.sync;
> 4::second=> now;
> In this case, you get a sine wave and you don't need to multiply the 
> phasor by 2pi, because the input is normalized, from 0-1
> What I was trying to say is that if you have a modulating index in 
> phase modulation, and you want to replicate it in frequency 
> modulation, you alsop need to multiply it by 2pi.
> I'm not challenging the math or equations, just adding an 
> implementation detail in Chuck code. I know I wasn't clear about it, 
> sorry. Hope it's clear now.
> But my main point was something else. It is true that if you multiply 
> the index value by the modulation frequency value, such as in your 
> code, you sort of get a similar behaviour than you'd get with phase 
> modulation. But there's another detail missing if you're to really 
> convert it.
> One thing about this conversion is that the waveform/function of the 
> modulation signal needs to also be adjusted. In terms of sine waves, 
> if you have the phase signal being modulated by a sine wave, you need 
> to modulate the frequency with a cosine wave.
> With other waveforms it gets more complicated. By the way, the rule of 
> thumb (multiply the index by the frequency) also changes, that is 
> important to note as well.
> My main point is just that it's just best to implement via phase 
> modulation, if that's the behaviour you want.
> cheers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20170605/6e904559/attachment.html>

More information about the chuck-users mailing list