File: fmfb.alg

package info (click to toggle)
audacity 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 44,240 kB
  • sloc: cpp: 182,841; ansic: 120,375; sh: 26,421; lisp: 7,495; makefile: 1,606; python: 240; xml: 104; perl: 31
file content (26 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(FMFB-ALG
  (NAME "fmfb")
  (ARGUMENTS ("time_type" "t0")("double" "hz") ("rate_type" "sr")("double" "index") ("time_type" "d")) 
  (TERMINATE (AFTER "d"))
  (STATE ("double" "yy" "0.0")
         ("double" "sin_y" "0.0")
         ("double" "xx" "0.0")
         ("double" "x_incr" 
                   "hz * SINE_TABLE_LEN / sr")
	 ("double" "index" "index * SINE_TABLE_LEN / PI2"))
  (INNER-LOOP "xx += x_incr;
               if (xx > SINE_TABLE_LEN) xx -= SINE_TABLE_LEN;
               /* xx incremented and index scaled to table index, and
                  sin_y is a signal (-1 to +1) */
               yy = xx + index * sin_y;
               /* so yy is a table index */
               while (yy > SINE_TABLE_LEN) yy -= SINE_TABLE_LEN;
               while (yy < 0) yy += SINE_TABLE_LEN;
               sin_y = sine_table[(int) yy]; /* truncation gets valid index */
               /* sin_y is now a signal not ready for table lookup */
               output = sin_y;")
  (CONSTANT "x_incr")
  (SAMPLE-RATE "sr")
  (SUPPORT-HEADER "#include \"sine.h\" /* sine_table and SINE_TABLE_LEN */
")
)