0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DDSP-SVCを用いた音声変換モデル(2)

Last updated at Posted at 2023-05-18

1. データ収集及び切り抜き

音声を学習するためには2つの方法があります。自分で録音するか他の歌手さんの声などを利用するかですね。僕は自分の声を録音して使いましたが、今後はYoutubeなどから音源を抽出して使用したいと思います。
僕はイアホンを付けてYoutubeからカラオケを流して僕の音声だけを40分程取得しました。ソフトは下のものを使いました。普通に携帯の録音機能を使ってもいいですが、おそらく後で形式変換とか必要になると思います。

しかし、歌声だけではなく普通に喋ってる声も欲しくて間奏とかは独り言をずっと喋りました。録音ファイルはWAV形式で44.1KHz、Monoで保存しないといけないです。でももし忘れても後で変換できます。

音源が取れたらデータを切り抜く必要があります。以下コードを共有します。現座のディレクトリに“data”ディレクトリを作ってその中に15秒ずつ切った音源を入れます。

from pydub import AudioSegment
import os

def split_wav_file(input_file, output_dir, split_length=15000):
    # split_lengthはミリ秒単位で指定します。デフォルトは15秒
    
    # WAVファイルを読み込みます
    sound = AudioSegment.from_wav(input_file)
    
    # 切り抜き回数を計算します
    num_splits = int(len(sound) / split_length)
    
    # 分割されたファイルを保存するディレクトリを作成します
    if not os.path.exists(output_dir):
        os.mkdir(output_dir)
    
    # WAVファイルを分割して保存します
    for i in range(num_splits):
        start = i * split_length
        end = (i + 1) * split_length
        split = sound[start:end]
        split.export(os.path.join(output_dir, f"{os.path.splitext(os.path.basename(input_file))[0]}_{i+1}.wav"), format="wav")

split_wav_file("data.wav","data",split_length=15000)

2. データ前処理

$ python draw.py

これでValidationデータを選んでくれます。

$ python preprocess.py -c configs/combsub.yaml

これで前処理もしました。trainとvalディレクトリの中が下の図のようになってたら成功です。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?