[chuck-users] phase modulation and hard sync?

Alexandre Torres Porres porres at gmail.com
Sun Jun 4 12:05:02 EDT 2017


so, this is my attempt to make it simpler, having a phasor and a sine wave
summed together, then fed into the phase input of an oscillator.

but since I never used chuck, I always screw it up, this doesn't work, but
it should be easy to fix

Phasor carrier;

SinOsc mod;

Gain sum;

1 => sum.op; // Gain's op number 1 is sum

400 => carrier.freq;

201 => mod.freq;

1 => float ind => mod.gain; // modulation index

mod => sum;

carrier => sum => SinOsc => dac;

1 => osc.sync;

4::second => now;

2017-06-04 4:16 GMT-03:00 Jean Menezes da Rocha <jean at menezesdarocha.info>:

> Alexandre,
>
> I have translated a PD patch (see the last graph on this page
> <http://pd-tutorial.com/english/ch03s06.html>) and it is modulating AND
> responding to frequency changes. See if this does the trick for you
> (doesn't sound exactly like your SC code, but I think some fiddling with
> modulation index can be useful):
>
> Step imp; // now I am using an impulse to generate sound after calculating
> stuff from phasor/sinosc
> Phasor carrier; // Miller said to do so ;)
> SinOsc modul; // a phasor as carrier, a sinosc as modulator
> Gain g; // this object serves only to sum the signals
> 1 => g.op; // op number 1 is sum.
>
> 400 => carrier.freq;
> 201 => modul.freq;
> 1 => float ind => modul.gain; // so, modul. signal * index + carrier
> signal.
>
> imp => dac; // impulse is actually generating sound
> carrier => g => blackhole; // both generators go through a Gain object an
> then to the blackhole
> modul => g; // so that they only lend data to the Impulse generator
>
> while ( true ) { // this loop includes a timed function only to show that
> this stuff responds to changes into carrier's frequency
>     now + 1::second => time later;
>     while (now < later) {
>         Math.cos(g.last()) => imp.next; // i am running this through a
> Cosine function since Phasor is a ramp (let's smooth that)
>         1::samp => now;
>     }
>     if ( maybe ) 20 + carrier.freq() => carrier.freq;
>     else -30 + carrier.freq() => carrier.freq;
> }
>
> Please notice that Miller Puckette's approach includes using the phasor as
> *carrier* and sinosc as *modulator*, so that we can separate phase
> treatment and wave generation (phasor + cos). I am using an Impulse
> generator in order to be allowed to pass the resulting signal through the
> cosine function before sending it to DAC.
>
> Keep trying...
>
> Em dom, 4 de jun de 2017 às 03:34, Alexandre Torres Porres <
> porres at gmail.com> escreveu:
>
>> 2017-06-04 2:35 GMT-03:00 Alexandre Torres Porres <porres at gmail.com>:
>>>
>>>
>>> It's not easy to explain, but you found the magic number/formula that
>>> makes Frequency modulation sound like Phase Modulation.
>>>
>>
>> Actually, I shouldn't have said this, I don't wanna give you the idea it
>> comes down to this, but there are just too many details I didn't want get
>> into, sorry. What I can say is that you got pretty close, not 100% there
>> yet, and that is not as simple as just doing this every time, it gets more
>> complicated.
>>
>> Sorry again for not getting into the math and everything. What I'd like
>> to add is that people use phase modulation instead of trying to replicate
>> it via frequency modulation cause it's just more convenient to do directly
>> via phase modulation if you want it to behave like that.
>>
>> cheers
>>
>>
>> --
> Jean Menezes da Rocha
> Compositor
> Professor
> Doutorando em Música pela Universidade Federal da Bahia
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20170604/5823df39/attachment.html>


More information about the chuck-users mailing list