[Audacity-devel] Looking for definitions of math functions & waveforms

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Audacity-devel] Looking for definitions of math functions & waveforms

David R. Sky
Hi,

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
same angle.

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?

thanks

David


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looking for definitions of math functions & waveforms

Steven Jones-2
Hi David

I have a few math related links. They range from the absurdly simple to
the ridiculously complex.

http://mathforum.org/
http://mathworld.wolfram.com/
http://www.math2.org/

You might also find the book "mathematics and music" by Dave Benson
interesting. Its available in pdf form at
http://www.maths.abdn.ac.uk/~bensondj/html/maths-music.html


Here are a few waveform equations:


The sawtooth equation is:

SAWn = 2*(nF/r MOD 1.0) -1

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
amplitude 1/q.


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"
integer overflow.


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.

Hope that helps
Steve




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-nyquist mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist
Reply | Threaded
Open this post in threaded view
|

Re: Looking for definitions of math functions & waveforms

David R. Sky
Hi Steve,

Thanks very much for the links and information, I've been curious how to
generate waveforms other than those produced in Nyquist 'naturally'
(osc-saw, osc-tri, etc.)

On Sat, 17 Dec 2005, Steven Jones wrote:

>
>> As for the cycloid, isn't it the absolute value of a sine wave?

David: I don't know,  I understand it's conceptually made by
taking one point on the circunference of a circle and plotting its path as
the circle rolls along a flat surface.

> Steve: The first (positive) cycle of a unit circle is
>
> y = sqrt( 1-x^2) where absolute value of x is less then 1.

David: Great, thanks for all this Steve!

David


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Audacity-nyquist mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist