-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_f0.py
More file actions
41 lines (19 loc) · 749 Bytes
/
Copy pathreplace_f0.py
File metadata and controls
41 lines (19 loc) · 749 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
#!/usr/bin/python
import numpy as np
import os
telugu_f0_frames = np.loadtxt("tamil_f0")
english_f0_frames = np.loadtxt("english_f0")
mu_telugu = np.mean(np.sort(telugu_f0_frames))
mu_english = np.mean(np.sort(english_f0_frames))
std_telugu = np.std(telugu_f0_frames)
std_english = np.std(english_f0_frames)
f0_files = sorted(os.listdir('f0_ascii'))
for file in f0_files:
if 'arctic' in file:
print file
orig_f0 = np.loadtxt('f0_ascii/' + file)
mapped_f0 = ( std_telugu * 1.0 / std_english ) * ( orig_f0 - mu_english) + mu_telugu
mapped_f0[mapped_f0 < 0] = 0.0
np.savetxt('f0_replaced_ascii/' + file, mapped_f0, fmt='%.3f')
print mu_telugu, std_telugu
print mu_english, std_english