Class: Voicevox::AudioQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/voicevox/wrapper/audio_query.rb

Overview

音声合成用のクエリ。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ AudioQuery

Returns a new instance of AudioQuery.



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/voicevox/wrapper/audio_query.rb', line 92

def initialize(query)
  @accent_phrases = query[:accent_phrases].map { |ap| AccentPhrase.new ap }
  @speed_scale = query[:speed_scale]
  @pitch_scale = query[:pitch_scale]
  @intonation_scale = query[:intonation_scale]
  @volume_scale = query[:volume_scale]
  @pre_phoneme_length = query[:pre_phoneme_length]
  @post_phoneme_length = query[:post_phoneme_length]
  @output_sampling_rate = query[:output_sampling_rate]
  @output_stereo = query[:output_stereo]
  @kana = query[:kana]
end

Instance Attribute Details

#accent_phrasesArray<AccentPhrase>

Returns アクセント句のリスト。.

Returns:

  • (Array<AccentPhrase>)

    アクセント句のリスト。



72
73
74
# File 'lib/voicevox/wrapper/audio_query.rb', line 72

def accent_phrases
  @accent_phrases
end

#intonation_scaleFloat

Returns 全体の抑揚。.

Returns:

  • (Float)

    全体の抑揚。



78
79
80
# File 'lib/voicevox/wrapper/audio_query.rb', line 78

def intonation_scale
  @intonation_scale
end

#kanaString (readonly)

Returns AquesTalkライクな読み仮名。.

Returns:

  • (String)

    AquesTalkライクな読み仮名。



90
91
92
# File 'lib/voicevox/wrapper/audio_query.rb', line 90

def kana
  @kana
end

#output_sampling_rateInteger

Returns 音声データの出力サンプリングレート。.

Returns:

  • (Integer)

    音声データの出力サンプリングレート。



86
87
88
# File 'lib/voicevox/wrapper/audio_query.rb', line 86

def output_sampling_rate
  @output_sampling_rate
end

#output_stereoBoolean

Returns 音声データをステレオ出力するか否か。.

Returns:

  • (Boolean)

    音声データをステレオ出力するか否か。



88
89
90
# File 'lib/voicevox/wrapper/audio_query.rb', line 88

def output_stereo
  @output_stereo
end

#pitch_scaleFloat

Returns 全体の音高。.

Returns:

  • (Float)

    全体の音高。



76
77
78
# File 'lib/voicevox/wrapper/audio_query.rb', line 76

def pitch_scale
  @pitch_scale
end

#post_phoneme_lengthFloat

Returns 音声の後の無音時間。.

Returns:

  • (Float)

    音声の後の無音時間。



84
85
86
# File 'lib/voicevox/wrapper/audio_query.rb', line 84

def post_phoneme_length
  @post_phoneme_length
end

#pre_phoneme_lengthFloat

Returns 音声の前の無音時間。.

Returns:

  • (Float)

    音声の前の無音時間。



82
83
84
# File 'lib/voicevox/wrapper/audio_query.rb', line 82

def pre_phoneme_length
  @pre_phoneme_length
end

#speed_scaleFloat

Returns 全体の話速。.

Returns:

  • (Float)

    全体の話速。



74
75
76
# File 'lib/voicevox/wrapper/audio_query.rb', line 74

def speed_scale
  @speed_scale
end

#volume_scaleFloat

Returns 全体の音量。.

Returns:

  • (Float)

    全体の音量。



80
81
82
# File 'lib/voicevox/wrapper/audio_query.rb', line 80

def volume_scale
  @volume_scale
end

Instance Method Details

#to_hashHash

AudioQueryをHashにします。

Returns:

  • (Hash)


110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/voicevox/wrapper/audio_query.rb', line 110

def to_hash
  {
    accent_phrases: @accent_phrases.map(&:to_hash),
    pitch_scale: @pitch_scale,
    speed_scale: @speed_scale,
    intonation_scale: @intonation_scale,
    volume_scale: @volume_scale,
    pre_phoneme_length: @pre_phoneme_length,
    post_phoneme_length: @post_phoneme_length,
    output_sampling_rate: @output_sampling_rate,
    output_stereo: @output_stereo,
    kana: @kana
  }
end

#to_jsonString

AudioQueryをjsonにします。

Returns:

  • (String)


130
131
132
# File 'lib/voicevox/wrapper/audio_query.rb', line 130

def to_json(...)
  to_hash.to_json(...)
end