File: fmfbv.alg

package info (click to toggle)
audacity 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 129,312 kB
  • sloc: ansic: 373,350; cpp: 276,880; sh: 56,060; python: 18,922; makefile: 10,309; lisp: 8,365; xml: 1,888; perl: 1,798; java: 1,551; asm: 545; pascal: 395; sed: 58; awk: 35
file content (30 lines) | stat: -rw-r--r-- 1,159 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
27
28
29
30
(FMFBV-ALG
  (NAME "fmfbv") ; FM feedback unit generator
  (ARGUMENTS ("time_type" "t0") ("double" "hz") ("rate_type" "sr")
             ("sound_type" "index")) 
  (START (MIN index))
  (TERMINATE (MIN index))
  (LOGICAL-STOP (MIN index))
  (STEP-FUNCTION index)
  (STATE ("double" "yy" "0.0")
         ("double" "sin_y" "0.0")
         ("double" "phase" "0.0")
	 ("double" "ph_incr" "hz * SINE_TABLE_LEN / sr;
    index->scale *= SINE_TABLE_LEN / PI2
"))
  (INNER-LOOP "phase += ph_incr;
            if (phase > SINE_TABLE_LEN) phase -= SINE_TABLE_LEN;
            /* PHASE is incremented and INDEX scaled to table INDEX, and
               sin_y is a signal (-1 to +1) */
            yy = phase + 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 ready for table lookup */
            output =  sin_y")
  (CONSTANT "ph_incr")
  (SAMPLE-RATE "sr")
  (SUPPORT-HEADER "#include \"sine.h\" /* sine_table and SINE_TABLE_LEN */
")
)