license /**
 * Testing Utilities for Browser Audio Feature Extraction.
 */ export class FakeAudioContext { readonly sampleRate = 44100 ; static createInstance ( ) { return new FakeAudioContext ( ) ; } createMediaStreamSource ( ) { return new FakeMediaStreamAudioSourceNode ( ) ; } createAnalyser ( ) { return new FakeAnalyser ( ) ; } close ( ) { } } export class FakeAudioMediaStream { constructor ( ) { } getTracks ( ) { return [ ] ; } } class FakeMediaStreamAudioSourceNode { constructor ( ) { } connect ( node ) { } } class FakeAnalyser { fftSize : number ; smoothingTimeConstant : number ; private x : number ; constructor ( ) { this . x = 0 ; } getFloatFrequencyData ( data ) { const xs = [ ] ; for ( let i = 0 ; i < this . fftSize / 2 ; ++ i ) { xs . push ( this . x ++ ) ; } data . set ( new Float32Array ( xs ) ) ; } getFloatTimeDomainData ( data ) { const xs = [ ] ; for ( let i = 0 ; i < this . fftSize / 2 ; ++ i ) { xs . push ( - ( this . x ++ ) ) ; } data . set ( new Float32Array ( xs ) ) ; } disconnect ( ) { } }