01_RUN_feature_extraction.sh
3.05 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
####################################################################
# Featrure extraction for speaker verification system based on ALIZE 3.0
#
# This script is distributed in the hope that it will useful but WITHOUT ANY WARRANTY.
#
# This tutorial is designed to help getting an hand on the LIA_RAL toolkit by introducting
# the main executables in context.
#
# Executables used in this script are NOT part of the ALIZE toolkit.
# The author of this tutorial recommand the use of these tools as he is familiar with.
# However, acoustic feature extraction is not limited to Spro and HTK and
# other tools can be used for this purpose.
#
# by Anthony Larcher
# alarcher - at- i2r.a-star.edu.sg
#
# 07/06/2013
####################################################################
# This script extract acoustic features from the SPHERE files available in the ./spkDiarization/data/sph/ directory and generate feature files in ./spkDiarization/data/prm/
# Before running this script you should select a configuration by setting the two following parameters.
# FEATURE_TYPE design the program used to extract the acoustic features: Spro or HTK
#
# In case Spro is selected and that sfbcep is not compiled linked to the SPHERE library, SPHERE files need to be converted into
# raw PCM files by using the tools provided by the NIST and available at:
#
# http://www.speech.cs.cmu.edu/comp.speech/Section1/AudioSoftware/nist.html
#
# In this case, set the parameter INPUT_FORMAT to PCM
#
FEATURE_TYPE="SPro" # can be SPro or HTK
INPUT_FORMAT="SPH" # can be SPH or PCM
# If SPro has not been linked to the SPHERE library, convert first the SPHERE files into raw PCM files without header
if [ $INPUT_FORMAT = "PCM" ]; then
for i in `cat spkDiarization/data/data.lst`; do
CMD_DECODE="spkDiarization/bin/w_decode -o pcm spkDiarization/data/sph/$i.sph spkDiarization/data/pcm/$i.sph"
echo $CMD_DECODE
$CMD_DECODE
CMD_CONVERT="spkDiarization/bin/h_strip spkDiarization/data/pcm/$i.sph spkDiarization/data/pcm/$i.pcm"
echo $CMD_CONVERT
$CMD_CONVERT
done
# Remove the temporary SPHERE files
echo "Remove temporary SPHERE files"
rm spkDiarization/data/pcm/*.sph
# Extract MFCC features with SPro
for i in `cat spkDiarization/data/data.lst`;do
COMMAND_LINE="spkDiarization/bin/sfbcep -m -k 0.97 -p19 -n 24 -r 22 -e -D -A -F PCM16 spkDiarization/data/pcm/$i.pcm spkDiarization/data/prm/$i.tmp.prm"
echo $COMMAND_LINE
$COMMAND_LINE
done
fi
if [ $INPUT_FORMAT = "SPH" ]; then
if [ $FEATURE_TYPE = "SPro" ]; then
# Extract a list of files
for i in `cat spkDiarization/data/data.lst`;do
COMMAND_LINE="spkDiarization/bin/sfbcep -m -k 0.97 -p19 -n 24 -r 22 -e -D -A -F SPHERE spkDiarization/data/sph/$i.sph spkDiarization/data/prm/$i.tmp.prm"
echo $COMMAND_LINE
$COMMAND_LINE
done
else # Extract features using HTK
# Extract a list of files
COMMAND_LINE="spkDiarization/bin/HCopy -C spkDiarization/cfg/hcopy_sph.cfg -T 1 -S spkDiarization/data/data_htk.scp"
echo $COMMAND_LINE
$COMMAND_LINE
fi
fi