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.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 3.3 (2026) Concept: Within-file acoustic-state clustering and temporal transition analysis Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

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:

  1. Analyze overlapping source windows.
  2. Measure Energy, Stability, and Brightness.
  3. Min-max normalize each feature within the current file.
  4. Cluster the 3D points with k-means.
  5. Characterize each cluster from its normalized centroid.
  6. Measure transitions between successive frame assignments.
  7. Render one time-compressed Hann-overlap montage per non-empty cluster.
  8. Draw the 3D space, transition matrix, cluster waveforms, legend, and summary.
Scope: this is not source separation. A cluster groups frames with similar values of three descriptors; it does not identify instruments, speakers, phonemes, or stems.

Quick Start

  1. Select exactly one Sound object.
  2. Run Perceptual_Graph.praat.
  3. Choose Custom or one of the 2-, 3-, 4-, or 5-cluster presets.
  4. For Custom, set Window_length_ms, Step_size_ms, and Number_of_clusters.
  5. Keep Number_of_clusters within 2–8.
  6. Set Scale_peak to the desired output peak target between 0 and 1.
  7. Enable Draw_visualization to inspect the clustering and transitions.
  8. Enable Play_result to play the first generated cluster montage.
Overlap_time_ms is deprecated. It remains in the form only for argument compatibility and does not control the current reconstruction. Montage synthesis uses fixed 50% Hann overlap-add.

Three-Dimensional Feature Space

Dimension A: Energy

Praat Intensity sampled at the center of each analysis window.

Source measurement: Intensity in dB Undefined fallback: 50 dB Normalized coordinate: relative to this file's minimum and maximum

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.

Source measurement: Harmonicity (cc) Undefined fallback: 0 Normalized coordinate: relative to this file's minimum and maximum

Dimension C: Brightness

Spectral centroid of the rectangular source window.

Source measurement: spectral centre of gravity in Hz Undefined fallback: 1000 Hz Normalized coordinate: relative to this file's minimum and maximum

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.

normalized = (value - file_min) / (file_max - file_min)

If a feature is constant across the entire file, every frame receives 0.5 for that dimension.

A normalized Stability value of 1 does not mean “perfect periodicity.” It means the highest Harmonicity value found in the current file.

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.

distance = sqrt( ΔEnergy² + ΔStability² + ΔBrightness² )

The algorithm then alternates between assigning every frame to the nearest centroid and recomputing each non-empty centroid from its assigned frames.

SettingValue
Maximum iterations30
Convergence thresholdmaximum centroid shift < 0.001
Final assignmentOne authoritative reassignment pass using the final centroids
Because the first centroid is random and there is no Random_seed parameter, repeated runs are not guaranteed to produce identical cluster numbering or partitions.

Cluster Characterization and Labels

Each non-empty cluster is labeled from the mean of its normalized Energy, Stability, and Brightness coordinates.

DimensionConditionLabel
Energy> 0.66Loud
Energy< 0.33Quiet
EnergyotherwiseMid
Stability> 0.66Tonal
Stability< 0.33Noisy
Brightness> 0.66Bright
Brightness< 0.33Dark

Examples:

C1_Loud_Tonal_Bright
C2_Quiet_Noisy_Dark
C3_Mid
These are descriptive within-file heuristics, not classifiers. “Tonal,” for example, means that the cluster's normalized Stability centroid lies in the upper third of this file's observed range.

Cluster Transition Matrix

What does the transition matrix show?

The matrix describes transitions between cluster assignments of adjacent analysis frames in the original source.

P(next = j | current = i) = count(i -> j) / all outgoing transitions from i

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:

fragment_samples = round(Window_length × sample_rate) synthesis_hop = round(fragment_samples / 2)

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

PresetClustersWindowAnalysis Step
CustomUserUserUser
2 Clusters - Basic Split260 ms30 ms
3 Clusters - Detailed350 ms25 ms
4 Clusters - Fine Analysis440 ms20 ms
5 Clusters - Very Fine535 ms18 ms

Form Fields

ParameterDefaultBehavior
Window_length_ms50Duration of each analysis/source fragment.
Step_size_ms25Hop between successive analysis windows.
Number_of_clusters3Validated to 2–8.
Overlap_time_ms5Deprecated and ignored; retained for argument compatibility.
Scale_peak0.95Target peak for every generated montage; must be >0 and ≤1.
Draw_visualizationOnDraw the 3D feature space, transition matrix, montage waveforms, legend, and summary.
Play_resultOnPlay 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:

Cluster outputs should not be interpreted as isolated sources, cleaned speech, or production stems unless the source material happens to separate clearly in these three features.
```