Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change framesize and framestep in ComParE_2016 config file #76

Open
rodaslemos opened this issue Feb 27, 2023 · 2 comments
Open

Change framesize and framestep in ComParE_2016 config file #76

rodaslemos opened this issue Feb 27, 2023 · 2 comments

Comments

@rodaslemos
Copy link

rodaslemos commented Feb 27, 2023

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 #42 of someone with the same intention as me I followed the suggested steps:

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?

@zehuiwu
Copy link

zehuiwu commented Feb 28, 2023

Here is how I solved the problem:

  1. find the location of the opensmile-python package
  2. go to the "opensmile-python/opensmile/core/config/compare" folder
  3. open the config file ComParE_2016_core.lld.conf.inc
  4. change the frame size and frame step at lines 18-19
  5. make the same change to the frame size and frame step at lines 51-52
  6. 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!

@najdamikolaj00
Copy link

najdamikolaj00 commented Feb 26, 2024

@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.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants