Perceptual Graph Explorer: Audio Texture Segmentation
Clusters short-time acoustic states in a normalized three-dimensional feature space, analyzes temporal transitions between clusters, and renders each cluster as a time-compressed Hann-overlap montage.
What this does
Perceptual Graph Explorer analyzes one Sound as a sequence of overlapping short-time frames. Each frame is represented by three normalized acoustic descriptors — Energy, Stability, and Brightness — and assigned to one of several clusters with k-means. The script then measures how cluster assignments change over time and creates one audio montage for each non-empty cluster.
What does “Graph” mean here?
The clustering itself is not graph clustering or community detection. It is k-means in a three-dimensional feature space. The graph-like temporal structure appears afterward in the cluster transition matrix, which describes how adjacent source frames move between cluster states.
Processing pipeline:
- Analyze overlapping source windows.
- Measure Energy, Stability, and Brightness.
- Min-max normalize each feature within the current file.
- Cluster the 3D points with k-means.
- Characterize each cluster from its normalized centroid.
- Measure transitions between successive frame assignments.
- Render one time-compressed Hann-overlap montage per non-empty cluster.
- Draw the 3D space, transition matrix, cluster waveforms, legend, and summary.
Quick Start
- Select exactly one Sound object.
- Run
Perceptual_Graph.praat. - Choose Custom or one of the 2-, 3-, 4-, or 5-cluster presets.
- For Custom, set Window_length_ms, Step_size_ms, and Number_of_clusters.
- Keep Number_of_clusters within 2–8.
- Set Scale_peak to the desired output peak target between 0 and 1.
- Enable Draw_visualization to inspect the clustering and transitions.
- Enable Play_result to play the first generated cluster montage.
Three-Dimensional Feature Space
Dimension A: Energy
Praat Intensity sampled at the center of each analysis window.
Dimension B: Stability
Praat Harmonicity sampled at the window center. The raw value is a Harmonicity/HNR-like measurement, not a native 0–1 periodicity score.
Dimension C: Brightness
Spectral centroid of the rectangular source window.
The analysis grid starts at t = 0. For each frame, Energy and Stability are measured at the window center, while Brightness is computed from the complete extracted window.
Within-File Normalization
What do the normalized perceptual coordinates mean?
The coordinates are relative to the current Sound, not absolute perceptual scales. A value of 1 means the maximum measured value of that feature in this file; 0 means the minimum.
If a feature is constant across the entire file, every frame receives 0.5 for that dimension.
K-Means Clustering
How is k-means initialized?
The first centroid is selected randomly. Each later centroid is chosen deterministically as the point whose distance to its nearest existing centroid is greatest. This is a farthest-first initialization, not probabilistic k-means++ sampling.
The algorithm then alternates between assigning every frame to the nearest centroid and recomputing each non-empty centroid from its assigned frames.
| Setting | Value |
|---|---|
| Maximum iterations | 30 |
| Convergence threshold | maximum centroid shift < 0.001 |
| Final assignment | One authoritative reassignment pass using the final centroids |
Cluster Characterization and Labels
Each non-empty cluster is labeled from the mean of its normalized Energy, Stability, and Brightness coordinates.
| Dimension | Condition | Label |
|---|---|---|
| Energy | > 0.66 | Loud |
| Energy | < 0.33 | Quiet |
| Energy | otherwise | Mid |
| Stability | > 0.66 | Tonal |
| Stability | < 0.33 | Noisy |
| Brightness | > 0.66 | Bright |
| Brightness | < 0.33 | Dark |
Examples:
C1_Loud_Tonal_Bright C2_Quiet_Noisy_Dark C3_Mid
Cluster Transition Matrix
What does the transition matrix show?
The matrix describes transitions between cluster assignments of adjacent analysis frames in the original source.
Each matrix row therefore sums to 1 when that source cluster has outgoing transitions. Self-transitions are included and represent consecutive frames that remain in the same cluster.
This matrix describes the temporal organization of the original analysis sequence, not transitions between the rendered montage files.
Cluster Audio Montage
What is a cluster montage?
For each cluster, all source windows assigned to that cluster are collected in original chronological order and placed consecutively into a new sound. Source-time gaps between those windows are removed.
The result is therefore a time-compressed montage of cluster-matching windows, not a source-aligned stem with silence in the rejected regions.
50% Hann Overlap-Add
Each source fragment receives a Hanning window. Fragments are written into the montage with a synthesis hop equal to half the fragment length:
The synthesis hop is fixed by the montage renderer and is independent of the deprecated Overlap_time_ms field. It can also differ slightly from the analysis Step_size_ms, especially with Custom settings.
Channel preservation
Cluster montages preserve the source channel count. For multichannel material, each channel is overlap-added independently using the same temporal placement.
Peak scaling
Every generated cluster montage is scaled to Scale_peak. This means the final peak level of separate cluster outputs is intentionally standardized rather than preserving their original relative peak levels.
Parameters
Presets
| Preset | Clusters | Window | Analysis Step |
|---|---|---|---|
| Custom | User | User | User |
| 2 Clusters - Basic Split | 2 | 60 ms | 30 ms |
| 3 Clusters - Detailed | 3 | 50 ms | 25 ms |
| 4 Clusters - Fine Analysis | 4 | 40 ms | 20 ms |
| 5 Clusters - Very Fine | 5 | 35 ms | 18 ms |
Form Fields
| Parameter | Default | Behavior |
|---|---|---|
| Window_length_ms | 50 | Duration of each analysis/source fragment. |
| Step_size_ms | 25 | Hop between successive analysis windows. |
| Number_of_clusters | 3 | Validated to 2–8. |
| Overlap_time_ms | 5 | Deprecated and ignored; retained for argument compatibility. |
| Scale_peak | 0.95 | Target peak for every generated montage; must be >0 and ≤1. |
| Draw_visualization | On | Draw the 3D feature space, transition matrix, montage waveforms, legend, and summary. |
| Play_result | On | Play the first generated cluster montage. |
Visualization Guide
What is drawn?
- 3D isometric perceptual space — Energy, Stability, Brightness.
- Cluster nodes — every frame, colored by assigned cluster.
- Cluster centroids — labeled C1, C2, …
- 3D bounding boxes — axis-aligned min/max extent of each cluster; these are not convex hulls.
- Transition matrix — row-normalized probabilities from cluster i to cluster j.
- Cluster montage waveforms — one panel per non-empty cluster.
- Legend — cluster color and frame count.
- Summary strip — source duration/sample rate, feature ranges, cluster count, transition count, analysis settings, 50% Hann OLA, and Scale_peak.
How to read the 3D perceptual space
Every point is one analysis frame in the normalized Energy–Stability–Brightness cube. The projection is isometric: the 3D coordinates are projected onto the 2D page for visualization. Cluster colors indicate k-means assignments.
The dotted cluster boxes show the minimum and maximum value of each coordinate within a cluster. They are descriptive bounding boxes and should not be interpreted as the exact geometric boundary used by k-means.
How to read the transition matrix
Rows are the current cluster and columns are the next cluster. Darker cells indicate higher row-normalized transition probability. The diagonal shows temporal persistence within a cluster.
How to read the montage waveforms
Each waveform is the generated compressed montage for that cluster. Its time axis is montage time, not the original source timeline.
Applications
The tool is suited to exploratory and compositional uses such as:
- comparing recurring acoustic states within a recording,
- creating texture-oriented montages from similar frames,
- examining whether certain acoustic states persist or alternate frequently,
- reorganizing recorded material according to Energy, Stability, and Brightness,
- using cluster outputs as source material for subsequent processing.