Difference between revisions of "Audio functions"

From DarkWiki
Jump to: navigation, search
(Introduction)
(Sine to Saw (additive))
Line 18: Line 18:
 
===Sine to Saw (additive)===
 
===Sine to Saw (additive)===
  
Bend a SINE wave into a SAW wave.
+
Bend a SINE wave into a SAW wave. A delta (d) dictates how much SINE and SAW wave to add together.
 
 
t = time (positive)
 
d = Proportion of each wave (0-1, where 0 is all SAW and 1 is all SINE).
 
  
 
<pre>
 
<pre>
 
(1-d)*((t/pi) % 2-1) + (d)*(sin(t))
 
(1-d)*((t/pi) % 2-1) + (d)*(sin(t))
 
</pre>
 
</pre>

Revision as of 15:50, 23 December 2016

Introduction

This page lists some simple function generators that produce waves (suitable for digital audio).

  • t Time, a positive number
  • d delta, a real number in the range of 0 to 1 (inclusive)

Elementary function generators

Saw

((t/pi) % 2-1)

Additive function generators

Sine to Saw (additive)

Bend a SINE wave into a SAW wave. A delta (d) dictates how much SINE and SAW wave to add together.

(1-d)*((t/pi) % 2-1) + (d)*(sin(t))