-
Notifications
You must be signed in to change notification settings - Fork 3
/
getAudioNoiseprint.inc
44 lines (40 loc) · 1.4 KB
/
getAudioNoiseprint.inc
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
; Copyright 2014 Oeyvind Brandtsegg and Axel Tidemann
;
; This file is part of [self.]
;
; [self.] is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License version 3
; as published by the Free Software Foundation.
;
; [self.] is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with [self.]. If not, see <http://www.gnu.org/licenses/>.
; get noise print
Smess1 = "Measuring spectral profile of background noise, KEEP QUIET!"
puts, Smess1, 1
ain chnget "in1"
iwtype = 1
fsin pvsanal ain, gifftsize, gifftsize/4, gifftsize, iwtype
kflag pvsftw fsin,gifnaNoiseIn
; copy pvs data from table to array
kArrA[] init giFftTabSize
kArrAprev[] init giFftTabSize
kArrAfilt[] init giFftTabSize
if (kflag > 0) then
kArrAprev[] = kArrA
copyf2array kArrA, gifnaNoiseIn
kindx = 0
kfiltered = 0
process:
kaverage = (kArrA[kindx]+kArrAprev[kindx])*0.5
kArrAfilt[kindx] = (kaverage*0.1)+(kArrAfilt[kindx]*0.9)
kindx = kindx + 1
if kindx < giFftTabSize-2 then
kgoto process
endif
copya2ftab kArrAfilt, gifnaNoise
endif