<jupyter_start><jupyter_text>Extraction of prosody features from audio filesCompute prosody features from continuous speech.103 features are computed:Num     Feature                                                          Description--------------------------------------------------------------------------------------------------------------------------                                Features based on F0                                ---------------------------------------------------------------------------------------------------------------------------1-6     F0-contour                                                       Avg., Std., Max., Min., Skewness, Kurtosis7-12    Tilt of a linear estimation of F0 for each voiced segment        Avg., Std., Max., Min., Skewness, Kurtosis13-18   MSE of a linear estimation of F0 for each voiced segment         Avg., Std., Max., Min., Skewness, Kurtosis19-24   F0 on the first voiced segment                                   Avg., Std., Max., Min., Skewness, Kurtosis25-30   F0 on the last voiced segment                                    Avg., Std., Max., Min., Skewness, Kurtosis--------------------------------------------------------------------------------------------------------------------------                                Features based on energy                                ---------------------------------------------------------------------------------------------------------------------------31-34   energy-contour for voiced segments                               Avg., Std., Skewness, Kurtosis35-38   Tilt of a linear estimation of energy contour for V segments     Avg., Std., Skewness, Kurtosis39-42   MSE of a linear estimation of energy contour for V segment       Avg., Std., Skewness, Kurtosis43-48   energy on the first voiced segment                               Avg., Std., Max., Min., Skewness, Kurtosis49-54   energy on the last voiced segment                                Avg., Std., Max., Min., Skewness, Kurtosis55-58   energy-contour for unvoiced segments                             Avg., Std., Skewness, Kurtosis59-62   Tilt of a linear estimation of energy contour for U segments     Avg., Std., Skewness, Kurtosis63-66   MSE of a linear estimation of energy contour for U segments      Avg., Std., Skewness, Kurtosis67-72   energy on the first unvoiced segment                             Avg., Std., Max., Min., Skewness, Kurtosis73-78   energy on the last unvoiced segment                              Avg., Std., Max., Min., Skewness, Kurtosis--------------------------------------------------------------------------------------------------------------------------                                Features based on duration                                ---------------------------------------------------------------------------------------------------------------------------79      Voiced rate                                                      Number of voiced segments per second80-85   Duration of Voiced                                               Avg., Std., Max., Min., Skewness, Kurtosis86-91   Duration of Unvoiced                                             Avg., Std., Max., Min., Skewness, Kurtosis92-97   Duration of Pauses                                               Avg., Std., Max., Min., Skewness, Kurtosis98-103  Duration ratios                                                  Pause/(Voiced+Unvoiced), Pause/Unvoiced, Unvoiced/(Voiced+Unvoiced),                                                                         Voiced/(Voiced+Unvoiced), Voiced/Puase, Unvoiced/Pause---------------------------------------------------------------------------------------------------------------------------<jupyter_code>import sys
sys.path.append("../")
from prosody.prosody import Prosody
prosodyf=Prosody()
file_audio="../audios/001_ddk1_PCGITA.wav"<jupyter_output><empty_output><jupyter_text>Extract features and return them as a numpy array<jupyter_code>features1=prosodyf.extract_features_file(file_audio, static=True, plots=True, fmt="npy")
print(features1.shape)<jupyter_output><empty_output><jupyter_text>Extract static features and return them as a dataframe<jupyter_code>features1=prosodyf.extract_features_file(file_audio, static=True, plots=False, fmt="csv")
print(features1)<jupyter_output>1F0ku      1F0max    1F0mean     1F0min    1F0skw    1F0std       F0avg  \
0  6.210762  106.297119  96.801537  94.436989  2.612422  2.823843  103.519859   

     F0kurt       F0max      F0min       ...        stdEvoiced  stddurpause  \
0  0.598902  173.218719  80.561127       ...          3.389881          0.0   

   stddurunvoiced  stddurvoiced  stdlastEunvoiced  stdlastEvoiced  \
0        0.049385      0.069055          7.232886        2.704041   

   stdmseEunvoiced  stdmseEvoiced  stdtiltEunvoiced  stdtiltEvoiced  
0        19.314991       0.634663        605.019587       30.365483  

[1 rows x 103 columns]<jupyter_text>Extract dynamic features and return them as a dataframe<jupyter_code>features1=prosodyf.extract_features_file(file_audio, static=False, plots=False, fmt="csv")
print(features1)
print(features1.head())<jupyter_output>Ecoef0    Ecoef1    Ecoef2    Ecoef3    Ecoef4    Ecoef5  \
0   105.702776 -0.000302  0.004222  0.027340 -0.569139  1.528803   
1   130.392459 -0.002249  0.043573 -0.343251  1.398935 -3.227125   
2   114.251205  0.000021 -0.001472  0.037513 -0.430769  1.134978   
3   105.637903 -0.000249  0.002923  0.038836 -0.610899  1.577689   
4   149.150462  0.001398 -0.039493  0.360269 -1.197304  0.399711   
5   113.908886  0.000021 -0.001443  0.036175 -0.410373  1.019496   
6   105.632975 -0.000250  0.002927  0.038802 -0.610802  1.577603   
7   149.150063  0.001398 -0.039489  0.360243 -1.197224  0.399601   
8   114.367517  0.000037 -0.002326  0.052690 -0.536308  1.358722   
9   105.640711 -0.000236  0.002534  0.042916 -0.629691  1.613324   
10  147.851988  0.003024 -0.072634  0.599051 -1.910331  1.137942   
11  103.886557  0.000021 -0.001446  0.036454 -0.414043  1.030153   

    Voiced duration  f0coef0   f0coef1   f0coef2   f0coef3    f0coef4  \
0        -16.680449     0.13 -0.001438  0.[...]<jupyter_text>Extract dynamic features and return them as a torch tensor<jupyter_code>features1=prosodyf.extract_features_file(file_audio, static=False, plots=False, fmt="torch")
print(features1.dtype)
print(features1.size())<jupyter_output>torch.float64
torch.Size([12, 13])<jupyter_text>Extract static features from a path return them as a numpy array<jupyter_code>path_audio="../audios/"
features1=prosodyf.extract_features_path(path_audio, static=True, plots=False, fmt="npy")
print(features1.shape)<jupyter_output>Processing 098_u1_PCGITA.wav: 100%|██████████| 4/4 [00:00<00:00, 19.14it/s]
{'fraction_non_alphanumeric': 0.2017738359201774, 'fraction_numerical': 0.12978566149297857, 'mean_word_length': 1.3632553265805099, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '313730', 'license': 'MIT', 'n_tokens_mistral': 2430, 'n_tokens_neox': 1935, 'n_words': 495, 'path': 'notebooks_examples/prosody_features.ipynb', 'repo_name': 'virtualcharacters/DisVoice', 'size': '6765'}