File: fire.dsp

package info (click to toggle)
faust 2.79.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 397,496 kB
  • sloc: cpp: 278,433; ansic: 116,164; javascript: 18,529; vhdl: 14,052; sh: 13,884; java: 5,900; objc: 3,852; python: 3,222; makefile: 2,655; cs: 1,672; lisp: 1,146; ruby: 954; yacc: 586; xml: 471; lex: 247; awk: 110; tcl: 26
file content (46 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download | duplicates (3)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import("stdfaust.lib");

//----------------------------`fire`---------------------------
// fire(is_wet) : produces burning fire sound
//
// #### Usage
//
// ```
// fire(is_wet) : _
// ```
//
// Where:
//
// * `is_wet`: a binary flag/signal adding wet wood
//             popping sound
//
// #### Example
//
// ```
// checkbox("wet") : fire : _
// ```
//
//------------------------------------------------------------

sq(x) = x * x;
stretch(ms) = ba.countdown(ma.SR * ms / 1000): >(0);

crackle(dens, rel) = ((no.noise : fi.lowpass(3, 10000)) * 0.77 * os.osc(50 / dens) * 
                      en.arfe(0.001, release, 0, trigger: >(0)
                      : stretch(sus)))
                      : fi.highpass(3, 1000)
    with {
        trigger = no.sparse_noise(dens): abs;
        sus = 2 + (trigger: ba.latch(trigger) * 8);
        release = rel + (0.3 * (no.noise : abs : ba.latch(trigger)));
    };

fire(is_wet) = (is_wet * wet) + (base <: (_, fi.lowpass(3, 1000), fi.highpass(3, 10000)) :> _)
    with {
        hiss = (no.noise : fi.lowpass(3, 500)) / 5;
        hiss2 = 0.8 * (no.noise : fi.highpass(3, 3000) / 8) * sq(no.lfnoise(1000));
        wet = (3 * crackle(0.1, 0.05)) + (2 * crackle(0.2, 0.3));
        base = hiss + hiss2 + (0.2 * crackle(5, 0.1));
    };

process = checkbox("wet"): fire;