Knight's Tour Sonification — User Guide
Maps a validated 64-square knight's tour onto two audio controls: board X position controls constant-power stereo panning, and board Y position controls segment amplitude.
What this does
The script selects one Sound, converts it to mono when the input has more than one channel, divides the duration into 64 equal time intervals, and processes the intervals in the order of a predefined knight's tour. Each board coordinate controls two values:
- X coordinate (1–8) → stereo position.
- Y coordinate (1–8) → intensity multiplier.
Each interval is amplitude-scaled, panned to stereo with a sine/cosine constant-power law, and concatenated with the other 63 processed intervals. The result is a new stereo Sound; the selected source remains unchanged.
Quick start
- In Praat, select exactly one Sound object.
- Run script… →
Knight's Tour Sonification.praat. - Choose one of the five Tour_preset paths.
- Choose an Effect_preset. Use Custom if you want the four range fields to control the mapping directly.
- Choose a Visualization_mode.
- Set Play_result as desired and run the script.
Tour presets
Every preset is a complete 64-square knight's tour. The v0.4 integrity check verifies this again at runtime before mappings are calculated.
| Preset | Stored name | Start | End | Notes |
|---|---|---|---|---|
| Warnsdorff (Classic) | Warnsdorff | (1,1) | (3,2) | Fixed validated tour. Its end square is a legal knight move from its start, so this stored path is also closed. |
| Spiral-biased Tour | Spiral-biased | (4,4) | (4,3) | Fixed validated tour with a center-originating bias in its stored ordering. |
| Diagonal-biased Tour | Diagonal-biased | (1,1) | (5,6) | Fixed validated tour labelled for its intended diagonal character. |
| Center-start Tour | Center-start | (4,4) | (3,8) | Fixed validated tour beginning near the board centre. |
| Side-switching Tour | Side-switching | (1,1) | (7,4) | Fixed validated tour labelled for frequent lateral changes in its stored ordering. |
Runtime integrity test
For steps 1–64, the script checks that X and Y are each within 1…8, converts each coordinate pair to a unique square index, rejects repeated squares, and verifies each transition with |Δx|,|Δy| = (1,2) or (2,1).
Effect presets
Any effect preset other than Custom overwrites the four range fields before processing. The resulting endpoints are then clamped to 0…1 and ordered so the lower endpoint comes first.
| Effect preset | Intensity range | Stereo range | Stored name |
|---|---|---|---|
| Custom | Uses form values (defaults 0.30–1.00) | Uses form values (defaults 0.00–1.00) | custom |
| Full Range (dramatic) | 0.20–1.00 | 0.00–1.00 | full_range |
| Subtle Movement | 0.70–1.00 | 0.30–0.70 | subtle |
| Center Focused | 0.50–1.00 | 0.35–0.65 | center |
| Left-Heavy | 0.40–1.00 | 0.00–0.50 | left |
| Right-Heavy | 0.40–1.00 | 0.50–1.00 | right |
| Intensity Only (no pan) | 0.20–1.00 | 0.50–0.50 | intensity_only |
| Pan Only (no intensity) | 1.00–1.00 | 0.00–1.00 | pan_only |
Audio mapping
Board coordinates → control values
Intensity
The extracted mono segment is multiplied directly by intensity[k]. Because the allowed range is clamped to 0…1, the mapping can attenuate or leave a segment unchanged; it does not boost it above the source amplitude.
Constant-power stereo panning
The intensity multiplication happens before panning. The two panning gains therefore distribute the already-scaled mono segment between the output channels.
Processing pipeline
- Require exactly one selected Sound.
- Clamp and order the four Custom range endpoints; non-Custom effect presets first replace those values with their preset settings.
- If the selected Sound has more than one channel, use Praat's Convert to mono command to create a temporary mono working object.
- Load the selected fixed 64-square tour and run the tour-integrity checks.
- Calculate 64 equal time intervals and the X→stereo / Y→intensity mappings.
- For each interval, extract a rectangular segment with no crossfade, multiply it by the mapped intensity, create left/right copies, and apply the constant-power gains.
- Combine each pair into a stereo segment.
- Concatenate all 64 stereo segments in tour order.
- Remove temporary segment objects and any temporary mono conversion.
- Optionally draw the final visualization and play the final result.
Visualization
The form provides four modes:
| Mode | During processing | Final drawing | Audio during steps |
|---|---|---|---|
| Off (fastest processing) | No drawing | No | No |
| Final only | No drawing | Yes | No |
| Real-time (visual only) | Redraw after each step; pause by Visualization_delay | Yes | No |
| Step-by-step with audio (original) | Redraw after each step | Yes | Each processed stereo segment is played |
sleep is used only for Real-time (visual only). In Step-by-step with audio mode the segment playback itself provides the pacing, so the script does not add the visualization-delay sleep.
Figure contents
- Left panel — chessboard: checkerboard, completed path, numbered visited squares, green start marker, red current marker during processing, and blue end marker in the final display.
- Right panel — parameter curves: stereo position in red and intensity in blue against time, with shaded regions corresponding to the selected parameter ranges.
- Status band: current step and X/Y/stereo/intensity values during processing; source name, tour, duration, ranges, and “64-square tour” in the final display.
The visualization describes the control trajectory; it is not an audio waveform display.
Parameter reference
| Parameter | Type | Default | Implemented behaviour |
|---|---|---|---|
| Tour_preset | optionmenu | Warnsdorff (Classic) | Selects one of five fixed validated 64-square tours. |
| Effect_preset | optionmenu | Custom | Custom uses the four range fields; every other choice overwrites them with preset values. |
| Intensity_min | real | 0.3 | Custom lower intensity endpoint. Clamped to 0…1. |
| Intensity_max | real | 1.0 | Custom upper intensity endpoint. Clamped to 0…1. Endpoints are swapped if entered in reverse order. |
| Stereo_min | real | 0.0 | Custom lower pan endpoint. 0=left, 0.5=center, 1=right. Clamped to 0…1. |
| Stereo_max | real | 1.0 | Custom upper pan endpoint. Clamped to 0…1. Endpoints are swapped if entered in reverse order. |
| Visualization_mode | optionmenu | Step-by-step with audio | Off, Final only, Real-time visual only, or Step-by-step with audio. |
| Visualization_delay_(s) | positive | 0.03 | Pause between redraws in Real-time visual-only mode. Not added in the audio-step mode. |
| Play_result | boolean | yes | Plays the complete concatenated result after processing. |
Technical notes and edge cases
Input channel handling
The script accepts exactly one selected Sound. A mono Sound is processed directly. Any Sound with more than one channel is converted to mono before segmentation, so the original multichannel image is not retained.
Output
The output is stereo and is renamed source_KnightsTour_TourName, for example source_KnightsTour_Warnsdorff. The source object remains in Praat.
Range handling
Custom intensity and stereo endpoints are each clamped independently to 0…1, then swapped when necessary. This prevents out-of-range panning angles or intensity multipliers.
Timing
The source duration is divided mathematically by 64. Segment extraction occurs on Praat's sample grid, so the implementation should be understood as 64 equal requested time intervals rather than a separate resampling process.
Further Reading
- Knight's-tour and chessboard mathematics: Watkins, J. J. (2004). Across the Board: The Mathematics of Chessboard Problems. Princeton University Press.
- Computer music and algorithmic composition: Roads, C. (1996). The Computer Music Tutorial. MIT Press.
- Stereo and spatial-audio principles: Rumsey, F. (2001). Spatial Audio. Focal Press.
- Graph-theory background: West, D. B. (2001). Introduction to Graph Theory, 2nd ed. Prentice Hall.