PageSourceSearch

https://tgf-thermal.herokuapp.com/utouchme/scripts/js/webaudio.js

js tgf-thermal.herokuapp.com collected 2026-10-03 14:56:11 UTC 2,494 bytes, 103 lines download raw bytes

1
2var Filter = function(){
3  this.freq = 7000,
4  this.q = 30
5  var self = this
6  var initX
7  var initY
8
9
10
11  this.init = function(){
12
13    var adapter = dancer.audioAdapter
14    var context = dancer.audioAdapter.context
15    var source =  dancer.audioAdapter.source
16
17    var filter = context.createBiquadFilter();
18    filter.type = 0; // LOWPASS
19    filter.frequency.value = 5000;
20
21    // adapter.gain.disconnect(0)
22    adapter.source.disconnect(0)
23    adapter.source.connect(filter);
24
25    // adapter.gain.connect(filter);
26    filter.connect(adapter.gain);
27    filter.connect(adapter.proc);
28
29    this.filter = filter;
30    this.source = source
31    this.context = context
32    this.adapter = adapter
33
34    document.addEventListener( 'mousedown', this.onDocumentMouseDown, false );
35    document.addEventListener( 'mouseup', this.onDocumentMouseUp, false );
36  
37  }
38
39
40
41  this.changeFrequency = function(value) {
42
43    var context = this.context
44    var minValue = 40;
45    var maxValue = context.sampleRate / 2;
46    
47    // Logarithm (base 2) to compute how many octaves fall in the range.
48    var numberOfOctaves = Math.log(maxValue / minValue) / Math.LN2;
49    
50    // Compute a multiplier from 0 to 1 based on an exponential scale.
51    var multiplier = Math.pow(2, numberOfOctaves * (value - 1.0));
52    
53    // Get back to the frequency value between min and max.
54    this.filter.frequency.value = maxValue * multiplier;
55  };
56
57
58
59  this.changeQuality = function(value) {
60    this.filter.Q.value = value * this.q ;
61  };
62
63
64
65
66  this.onDocumentMouseDown = function(e){
67    initX = e.clientX
68    initY = e.clientY
69    document.addEventListener( 'mousemove', self.onDocumentMouseMove, false );
70  }
71  this.onDocumentMouseMove = function(e){
72
73    var dX = 1-(initX - e.clientX)/windowHalfX
74    var dY = .5+(initY - e.clientY)/windowHalfY
75
76    self.changeFrequency(dX)    
77    self.changeQuality(dY)
78  }
79  this.onDocumentMouseUp =function(){
80    document.removeEventListener('mousemove',self.onDocumentMouseMove)
81    self.changeFrequency(1)    
82    self.changeQuality(.5)
83  }
84}
85
86
87
88
89
90
91// FilterSample.toggleFilter = function(element) {
92//   this.source.disconnect(0);
93//   this.filter.disconnect(0);
94//   // Check if we want to enable the filter.
95//   if (element.checked) {
96//     // Connect through the filter.
97//     this.source.connect(this.filter);
98//     this.filter.connect(context.destination);
99//   } else {
100//     // Otherwise, connect directly.
101//     this.source.connect(context.destination);
102//   }
103// };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.