change frame size for LLD extraction
hello i want to ask on how to change the framesize for LLD extraction. the default frame size here is 0.01 s and i want to change it to either 0.025 or 0.03. i've tried the instruction in https://audeering.github.io/opensmile-python/usage.html#custom-config but it's returning this error
NameError Traceback (most recent call last) Cell In[25], line 2 1 with open('myconfig.conf', 'w') as fp: ----> 2 fp.write(config_str) 4 smile = opensmile.Smile( 5 feature_set='my.conf', 6 feature_level='func', 7 ) 8 smile.process_signal( 9 signal, 10 sampling_rate 11 )
NameError: name 'config_str' is not defined
please help
@naufalrif
I cannot reproduce this error. The minimum example below works for me, if you want to use your config again, you need to use read instead of write for with open.
import audiofile
import opensmile
signal, sampling_rate = audiofile.read("/home/bagus/train_001.wav")
config_str = '''
[componentInstances:cComponentManager]
instance[dataMemory].type=cDataMemory
;;; default source
[componentInstances:cComponentManager]
instance[dataMemory].type=cDataMemory
;;; source
\{\cm[source{?}:include external source]}
;;; main section
[componentInstances:cComponentManager]
instance[framer].type = cFramer
instance[lld].type = cEnergy
instance[func].type=cFunctionals
[framer:cFramer]
reader.dmLevel = wave
writer.dmLevel = frames
copyInputName = 1
frameMode = fixed
frameSize = 0.025000
frameStep = 0.010000
frameCenterSpecial = left
noPostEOIprocessing = 1
[lld:cEnergy]
reader.dmLevel = frames
writer.dmLevel = lld
\{\cm[bufferModeRbConf{?}:path to included config to set the buffer mode for the standard ringbuffer levels]}
nameAppend = energy
copyInputName = 1
rms = 1
log = 1
[func:cFunctionals]
reader.dmLevel=lld
writer.dmLevel=func
copyInputName = 1
\{\cm[bufferModeRbConf]}
\{\cm[frameModeFunctionalsConf{?}:path to included config to set frame mode for all functionals]}
functionalsEnabled=Moments
Moments.variance = 0
Moments.stddev = 1
Moments.skewness = 0
Moments.kurtosis = 0
Moments.amean = 1
Moments.doRatioLimit = 0
;;; sink
\{\cm[sink{?}:include external sink]}
'''
with open('my.conf', 'w') as fp:
fp.write(config_str)
smile = opensmile.Smile(
feature_set='my.conf',
feature_level='func',
)
smile.process_signal(
signal,
sampling_rate
)
Output:
pcm_RMSenergy_stddev ... pcm_LOGenergy_amean
start end ...
0 days 0 days 00:00:13.600000 0.000495 ... -12.41271
[1 rows x 4 columns]