如何使用 gstreamer 在 pocketsphinx 中设置配置选项
How to set configuration options in pocketsphinx using gstreamer
可能是一个非常愚蠢的问题,但我无法在任何地方找到解决方案。
当我 运行 'gst-inspect-1.0 pocketsphinx' 我得到类似的东西:
Current configuration:
[NAME] [DEFLT] [VALUE]
-agc none none
-agcthresh 2.0 2.000000e+00
-allphone
...
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "pocketsphinx0"
...
我知道如何为 'element properties' 设置值,但如何为其他配置选项设置值?例如我想为 'keyphrase' 设置一个值,但是做类似
的事情
asr.set_property("keyphrase", "test")
或
asr.set_property("-keyphrase", "test")
returns
TypeError: object of type `GstPocketSphinx' does not have property `keyphrase'
您需要修改插件源以引入新属性:
g_object_class_install_property
(gobject_class, PROP_KEYPHRASE,
g_param_spec_string("keyphrase", "Keyspotting phrase",
"Keyspotting phrase",
NULL,
G_PARAM_READWRITE));
....
case PROP_KEYPHRASE:
gst_pocketsphinx_set_string(ps, "-keyphrase", value);
可能是一个非常愚蠢的问题,但我无法在任何地方找到解决方案。 当我 运行 'gst-inspect-1.0 pocketsphinx' 我得到类似的东西:
Current configuration:
[NAME] [DEFLT] [VALUE]
-agc none none
-agcthresh 2.0 2.000000e+00
-allphone
...
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "pocketsphinx0"
...
我知道如何为 'element properties' 设置值,但如何为其他配置选项设置值?例如我想为 'keyphrase' 设置一个值,但是做类似
的事情asr.set_property("keyphrase", "test")
或
asr.set_property("-keyphrase", "test")
returns
TypeError: object of type `GstPocketSphinx' does not have property `keyphrase'
您需要修改插件源以引入新属性:
g_object_class_install_property
(gobject_class, PROP_KEYPHRASE,
g_param_spec_string("keyphrase", "Keyspotting phrase",
"Keyspotting phrase",
NULL,
G_PARAM_READWRITE));
....
case PROP_KEYPHRASE:
gst_pocketsphinx_set_string(ps, "-keyphrase", value);