Extracting features from an acoustic signal
Import required packages
[2]:
from oceanai.modules.lab.build import Run
Build
[3]:
_b5 = Run(
lang = 'en', # Interface language
color_simple = '#333', # Plain text color (hexadecimal code)
color_info = '#1776D2', # The color of the text containing the information (hexadecimal code)
color_err = '#FF0000', # Error text color (hexadecimal code)
color_true = '#008001', # Text color containing positive information (hexadecimal code)
bold_text = True, # Bold text
num_to_df_display = 30, # Number of rows to display in tables
text_runtime = 'Runtime', # Runtime text
metadata = True # Displaying information about library
)
[2023-12-10 16:35:36] OCEANAI - personality traits: Authors: Elena Ryumina [ryumina_ev@mail.ru] Dmitry Ryumin [dl_03.03.1991@mail.ru] Alexey Karpov [karpov@iias.spb.su] Maintainers: Elena Ryumina [ryumina_ev@mail.ru] Dmitry Ryumin [dl_03.03.1991@mail.ru] Version: 1.0.0a2 License: BSD License
Acoustic feature extraction process
[5]:
# Core settings
sr = 44100 # Sampling frequency
# Path to the audio or video file
path = 'video_FI/test/_plk5k7PBEg.003.mp4'
hc_features, melspectrogram_features = _b5.get_acoustic_features(
path = path, # Path to the audio or video file
sr = sr, # Sampling frequency
window = 2, # Signal segment window size (in seconds)
step = 1, # Signal segment window shift step (in seconds)
out = True, # Display
runtime = True, # Runtime count
run = True # Run blocking
)
[2023-12-10 16:36:06] Extraction of features (hand-crafted and mel-spectrograms) from an acoustic signal …
[2023-12-10 16:36:11] Statistics of the features extracted from the acoustic signal: Total number of segments with: 1. hand-crafted features: 12 2. mel-spectrogram log: 12 Dimension of the matrix of hand-crafted features of one segment: 196 ✕ 25 Dimension of the tensor with log mel-spectrograms of one segment: 224 ✕ 224 ✕ 3
— Runtime: 5.292 sec. —