Skip to main content

Unsupervised syllable segmentation and evaluation toolkit for speech audio

Project description

findsylls

Unsupervised syllable(-like) segmentation & evaluation toolkit for speech audio. Extract amplitude / modulation envelopes, segment into candidate syllables, and (optionally) evaluate versus Praat TextGrid annotations at nuclei, syllable boundary/span, and word boundary/span levels.

Features

  • Pluggable amplitude envelope front-ends: RMS, Hilbert, low-pass, spectral band subtraction (SBS), gammatone, theta oscillator.
  • Peak & valley segmentation (extensible: hooks for future algorithms like Mermelstein, oscillator-based).
  • Robust TextGrid parsing for phones, syllables, words with vowel / syllabic consonant filtering.
  • Multi-level evaluation metrics (TP / Ins / Del / Sub; precision/recall/F1/TER aggregation helpers).
  • Batch pipeline utilities + fuzzy filename matching (.wav.TextGrid).
  • Optional plotting layer for qualitative inspection.

Install (Local)

# Core install
pip install findsylls

# Or from a local clone (editable for development)
pip install -e .[dev]

# With plotting extras
pip install 'findsylls[viz]'

Quick Start

from findsylls import segment_audio
sylls, env, t = segment_audio("example.wav", envelope_fn="sbs", segment_fn="peaks_and_valleys")
print(sylls[:5])

Batch evaluation:

from findsylls import run_evaluation
results = run_evaluation(
    textgrid_paths="data/**/*.TextGrid",
    wav_paths="data/**/*.wav",
    phone_tier=1,
    syllable_tier=2,
    word_tier=3,
    envelope_fn="hilbert",
)
print(results.head())

Aggregate:

from findsylls import aggregate_results
summary = aggregate_results(results, dataset_name="MyCorpus")
print(summary)

CLI

After install:

findsylls segment input.wav --envelope sbs --method peaks_and_valleys --out sylls.json
findsylls evaluate "data/**/*.wav" "data/**/*.TextGrid" --phone-tier 1 --syllable-tier 2 --word-tier 3 --envelope hilbert --out results.csv

Show help:

findsylls --help
findsylls segment --help
findsylls evaluate --help

API Surface

Function Purpose
segment_audio One-file end‑to‑end (load → envelope → segment).
run_evaluation Batch match WAV/TextGrid and compute metrics.
get_amplitude_envelope Compute envelope via a registered method.
segment_envelope Dispatch segmentation algorithm.
flatten_results / aggregate_results Reshape & aggregate evaluation outputs.
plot_segmentation_result Multi-panel qualitative plot (optional).

Adding Methods

  1. Envelope: implement compute_* returning (env, times) in envelope/ and register in envelope/dispatch.py.
  2. Segmentation: implement segment_<name>(envelope, times, **kwargs) in segmentation/ and add branch in segmentation/dispatch.py.

TextGrid Tier Indexing

Indices are 0-based (as provided by the textgrid library). Pass None to skip a tier or -1 for placeholder syllable generation (currently returns empty list).

Evaluation Conventions

  • Default tolerance = 0.05s.
  • EVAL_METHODS ordering drives flatten/aggregate loops; include new metric keys there if extending.
  • Substitutions matter for span metrics; remain zero for nuclei/boundary F1 semantics.

Roadmap / TODO

  • Implement generate_syllable_intervals (placeholder now).
  • Additional segmentation algorithms (Mermelstein, oscillator-based).
  • More robust CLI progress + JSON schema for outputs.
  • Optional streaming / large-file handling.

Legacy Code

The previous exploratory/monolithic implementations are retained under a legacy/ folder (formerly old/ and findsylls_old/) for reference only. They are excluded from distribution and not supported; prefer the public API described above.

License

MIT. See LICENSE.

Citation

(Provide a citation once there is a paper / preprint.)


For development guidelines see .github/copilot-instructions.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

findsylls-0.1.1.tar.gz (302.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

findsylls-0.1.1-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file findsylls-0.1.1.tar.gz.

File metadata

  • Download URL: findsylls-0.1.1.tar.gz
  • Upload date:
  • Size: 302.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for findsylls-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9a19f2508cf152bc0ac47a1782392d4ef51aac99b68f8298eb6b58b714842c00
MD5 a096d4c140f8c57a9ff77972eaa9ce0e
BLAKE2b-256 43a268d95dace365132caf8de71f891550d254e01c308f8445f4b85a8ac7cdc8

See more details on using hashes here.

File details

Details for the file findsylls-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: findsylls-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for findsylls-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4e38b11ca41d1d1160a94b2af693764436fc93fcbe443466aafd0c650b0c28
MD5 b4dd9d4dd7753dc0a2c5b76a39e81764
BLAKE2b-256 9787ea8d488e0afb13d0c6565242d2de2ad448ba8963bd4964088bc399bfa795

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page