How jkcamarador/pitch-it-perfect-api works
Pitch It Perfect is a Flask API that classifies recorder audio as either a sequence of notes or a single note. Clients upload audio to separate endpoints; each endpoint saves the upload, invokes its matching inference workflow, and returns a JSON prediction. The song workflow detects onsets, splits and normalizes note segments, extracts features, and classifies them; the single-note workflow preprocesses one recording and classifies it. Both use the loaded ResNet model and label encoder. Internal relationships are based on the excerpted main.py; the README documents the mobile-client use and /main API.
Main entry points: main.py Song inference · resnet-best-loss.h5 ResNet classifier · labelEncoder.joblib Label encoder
Components 13
API
- Song endpoint
main.py - Single-note endpoint
main.py - Song predictions
main.py - Note prediction
main.py
Audio processing
- Load and detect onsets
main.py - Note segmentation
main.py - Duration normalization
main.py - Mel features
main.py
Inference
- Song inference
main.py - Note inference
main.py - ResNet classifier
resnet-best-loss.h5 - Label encoder
labelEncoder.joblib
Other components
- Audio client
Connections 18
- Audio client → Song endpoint: uploads song
README.md - Audio client → Single-note endpoint: uploads note
main.py - Song endpoint → Song inference: calls
main.py - Single-note endpoint → Note inference: calls
main.py - Song inference → Load and detect onsets: detects onsets
main.py - Song inference → Note segmentation: splits audio
main.py - Song inference → Duration normalization: normalizes segments
main.py - Song inference → Mel features: extracts features
main.py - Note inference → Duration normalization: normalizes audio
main.py - Note inference → Mel features: extracts features
main.py - Song inference → ResNet classifier: classifies segments
main.py - Note inference → ResNet classifier: classifies audio
main.py - Song inference → Label encoder: decodes labels
main.py - Note inference → Label encoder: decodes label
main.py - Song endpoint → Song predictions: returns JSON
main.py - Single-note endpoint → Note prediction: returns JSON
main.py - Song inference → Song predictions: returns predictions
main.py - Note inference → Note prediction: returns prediction
main.py