<jupyter_start><jupyter_text>DIOに基づく基本周波数推定<NAME>, <NAME> and <NAME>, ``Rapid F0 Estimation for High-SNR Speech Based on Fundamental Component Extraction,'' Trans. IEICE, vol. J93-D, no. 2, pp. 109-117, Feb. 2010.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
import pyworld
from scipy.io import wavfile
IN_WAVE_FILE = "in.wav"
FRAME_LENGTH = 1024  # フレーム長 (FFTサイズ)
HOP_LENGTH = 80  # フレームのシフト長
# 音声のロード
fs, data = wavfile.read(IN_WAVE_FILE)
data = data.astype(np.float64)
# DIO に基づく基本周波数推定
fo, _ = pyworld.dio(data, fs)
# 波形表示
fig = plt.figure(figsize=(12, 6))
n_samples = len(data)
time = np.arange(n_samples) / fs
axes = fig.add_subplot(2, 1, 1)
axes.plot(time, data)
axes.set_xlabel("Time (sec)")
axes.set_ylabel("Amplitude")
axes.set_title("Waveform")
axes.set_xlim(0, np.max(time))

axes = fig.add_subplot(2, 1, 2)
axes.plot(fo)
axes.set_xlabel("Frame number")
axes.set_ylabel("Frequency (Hz)")
axes.set_title("Estimation of fundamental frequency via DIO method")
axes.set_xlim(0, len(fo) - 1)

plt.tight_layout()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14471243042671614, 'fraction_numerical': 0.03153988868274583, 'mean_word_length': 5.829113924050633, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '321191', 'license': 'MIT', 'n_tokens_mistral': 524, 'n_tokens_neox': 486, 'n_words': 100, 'path': 'SpeechAnalysis/feat_fo_dio.ipynb', 'repo_name': 'tam17aki/speech_process_exercise', 'size': '1091'}