spectral-prosody 0.1.1

Spectral graph methods for rhythmic prosody analysis — eigenvalue rhythm decomposition
Documentation
  • Coverage
  • 53.09%
    43 out of 81 items documented1 out of 36 items with examples
  • Size
  • Source code size: 46.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.04 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • SuperInstance/spectral-prosody
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • SuperInstance

spectral-prosody

Spectral graph methods for rhythmic prosody analysis.

This crate maps speech/music prosody to a graph where nodes represent beats or syllables and edges represent temporal proximity. The graph Laplacian's spectrum reveals rhythmic patterns: low eigenvalues correspond to macro rhythm (large-scale phrasing), while high eigenvalues correspond to micro rhythm (fine-grained beat structure). Spectral clustering segments prosody into phrases.

Quick Start

use spectral_prosody::{ProsodyNode, ProsodyGraph, RhythmExtractor, PhraseSegmenter};

// Create prosody nodes from timing/energy/pitch data
let nodes: Vec<ProsodyNode> = (0..8)
    .map(|i| ProsodyNode::new(i as f64 * 0.5, 1.0, 220.0 + i as f64 * 5.0, 0.25, 3000.0))
    .collect();

// Build a k-nearest-neighbor graph
let graph = ProsodyGraph::build_knn(nodes, 3, 1.0).unwrap();

// Extract rhythmic layers via spectral decomposition
let extractor = RhythmExtractor::new(5);
let layers = extractor.extract(&graph).unwrap();

// Segment into phrases using the Fiedler vector
let segmenter = PhraseSegmenter::new(4);
let phrases = segmenter.segment(&graph).unwrap();