High-precision pitch detection using praat
<command-name>audio-pitch</command-name>
Perform high-precision pitch detection using Praat.
file: Audio file path or fixture namestart: Analysis start time (default: 0)duration: Duration to analyze (default: 3 seconds)step: Time resolution (default: 0.01 = 10ms)min_pitch: Lower frequency bound (default: 75 Hz)max_pitch: Upper frequency bound (default: 1500 Hz, covers kalimba range)Resolve the file path
Create and run a Praat script:
cat > /tmp/pitch_analysis.praat <<'PRAAT_SCRIPT'
Read from file: "<file>"
sound = selected("Sound")
To Pitch: <step>, <min_pitch>, <max_pitch>
pitch = selected("Pitch")
writeInfoLine: "time", tab$, "pitch_Hz", tab$, "note"
# ... iterate and output pitch values
PRAAT_SCRIPT
praat --run /tmp/pitch_analysis.praat
Parse results and identify notes:
Report:
/audio-pitch d5-repeat-01
/audio-pitch d5-repeat-01 2.0 1.0 0.005
/audio-pitch mixed-sequence-01 0 5 0.01 200 1000
/audio-onset to analyze specific onset times