Cabbage Logo
Back to Cabbage Site

FM synth without foscil

Hello,
This might be a trivial question but how do I create a FM synth which keeps the timbre of the sound all over the notes without foscil ?

am trying to understand how vst synth works and what is meant when there is FM on board : does it mean that the main oscil is a carrier or is the main oscil used as a modulator of another signal (i.e a sine )?

Trying to experiment this, I wish to modulate the signal from a vco2 opcode which accepts only k values as input.
It seems that factor like xmod and xcar as per foscil should be set but I do not manage to getth ings right. I tried the following:

kMod oscil kamp, p5 *factor
aOut voc2 kAmp, p5 +kMod

bot of course there holes and strange sound occuring depending on the note value.
Thank you for help

Your approach is correct and will work if the modulator output is a-rate. The problem, as you mention, is that vco2 accepts only k-rate for frequency. This causes aliasing so that the FM sidebands will be in the wrong places and inconsistent for different p5s, therefore you get an inconsistent timbre from note to note. One way around this is to set ksmps=1 but in general this is best avoided and an alternative is to just create a UDO version of vco2 that accepts an a-rate value for frequency. Below is an example.
The problem with performing FM upon rich waveforms such as a sawtooth is that the process is going to create additional higher partials and as a sawtooth’s partials might already touch the Nyquist frequency, this can produce aliasing again. As a compromise, the example below uses a triangle wave instead which is tamer in its upper spectrum.

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0

opcode vco2sr,a,aaii
 aAmp,aCPS,iMode,iPW	xin
 setksmps	1
 aCar		vco2		k(aAmp),k(aCPS),iMode,iPW
 	xout	aCar
endop

instr		1
 iCPS		=		cpsmidinn(p4)
 kMod		=		0.5
 kCar		=		1
 kNdx		linseg	0, p3/2, 8, p3/2, 0
 aAEnv	linseg	0, p3/2, 1, p3/2, 0
 aMod 	poscil	kNdx*iCPS, iCPS*kMod
 aCar		vco2sr	aAEnv*0.2,iCPS*kCar+aMod,4,0.5
 		outs		aCar, aCar
endin

</CsInstruments>

<CsScore>
i 1  0  2 48
i 1  ^1 2 50
i 1  ^1 2 52
i 1  ^1 2 53
i 1  ^1 2 55
i 1  ^1 2 57
i 1  ^1 2 59
i 1  ^1 2 60
</CsScore>

</CsoundSynthesizer>

Thank you a lot … now I understand better why I got all these clicks !
I will post a cabbage version of your tutorial this post later. This might help others.

In your answer you use a poscil as the modulator and the vco2 as the carrier. Should I understand there that usually in VST synth or synth like Jupiter or Juno , the main oscillator is used as yhe carrier and the FM is done by a “secondary” oscillator ?