Phase modulationSource code and result: Simple phase modulationIn the phase modulation, the carrier phase angle is modified
accordingly to the formula Realization with CsoundWe take the simple frequency modulation implementation where we replace the frequency modulation algorithm by the one represented in the following diagram: ![]() sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 instr 2 idur = p3 iamp = p4 icarcps = cpspch(p5) iratio = p6 indxmul = p7 / 6.2831853 ;p7/(2*pi) imodcps = icarcps / iratio kndx adsr 0.4, 0.5, 0.1, 0.05 ;in Phase Modulation, modulation index is independant from modulator frequency kmod = kndx * indxmul amod oscili 1, imodcps, 1 aphi phasor icarcps aphi = frac(aphi + kmod*amod) acar tablei aphi, 1, 1, 0, 1 kenv adsr 0.1, 0.2, 0.8, 0.2 out iamp * kenv * acar endin To realize the aphi phasor icarcps Then we add the modulation effect to the phase angle: aphi = frac(aphi + kmod*amod) We use a normalized table length (i.e. equal to 1.0). So we only keep the fractional part of the precedent sum. The score is the same one as in the last example except for the number of the called instrument (2 instead of 1). Comparing with simple frequency modulationThe two intruments are put together in this csd file. The score plays each note twice, once with instrument #1 and once with instrument #2. We can hear that the audio result is identical for both kind of modulation. |