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 frame size for LLD extraction #80

Open
naufalrif opened this issue Apr 4, 2023 · 1 comment
Open

change frame size for LLD extraction #80

naufalrif opened this issue Apr 4, 2023 · 1 comment

Comments

@naufalrif
Copy link

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

@bagustris
Copy link

@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]

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

2 participants