Temporal

class audioflux.Temporal(frame_length=2048, slide_length=512, window_type=WindowType.HANN)

Temporal feature

Parameters
frame_length: int

frame length

slide_length: int

sliding length

window_type: WindowType

Window type for each frame.

See: type.WindowType

Examples

Read 220Hz audio data

>>> import audioflux as af
>>> audio_path = af.utils.sample_path('220')
>>> audio_arr, sr = af.read(audio_path)

Create Temporal and extract feature

>>> temp_obj = af.Temporal(frame_length=2048, slide_length=512)
>>> temp_obj.temporal(audio_arr)
>>> energy_arr, rms_arr, zero_cross_arr, m_arr = temp_obj.get_data(len(audio_arr))

Methods

cal_time_length(data_length)

Calculate the length of a frame from audio data.

ezr(data_length, gamma)

Get ezr feature

get_data(data_length)

Get energy/rms/zeroCrossRate feature

temporal(data_arr)

set audio data

cal_time_length(data_length)

Calculate the length of a frame from audio data.

Parameters
data_length: int

The length of the data to be calculated.

Returns
out: int
temporal(data_arr)

set audio data

Parameters
data_arr: np.ndarray [shape=(n,)]

Input audio data

get_data(data_length) -> (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>, <class 'numpy.ndarray'>)

Get energy/rms/zeroCrossRate feature

Parameters
data_length: int

The length of the data passed in by the temporal method

Returns
energy_arr: np.ndarray [shape=(time,)]

energy feature

rms_arr: np.ndarray [shape=(time,)]

rms feature

zero_cross_arr: np.ndarray [shape=(time,)]

zero Cross Rate feature

m_arr: np.ndarray [shape=(…,time)]
ezr(data_length, gamma)

Get ezr feature

Parameters
data_length: int

The length of the data passed in by the temporal method

gamma: float

gamma value

Returns
out: np.ndarray [shape=(time,)]

ezr feature