编写opensmile配置文件

编写opensmile配置文件

openSMILE可以生成简单场景的配置文件模板。

1.创建一个myconfig,用来保存配置文件

如:在opensmile-2.3.0\config目录下创建myconfig文件夹

2.输入一下内容,生成配置文件

D:\Software\OpenSMILE\msvcbuild>SMILExtract_Release
-cfgFileTemplate -configDflt cWaveSource,cFramer,cEnergy,cCsvSink 
-l 1 2>D:\Software\OpenSMILE\opensmile-2.3.0\config\myconfig\myconfig1.conf

-cfgFileTemplate:opensmile生成一个配置文件的模板

-configDflt:用于指定一个逗号分隔的组件列表

-l 1:1选项将日志级别设置为1,以禁止配置文件中不应该出现的任何消息。

       (但是仍然会在日志级别1上收到错误消息,例如通知您所指定的组件不存在的消息等)

2>:将其转储到文件mmyconfig1.conf中

如果要在生成的配置文件中添加描述各个选项行的注释,请将选项-cfgFileDescriptions添加到上述命令行。

生成的myconfig1.conf的内容


 ///
 // openSMILE configuration template file generated by SMILExtract binary //
 // you must manually adapt this file and change at least the             //
 // 'reader/writer.dmLevel =' lines.                                      //
 ///

 ;===== component manager configuration (= list of enabled components!) =====

[componentInstances:cComponentManager]
 // this line configures the default data memory:
instance[dataMemory].type = cDataMemory
instance[waveSource].type = cWaveSource
instance[framer].type = cFramer
instance[energy].type = cEnergy
instance[csvSink].type = cCsvSink
 // Here you can control the amount of detail displayed for the data memory
  // level configuration. 0 is no information at all, 5 is maximum detail.
printLevelStats = 1
 // You can set the number of parallel threads (experimental):
nThreads = 1

// ============= component configuration sections begin here ==============


  ;;;; default (template) configuration section for component 'cWaveSource' ;;;;
[waveSource:cWaveSource]
writer.dmLevel = <>
basePeriod = -1
filename = input.wav
properTimestamps = 0
monoMixdown = 1
// segmentList[] = 
start = 0
end = -1
endrel = 0
noHeader = 0
outFieldName = pcm
 

  ;;;; default (template) configuration section for component 'cFramer' ;;;;
[framer:cFramer]
reader.dmLevel = <>
writer.dmLevel = <>
// nameAppend = 
copyInputName = 1
EOIlevel = 0
allowLastFrameIncomplete = 0
frameMode = fixed
// frameListFile = 
// frameList = 
frameSize = 0.025000
frameStep = 0
frameCenterSpecial = left
noPostEOIprocessing = 1
 

  ;;;; default (template) configuration section for component 'cEnergy' ;;;;
[energy:cEnergy]
reader.dmLevel = <>
writer.dmLevel = <>
nameAppend = energy
copyInputName = 1
EOIlevel = 0
processArrayFields = 0
includeSingleElementFields = 0
preserveFieldNames = 1
htkcompatible = 0
rms = 1
energy2 = 0
log = 1
escaleLog = 1
escaleRms = 1
escaleSquare = 1
ebiasLog = 0
ebiasRms = 0
ebiasSquare = 0
 

  ;;;; default (template) configuration section for component 'cCsvSink' ;;;;
[csvSink:cCsvSink]
reader.dmLevel = <>
errorOnNoOutput = 0
filename = smileoutput.csv
delimChar = ;
append = 0
timestamp = 1
frameTime = 1
number = 1
frameIndex = 1
printHeader = 1
flush = 0
// instanceBase = 
// instanceName = 
 

// ################### END OF openSMILE CONFIG FILE ######################

配置文件myconfig1.conf由两个逻辑部分组成。

文件中的 注释以;或者//开头

第一部分包含的是配置文件的组件,例如:waveSource、framer、energy等等。

它包含组件管理器的配置,该配置确定在调用SMILExtract时实例化哪些组件。总是必须有一个cDataMemory组件,然后是其他组件。在[ ]中给出的名称指定组件实例的名称,该名称在一个配置中必须是唯一的。

编写opensmile配置文件_第1张图片
第二部分就是对各组件的配置

[实例名:组件类型]

[waveSource:cWaveSource]

[framer:cFramer]

[energy:cEnergy]

[csvSink:cCsvSink]

编写opensmile配置文件_第2张图片

配置组件连接

这可以通过分配dataReader和dataWriter组件并设置名为数据存储器“levels”实现

通过修改reader.dmLevel和writer.dmLevel。

可以为writer level选择任意名称。因为dataWriters会在数据存储区注册并创建您为writer.dmLevel的level。然后通过reader.dmLevel的读取level来连接组件。

规则:

1.对于一个level,只有一个writer可以存在,即只有一个组件可以写入一个level。

2.一个组件可以从多个level读取,如果您指定多个level名称用“;”隔开,比如reader.dmLevel = energy;loudness

从energy和loudness level中读取数据。数据将以列的形式串联。

示例:

对于我们的示例配置,我们希望cFramer组件从输入PCM中读取由cWaveSource组件提供的流,每10毫秒创建一个25毫秒的帧,把这些帧写入到一个新的level,我们称之为“energy”),因此我们需按照下面改变内容:

   

改为

编写opensmile配置文件_第3张图片

改为:(注意,我们删除了一些多余的frameSize *选项,并将frameStep更改为0.010)

[framer:cFramer]
reader.dmLevel = wave
writer.dmLevel = waveframes
copyInputName = 1
frameMode = fixed
frameSize = 0.025000
frameStep = 0.010000
frameCenterSpecial = left
noPostEOIprocessing = 1

接下来,cEnergy组件将读取音频帧并计算信号对数能量,cCsvSink会把他们写进一个CSV格式的文件。因此我们把相应的行改为:

[energy:cEnergy]
reader.dmLevel = <>
writer.dmLevel = <>
nameAppend = energy
copyInputName = 1
EOIlevel = 0
processArrayFields = 0
includeSingleElementFields = 0
preserveFieldNames = 1
htkcompatible = 0
rms = 1
energy2 = 0
log = 1
escaleLog = 1
escaleRms = 1
escaleSquare = 1
ebiasLog = 0
ebiasRms = 0
ebiasSquare = 0

改为:

编写opensmile配置文件_第4张图片

[csvSink:cCsvSink]
reader.dmLevel = <>
errorOnNoOutput = 0
filename = smileoutput.csv
delimChar = ;
append = 0
timestamp = 1
frameTime = 1
number = 1
frameIndex = 1
printHeader = 1
flush = 0
// instanceBase = 
// instanceName = 

改为:

编写opensmile配置文件_第5张图片

但是目前在这个confg文件中,输入输出的文件名是固定的,输入文件名input.wav,输出文件名myenergy.csv为如下图所示

编写opensmile配置文件_第6张图片      编写opensmile配置文件_第7张图片

如果想在cmd命令行中指定输入,输出文件名,则修改配置为:

输入文件名:filename = \cm[inputfile(I):file name of the input wave file]

编写opensmile配置文件_第8张图片

输出文件名:filename = \cm[outputfile(O):file name of the output CSV file]

编写opensmile配置文件_第9张图片

使用myconfig.conf测试一下:

D:\Software\OpenSMILE\msvcbuild>SMILExtract_Release
-C "D:\Software\OpenSMILE\opensmile-2.3.0\config\myconfig\myconfig1.conf" 
-I "D:\Software\OpenSMILE\input\opensmile.wav" 
-O "D:\Software\OpenSMILE\output\opensmile.csv"

 

输出的opensmile.csv文件内容

frameIndex;frameTime;pcm_LOGenergy
0;0.000000;-1.383729e+001
1;0.010000;-1.344107e+001
2;0.020000;-1.362546e+001
3;0.030000;-1.371792e+001
4;0.040000;-1.256511e+001
5;0.050000;-1.210091e+001
6;0.060000;-1.216670e+001
7;0.070000;-1.241860e+001
8;0.080000;-1.232635e+001
9;0.090000;-1.222799e+001
10;0.100000;-1.289224e+001
11;0.110000;-1.241491e+001
12;0.120000;-1.244319e+001
13;0.130000;-1.286947e+001
14;0.140000;-1.316939e+001
15;0.150000;-1.261712e+001
16;0.160000;-1.229953e+001
17;0.170000;-1.183391e+001
18;0.180000;-1.149516e+001
19;0.190000;-1.149378e+001
20;0.200000;-1.175908e+001
21;0.210000;-1.212608e+001
22;0.220000;-1.235089e+001
23;0.230000;-1.230946e+001
24;0.240000;-1.232118e+001
25;0.250000;-1.246999e+001
26;0.260000;-1.268657e+001
27;0.270000;-1.281627e+001
28;0.280000;-1.322849e+001
29;0.290000;-1.286264e+001
30;0.300000;-1.194988e+001
31;0.310000;-1.150080e+001
32;0.320000;-1.146078e+001
33;0.330000;-1.216701e+001
34;0.340000;-1.226929e+001
35;0.350000;-1.228526e+001
36;0.360000;-1.215306e+001
37;0.370000;-1.214713e+001
38;0.380000;-1.254151e+001
39;0.390000;-1.340814e+001
40;0.400000;-1.356043e+001
41;0.410000;-1.283917e+001
42;0.420000;-1.256761e+001
43;0.430000;-1.262519e+001
44;0.440000;-1.270627e+001
45;0.450000;-1.299606e+001
46;0.460000;-1.253055e+001
47;0.470000;-1.245418e+001
48;0.480000;-1.238238e+001
49;0.490000;-1.230676e+001
50;0.500000;-5.396017e+000
51;0.510000;-5.236910e+000
52;0.520000;-4.958940e+000
53;0.530000;-4.997384e+000
54;0.540000;-4.138320e+000
55;0.550000;-3.643159e+000
56;0.560000;-3.339661e+000
57;0.570000;-3.238401e+000
58;0.580000;-3.149915e+000
59;0.590000;-3.511308e+000
60;0.600000;-4.145247e+000
61;0.610000;-4.887389e+000
62;0.620000;-6.262983e+000
63;0.630000;-7.656088e+000
64;0.640000;-9.628673e+000
65;0.650000;-1.034330e+001
66;0.660000;-1.266793e+001
67;0.670000;-1.264151e+001
68;0.680000;-1.241770e+001
69;0.690000;-1.180850e+001
70;0.700000;-7.853314e+000
71;0.710000;-6.509054e+000
72;0.720000;-6.164058e+000
73;0.730000;-6.688681e+000
74;0.740000;-7.910398e+000
75;0.750000;-7.771422e+000
76;0.760000;-6.944777e+000
77;0.770000;-6.537045e+000
78;0.780000;-6.663290e+000
79;0.790000;-7.115587e+000
80;0.800000;-7.295558e+000
81;0.810000;-7.313611e+000
82;0.820000;-7.364268e+000
83;0.830000;-7.383010e+000
84;0.840000;-7.187675e+000
85;0.850000;-7.255556e+000
86;0.860000;-7.336909e+000
87;0.870000;-7.885291e+000
88;0.880000;-8.125618e+000
89;0.890000;-8.471457e+000
90;0.900000;-8.457055e+000
91;0.910000;-6.002541e+000
92;0.920000;-5.170755e+000
93;0.930000;-4.487965e+000
94;0.940000;-4.201752e+000
95;0.950000;-3.790037e+000
96;0.960000;-3.769508e+000
97;0.970000;-3.614130e+000
98;0.980000;-3.422699e+000
99;0.990000;-3.035358e+000
100;1.000000;-2.616601e+000
101;1.010000;-2.562766e+000
102;1.020000;-2.479151e+000
103;1.030000;-2.583405e+000
104;1.040000;-2.677560e+000
105;1.050000;-2.835133e+000
106;1.060000;-3.327002e+000
107;1.070000;-5.798934e+000
108;1.080000;-8.308707e+000
109;1.090000;-8.926717e+000
110;1.100000;-8.973655e+000
111;1.110000;-7.739194e+000
112;1.120000;-6.980775e+000
113;1.130000;-6.527586e+000
114;1.140000;-6.570762e+000
115;1.150000;-6.262053e+000
116;1.160000;-5.977673e+000
117;1.170000;-5.747427e+000
118;1.180000;-5.474329e+000
119;1.190000;-5.600907e+000
120;1.200000;-5.555405e+000
121;1.210000;-5.438075e+000
122;1.220000;-5.422728e+000
123;1.230000;-5.564977e+000
124;1.240000;-5.662038e+000
125;1.250000;-5.856187e+000
126;1.260000;-5.987417e+000
127;1.270000;-6.115727e+000
128;1.280000;-6.223251e+000
129;1.290000;-6.503380e+000
130;1.300000;-6.857425e+000
131;1.310000;-6.969110e+000
132;1.320000;-7.087968e+000
133;1.330000;-7.183276e+000
134;1.340000;-7.301250e+000
135;1.350000;-7.330158e+000
136;1.360000;-7.465061e+000
137;1.370000;-7.320031e+000
138;1.380000;-7.300030e+000
139;1.390000;-7.157290e+000
140;1.400000;-7.018352e+000
141;1.410000;-6.936583e+000
142;1.420000;-7.020099e+000
143;1.430000;-7.190358e+000
144;1.440000;-7.336976e+000
145;1.450000;-7.455074e+000
146;1.460000;-7.697443e+000
147;1.470000;-8.056626e+000
148;1.480000;-8.490520e+000
149;1.490000;-9.360560e+000
150;1.500000;-1.051523e+001
151;1.510000;-1.180237e+001
152;1.520000;-1.209598e+001
153;1.530000;-1.212875e+001
154;1.540000;-1.228207e+001
155;1.550000;-1.175269e+001
156;1.560000;-1.169275e+001
157;1.570000;-1.225600e+001
158;1.580000;-1.272078e+001
159;1.590000;-1.294958e+001
160;1.600000;-1.254818e+001
161;1.610000;-1.215686e+001
162;1.620000;-1.189660e+001
163;1.630000;-1.241764e+001
164;1.640000;-1.273472e+001
165;1.650000;-1.242516e+001
166;1.660000;-1.253127e+001
167;1.670000;-1.244064e+001
168;1.680000;-1.234712e+001
169;1.690000;-1.260506e+001
170;1.700000;-1.301916e+001
171;1.710000;-1.314566e+001
172;1.720000;-1.301640e+001
173;1.730000;-1.309067e+001
174;1.740000;-1.294593e+001
175;1.750000;-1.253753e+001
176;1.760000;-1.166644e+001
177;1.770000;-1.162309e+001
178;1.780000;-1.216863e+001
179;1.790000;-1.253936e+001
180;1.800000;-1.246827e+001
181;1.810000;-1.288802e+001
182;1.820000;-1.255152e+001
183;1.830000;-1.271599e+001
184;1.840000;-1.299332e+001
185;1.850000;-1.295524e+001
186;1.860000;-1.288159e+001
187;1.870000;-1.275876e+001
188;1.880000;-1.258109e+001
189;1.890000;-1.246177e+001
190;1.900000;-1.251775e+001
191;1.910000;-1.239732e+001
192;1.920000;-1.192040e+001
193;1.930000;-1.174318e+001
194;1.940000;-1.214991e+001
195;1.950000;-1.257968e+001
196;1.960000;-1.273235e+001
197;1.970000;-1.269979e+001
198;1.980000;-1.283366e+001
199;1.990000;-1.274920e+001
200;2.000000;-1.245687e+001
201;2.010000;-1.225928e+001

 

 

你可能感兴趣的:(opensmile)