Class: NoyesJava::SpeechTrimmer

Inherits:
Object
  • Object
show all
Defined in:
lib/java_impl/speech_trimmer.rb

Instance Method Summary collapse

Constructor Details

#initialize(frequency = 16000) ⇒ SpeechTrimmer

Returns a new instance of SpeechTrimmer.


3
4
5
# File 'lib/java_impl/speech_trimmer.rb', line 3

def initialize frequency = 16000
  @st = Java::talkhouse.SpeechTrimmer.new frequency
end

Instance Method Details

#<<(pcm) ⇒ Object


6
7
8
9
# File 'lib/java_impl/speech_trimmer.rb', line 6

def << pcm
  result = @st.apply(pcm.to_java(Java::double))
  result.to_a if result
end

#dequeueObject


13
14
15
16
# File 'lib/java_impl/speech_trimmer.rb', line 13

def dequeue
  speech = @st.dequeue
  speech.to_a if speech
end

#enqueue(pcm) ⇒ Object


10
11
12
# File 'lib/java_impl/speech_trimmer.rb', line 10

def enqueue pcm
  @st.enqueue pcm.to_java(Java::double)
end

#eos?Boolean

Returns:

  • (Boolean)

17
18
19
# File 'lib/java_impl/speech_trimmer.rb', line 17

def eos?
  @st.eos
end