Sonification¶
mg_sonomotiongram ¶
mg_sonomotiongram(self, sonogram='vertical', n_fft=2048, sr=22050, n_iter=32, flip=True, normalize=True, target_name=None, overwrite=True)
Creates a sonomotiongram: a sonification of the video's motiongram.
The motiongram (a time–space image of where motion happens) is treated as a magnitude spectrogram — spatial position maps to frequency, motion intensity to amplitude — and converted back to audio with an inverse STFT (Griffin–Lim phase estimation). The result lets you hear the motion. Based on Jensenius, "Some video abstraction techniques for displaying body movement in analysis and performance" / sonomotiongrams (SMC 2013).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sonogram
|
str
|
Which motiongram to sonify: 'vertical' (motion across the vertical axis) or 'horizontal'. Defaults to 'vertical'. |
'vertical'
|
n_fft
|
int
|
FFT size; sets the number of frequency bins (n_fft//2+1) the motiongram rows are mapped onto. Defaults to 2048. |
2048
|
sr
|
int
|
Sample rate of the rendered audio. Defaults to 22050. |
22050
|
n_iter
|
int
|
Griffin–Lim iterations for phase estimation (higher = cleaner, slower). Defaults to 32. |
32
|
flip
|
bool
|
If True, map the top of the image to high frequencies (usually more intuitive). Defaults to True. |
True
|
normalize
|
bool
|
Normalise the rendered audio to peak 1.0. Defaults to True. |
True
|
target_name
|
str
|
Output audio filename. Defaults to None (input filename
with the suffix "sono |
None
|
overwrite
|
bool
|
Whether to allow overwriting or auto-increment the filename. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
MgAudio |
An MgAudio pointing to the rendered sonification (WAV). |
Source code in musicalgestures/_sonification.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |