Method: Praat.find_dominant_pitch

Defined in:
lib/praat_pitch.rb

.find_dominant_pitch(item) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/praat_pitch.rb', line 2

def self.find_dominant_pitch item
  item.frames.map! do |frame|
    top = frame.candidates.max do |a, b|
      a.strength <=> b.strength
    end

    frame.add_property "freq", top.frequency
   
    # Filter out the unvoiced candidates 
    if frame.freq > item.ceiling
      frame.freq = nil
    end

    frame
  end
  item
end