-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathp.py
More file actions
32 lines (24 loc) · 767 Bytes
/
p.py
File metadata and controls
32 lines (24 loc) · 767 Bytes
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
from __future__ import division
import wave
from numpy import abs
##rate, signal = scipy.io.wavfile.read('data/gen/bad_taste.wav')
DEFAULT_FILENAME = 'data/gen/bad_taste.wav'
class preprocess(object):
def __init__(self, filename=DEFAULT_FILENAME):
assert isinstance(filename, basestring), 'wrong filename type {}'.format(
type(filename))
self.filename = filename
wav_file = scipy.io.wavfile.read(filename)
print(dir)
def normalize(self, verbose=False):
#temp_ = np.abs(self.signal)
temp_ = self.signal
#max_ = max(temp_)
print(max_)
#self.signal_ = self.signal/max_
def main():
p = preprocess(DEFAULT_FILENAME)
print(p.rate)
p.normalize()
if __name__ == '__main__':
main()