SoLA2-TechBlog

退屈な作業はプログラムに任せましょう!日々の作業に少し工夫を足すだけであなたの時間はもっとクリエイティブになる。

nicotalkを自分用にカスタマイズしてみよう! 【part4】

音声プレビュー機能の改良

nicotalkを自分用にカスタマイズしてみよう! 【Part 2】 - SoLA2-TechBlogにて「echoseika」と連携し、音声プレビュー機能を作成した事を覚えていますか?その時に音声公開パラメータを適応する課題が残ってましたが、なんとこの度「echoseika」の作者様が自らその機能を追加してくれました!

なので、こちら側もその機能を活用できるように対応しました。ではではこの機能が一体どのくらい便利なのか、実際に動いてるところを見てもらいましょう。

きっとnicotalkを使ったことがある人ならこの便利さを分かってもらえるはずっ!

カスタマイズ内容

さて、新バージョンの機能を利用するに当たり、ソースを以下のように修正しました。

  • 受け渡しパラメータの追加
  • パラメータ受け渡し前後にウェイトを追加
Public Sub previewVoice() '(Ctrl&Shift&V)
    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    Dim activeRow As Integer
    activeRow = ActiveCell.Row
    
    Dim speed As Integer
    Dim volume As Integer
    Dim pitch As Integer
    Dim intonation As Integer
        
    Dim tgtText As String
    Dim tgtActor As String
    Dim cmdStr As String
    tgtText = ActiveSheet.Cells(activeRow, 7).Value
    tgtActor = ActiveSheet.Cells(activeRow, 17).Value
    speed = ActiveSheet.Cells(activeRow, 11).Value
    volume = ActiveSheet.Cells(activeRow, 12).Value
    pitch = ActiveSheet.Cells(activeRow, 13).Value
    intonation = ActiveSheet.Cells(activeRow, 14).Value
    
    cmdStr = "★\echoseika.exe -cv " & tgtActor & " -volume " & Format(volume / 100, "0.00") & _
    " -speed " & Format(speed / 100, "0.00") & " -pitch " & Format(pitch / 100, "0.00") & " -intonation " & Format(intonation / 100, "0.00") & " " & tgtText
    
    Application.Wait Now + TimeValue("00:00:01")
    
    objShell.Run cmdStr, 1, True

    Application.Wait Now + TimeValue("00:00:01")

    'MsgBox tgtActor & " " & tgtText
    MsgBox cmdStr
    
End Sub