Change framesize and framestep in ComParE_2016 config file
Hello everyone,
I am doing my master's thesis and I want to use openSMILE to extract features from my audio files. If I use the standard configuration of ComParE_2016 with the low level descriptors
smile = opensmile.Smile( feature_set=opensmile.FeatureSet.ComParE_2016, feature_level=opensmile.FeatureLevel.LowLevelDescriptors, )
everything is alright. However, I would like to increase the framesize to get shorter sequences. I found here in github issue https://github.com/audeering/opensmile-python/issues/42 of someone with the same intention as me I followed the suggested steps:
- Copied the 4 config files from here https://github.com/audeering/opensmile-python/tree/main/opensmile/core/config/compare;
- They are in the same folder of my script.
After this I run the following command:
smile = opensmile.Smile( feature_set='ComParE_2016.conf', feature_level='lld', )
but I got this error : OpenSmileException: Code: 6 . Maybe the problem is in the creation of the config files: all I did was copy the files from github but I added in the first line config_str = ''' and in the last line i closed with '''. Should I save all files as .conf or with the same extensions as seen in the github? How can I solve this?
Here is how I solved the problem:
- find the location of the opensmile-python package
- go to the "opensmile-python/opensmile/core/config/compare" folder
- open the config file ComParE_2016_core.lld.conf.inc
- change the frame size and frame step at lines 18-19
- make the same change to the frame size and frame step at lines 51-52
- run smile = opensmile.Smile( feature_set=opensmile.FeatureSet.ComParE_2016, feature_level=opensmile.FeatureLevel.LowLevelDescriptors, ) y = smile.process_file('audio.wav')
I hope this helps!
@zehuiwu Thanks, this one works, although I have a feeling it should be more straightforward.
There is a script which helps a little bit:
config_file_path = ''
new_frame_size = '0.030' # Frame size in seconds original 0.060
new_frame_step = '0.030' # Frame step in seconds original 0.01
with open(config_file_path, 'r') as file:
lines = file.readlines()
lines[17] = f'frameSize={new_frame_size}\n'
lines[18] = f'frameStep={new_frame_step}\n'
lines[50] = f'frameSize={new_frame_size}\n'
lines[51] = f'frameStep={new_frame_step}\n'
with open(config_file_path, 'w') as file:
file.writelines(lines)
print("Configuration file has been updated.")