[Audacity-devel] Looking for definitions of math functions & waveforms
i've been unsuccessfully googling for definitions of math functions,
especially if they are defined in Nyquist or XLISP. For example, tangent
of an angle is defined as sine of the angle divided by the cosine of that
I'd also like to find out what the mathematical definitions are for
waveforms other than sinusoidal, such as cycloid or a perfect half circle
above the zero line (these are two different waveforms).
What net resource(s) are there with such information?
Where n is the sample number, F the frequency in Hertz, r the sample
rate in Hertz and the MOD function returns the remainder after dividing
the right hand side by the left hand side. One draw back of producing
waveforms directly is that they are "perfect" with infinite harmonics.
You have to be careful not to exceed the Nyquist limit. You can also
produce an n-harmonic sawtooth approximation by adding the first n
harmonics 1, 2, 3, ... n with inverse amplitudes. That is harmonic q has
A triangle wave may be obtained from a sawtooth as follows:
First take the absolute value of the sawtooth. This will get you the
proper shape but it is positive only and probably the wrong amplitude.
Assuming your original sawtooth has an amplitude of 1 you normalize the
triangle by first subtracting 0.5 and then multiplying by two.
You may also generate a triangle wave by simply counting. For this to
work you need a language which doesn't automatically detect and "fix"
To produce a triangle additively use only odd numbered harmonics. The
amplitude of each harmonic is the reciprocal of the harmonic number
squared. That is the amplitude of the third harmonic is 1/9, the 5th
harmonic has amplitude 1/25 etc.
Pulse waves are typically generated by using a comparator and either a
sine or triangle. Harmonically a pulse with duty factor n% has every
100/n-th harmonic missing. For example a square wave (50%) has only odd
harmonics. A 25% pulse wave is missing every 4th harmonic etc. The
harmonic amplitude relationship is 1/n. Very narrow pulse trains contain
all harmonics with equal amplitudes as in the buzz function.
As for the cycloid, isn't it the absolute value of a sine wave?
The first (positive) cycle of a unit circle is
y = sqrt( 1-x^2) where absolute value of x is less then 1. More work
would be needed to come up with the remaining cycles. I suspect that the
circle wave would be aurally very close to the cycloid.