File: reverb.html

package info (click to toggle)
csound 1%3A6.18.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 63,220 kB
  • sloc: ansic: 192,643; cpp: 14,149; javascript: 9,654; objc: 9,181; python: 3,376; java: 3,337; sh: 1,840; yacc: 1,255; xml: 985; perl: 635; lisp: 411; tcl: 341; lex: 217; makefile: 128
file content (116 lines) | stat: -rw-r--r-- 2,586 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!doctype html>
<html>

<head>
  <title>WebAudio Csound</title>
  <style type="text/css">
  html, body {
    font-family: Monospace;
    color: #bf94f7;
    background-color: #000055;
  }
  #console {
      font-family:  Monospace;
      color: #b5b6ff;
      background-color: #000000;
      font-size: 16px;
      width: 805px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-style: solid;
      padding: 20px 0px;
    }


   H1 {
     font-size: 36px;
   }

   #playButton {
      margin: auto;
      font-family: Monospace;
      width: 805px;
      padding: 10px 0px;
      font-size: 24px;
      background-color: #b5b6ff;
   }
  </style>
  <script src='js/CsoundObj.js'></script>
  <script>
    let count = 0;
    let csoundObj;
    const TEST_CSD =
      `
  <CsoundSynthesizer>
  <CsOptions>
  </CsOptions>
  <CsInstruments>
  sr = 44100
  ksmps = 32
  nchnls = 2
  nchnls_i = 1
  0dbfs = 1

  instr 1
  ain inch 1
  al, ar reverbsc ain,ain, 0.6, 5000
    out  al, ar
  endin
  </CsInstruments>
  <CsScore>
  i1 0 36000
  </CsScore>
  </CsoundSynthesizer>
  `;
    CsoundObj.initialize().then(() => {
      csoundObj = new CsoundObj();
      csoundObj.enableAudioInput((res) => {
        if (res) {
          csoundObj.setMessageCallback((msg) => {
            var element = document.getElementById('console');
            element.value += "\n" + msg;
            element.scrollTop = 99999; // focus on bottom
            count += 1;
            if (count == 1000) {
              element.value = ' ';
              count = 0;
            }
          });
          document.getElementById('playButton').addEventListener('click',
            click_this);
          document.getElementById('playButton').disabled = false;
          CsoundObj.CSOUND_AUDIO_CONTEXT.suspend();
          csoundObj.compileCSD(TEST_CSD);
          csoundObj.start();
        } else {
          alert("Unable to start microphone.");
        }
      });
    });

    var playing = false;

    function click_this() {
      if (playing == false) {
        CsoundObj.CSOUND_AUDIO_CONTEXT.resume();
        document.getElementById('playButton').innerText = "off";
        playing = true;
      } else {
        CsoundObj.CSOUND_AUDIO_CONTEXT.suspend();
        document.getElementById('playButton').innerText = "on";
        playing = false;
      }
    }
  </script>
</head>

<body>
  <H1>Reverb</H1>
  <textarea class="console" rows="24" id="console">Csound: loading...</textarea>
  <p>
    <button id="playButton" disabled>on</button>
  </p>
</body>

</html>