| Hi all,
Sorry in advance if this is not the right place to ask this kind of
question.
I'm trying to understand the following instrument and I'm puzzled by the
"asaw = asawdc - .5" line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
instr 1; band limited sawtooth wave
; coded by Josep M Comajuncosas / jan98
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
iamp = 10000; intended max. amplitude
kenv linen 1, .2,p3,.2; volume envelope
kfreq = cpspch(p4)
ibound = sr/4; set it to sr/2 for true BL square wave
apulse buzz 1, kfreq, ibound/kfreq, 1
asawdc integ apulse
asaw = asawdc - .5
out asawdc*iamp*kenv
endin
Indeed, if the fundamental period is 2pi and N the number of required
harmonics (ibound/kfreq in instr 1), buzz opcode provides a signal (assumely
continuous)
b(t) = (sum { cos(kt), k = 1.. N}) / N
so, by integration,
saw(t) = integ [b(u)du, u = 0..t]
saw(t) = (sum { sin(kt) / k, k = 1.. N}) / N
which is precisely the reconstruction of the signal whose Fourier
coefficients are (N times smaller than) (1,1/2,1/3,...,1/N) that is just the
asaw signal we're trying to build and I don't understand where the 1/2
offset comes from.
Is it a numerical (discrete signal) consequence ? If so, why this 1/2
coefficient doesn't depend of N (setting ibound to sr/2 for example still
requires the offset set to 1/2 to get the asaw expected).
Help me with my maths please!
--
View this message in context: http://csound.1045644.n5.nabble.com/unexpected-integ-offset-tp4827197p4827197.html
Sent from the Csound - General mailing list archive at Nabble.com.
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|