Class: RubyLLM::Transcription::WavAudio
- Inherits:
-
Object
- Object
- RubyLLM::Transcription::WavAudio
- Defined in:
- lib/ruby_llm/transcription/wav_audio.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#bits_per_sample ⇒ Object
readonly
Returns the value of attribute bits_per_sample.
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
Instance Method Summary collapse
- #duration ⇒ Object
-
#initialize(content) ⇒ WavAudio
constructor
A new instance of WavAudio.
Constructor Details
#initialize(content) ⇒ WavAudio
Returns a new instance of WavAudio.
8 9 10 11 12 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 8 def initialize(content) content = wav_content(content) parse_chunks(content) raise ArgumentError, 'WAV file must contain audio data and format information' unless @data && @sample_rate end |
Instance Attribute Details
#bits_per_sample ⇒ Object (readonly)
Returns the value of attribute bits_per_sample.
6 7 8 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 6 def bits_per_sample @bits_per_sample end |
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
6 7 8 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 6 def channels @channels end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 6 def data @data end |
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
6 7 8 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 6 def encoding @encoding end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
6 7 8 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 6 def sample_rate @sample_rate end |
Instance Method Details
#duration ⇒ Object
14 15 16 |
# File 'lib/ruby_llm/transcription/wav_audio.rb', line 14 def duration data.bytesize.fdiv(sample_rate * channels * bits_per_sample / 8) end |