Previous topic

Oscillators and Generator Modules

Next topic

Control Flow with Select()

This Page

Frequency Modulation

signal ModulationSignal {
        default:        0.0
        rate:           AudioRate
        reset:          MasterReset
        meta:           'Modulation Signal'
}

constant CarrierFrequency {
        value:  440
        meta:   'Carrier Frequency'
}

constant ModulatorFrequency {
        value:  10
        meta:   'Modulation Frequency'
}

constant ModulatorDepth {
        value:  40
        meta:   'Modulation Depth'
}

Oscillator (
        type:           'Sine'
        amplitude:      ModulatorDepth
        frequency:      ModulatorFrequency
        phase:          0.0
        reset:          off
)
>> ModulationSignal;

Oscillator (
        type:           'Sine'
        amplitude:      1.0
        frequency:      CarrierFrequency + ModulationSignal
        phase:          0.0
        reset:          off
)
>> AudioOut[1];

The same code in parallel form.

signal ModulationSignal {
        default:        0.0
        rate:           AudioRate
        reset:          MasterReset
        meta:           'Modulation Signal'
}

constant CarrierFrequency {
        value:  440
        meta:   'Carrier Frequency'
}

constant ModulatorFrequency {
        value:  10
        meta:   'Modulation Frequency'
}

constant ModulatorDepth {
        value:  40
        meta:   'Modulation Depth'
}

Oscillator (
        type:           'Sine'
        amplitude:      [ ModulatorDepth, 1.0 ]
        frequency:      [ ModulatorFrequency, CarrierFrequency + ModulationSignal ]
        phase:          0.0
        reset:          off
)
>> [ ModulationSignal, AudioOut[1] ];

FM with modulation frequency and index controlled by an anlog inputs

signal ModulationSignal {
        default:        0.0
        rate:           AudioRate
        reset:          MasterReset
        meta:           'Modulation Signal'
}

signal ModulationIndex {
        default:        0.0
        rate:           ControlRate
        reset:          MasterReset
        meta:           'Modulation Index'
}

signal ModulatorFrequency {
        default:        0.0
        rate:           ControlRate
        reset:          MasterReset
        meta:           'Modulator Frequency'
}

signal ModulatorDepth {
        default:        0.0
        rate:           ControlRate
        reset:          MasterReset
        meta:           'Modulator Depth'
}

constant CarrierFrequency {
        value:  440
        meta:   'Carrier Frequency'
}

ControlIn[1:2]
>> Map (
        mode:           'Linear'
        minimum:        [ 0.0, 100.0 ]
        maximum:        [ 12.0, 1000.0 ]
        bypass:         off
)
>> [ ModulationIndex, ModulatorFrequency ]
>> Multiply ()
>> Smooth (
        factor: 0.02
)
>> ModulatorDepth;

Oscillator (
        type:           'Sine'
        amplitude:      ModulatorDepth
        frequency:      ModulatorFrequency
        phase:          0.0
        reset:          off
)
>> ModulationSignal;

Oscillator (
        type:           'Sine'
        amplitude:      1.0
        frequency:      CarrierFrequency + ModulationSignal
        phase:          0.0
        reset:          off
)
>> AudioIn[1];