-
Notifications
You must be signed in to change notification settings - Fork 1
/
examples.py
44 lines (34 loc) · 1.67 KB
/
examples.py
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
# -*- coding: utf-8 -*-
"""
@author: J. C. Vasquez-Correa
Pattern recognition Lab, University of Erlangen-Nuremberg
Faculty of Engineering, University of Antioquia,
"""
from AEspeech import AEspeech
import os
if __name__=="__main__":
PATH=os.path.dirname(os.path.abspath(__file__))
wav_file=PATH+"/audios/pataka.wav"
aespeech=AEspeech("CAE", 1024) # load the pretrained CAE with 1024 units
mat_spec=aespeech.compute_spectrograms(wav_file) # compute the decoded spectrograms from the autoencoder
print(mat_spec.size())
# aespeech.show_spectrograms(mat_spec)
bottle=aespeech.compute_bottleneck_features(wav_file) # compute the bottleneck feaatures from a wav file
print(bottle.shape)
error=aespeech.compute_rec_error_features(wav_file) # compute the reconstruction error features from a wav file
print(error.shape)
wav_directory=PATH+"/audios/"
df=aespeech.compute_dynamic_features(wav_directory) # compute the bottleneck and error-based features from a directory with wav files inside
#(dynamic: one feture vector for each 500 ms frame)
print(df)
print(df["bottleneck"].shape)
print(df["error"].shape)
print(df["wav_file"].shape)
print(df["frame"].shape)
df1, df2=aespeech.compute_global_features(wav_directory) # compute the bottleneck and error-based features from a directory with wav files inside
#(static: one feture vector per utterance)
print(df1)
print(df2)
df1.to_csv(PATH+"/bottle_example.csv")
df2.to_csv(PATH+"/error_example.csv")