NewsWorksSoftwareTextBioContact
background image

Real-time display of audio waveform

August 11, 2004

Just made a simple Max utility for displaying audio waveforms in realtime. It could proberbly be implemented in a more clever and flexible way using JavaScript and the jsgui object but this bpatcher solution using two mutlisliders will do for the time being.

The source code is below.

Save as tl.rtwave~:

max v2
#N vpatcher 14 59 666 484
#P window setfont “Sans Serif” 9.000
#P comment 311 83 179 196617 use as bpatcher
#P inlet 275 12 15 0
#P inlet 223 12 15 0
#P newex 223 69 33 196617 * -1.000
#P newex 223 42 62 196617 peakamp~ 5
#P user multiSlider 0 24 200 25 -1.000 0.000 1 3449 16 0 0 2 0
#M frgb 0 0 0
#M brgb 165 139 224
#M rgb2 127 127 127
#M rgb3 0 0 0
#M rgb4 37 52 91
#M rgb5 74 105 182
#M rgb6 112 158 18
#M rgb7 149 211 110
#M rgb8 187 9 201
#M rgb9 224 62 37
#M rgb10 7 114 128
#P user multiSlider 0 0 200 25 0.000 1.000 1 3449 16 0 0 2 0
#M frgb 0 0 0
#M brgb 165 139 224
#M rgb2 127 127 127
#M rgb3 0 0 0
#M rgb4 37 52 91
#M rgb5 74 105 182
#M rgb6 112 158 18
#M rgb7 149 211 110
#M rgb8 187 9 201
#M rgb9 224 62 37
#M rgb10 7 114 128
#P window setfont “Sans Serif” 12.000
#P comment 311 25 100 196620 tl.rtwave~
#P window setfont “Sans Serif” 9.000
#P comment 311 49 178 196617 simple real-time sound wave display using two multisliders
#P comment 311 105 128 196617 ©Trond Lossius , 2004
#P comment 34 88 100 196617 Dim: 200 × 50
#P hidden connect 6 0 4 0
#P hidden connect 7 0 5 0
#P connect 8 0 6 0
#P connect 6 0 7 0
#P connect 9 0 6 1
#P pop

Save as tl.rtwave~ .help:

max v2
#N vpatcher 14 59 406 445
#P window setfont “Sans Serif” 9.000
#P hidden newex 266 120 59 196617 loadmess 5
#P number 266 148 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0
#P comment 33 92 226 196617 Right inlet: update rate (ms) (default: 5 ms)
#P comment 33 113 179 196617 Use as bpatcher (dim: 200 × 50)
#P window setfont “Sans Serif” 12.000
#P comment 33 31 100 196620 tl.rtwave~
#P window setfont “Sans Serif” 9.000
#P comment 33 55 314 196617 Simple real-time sound wave display using two multisliders
#P comment 33 338 128 196617 ©Trond Lossius , 2004
#P message 173 271 27 196617 stop
#P message 105 271 65 196617 startwindow
#P newex 58 296 30 196617 dac~
#P message 93 148 49 196617 1 , loop 1
#P message 58 148 29 196617 open
#N sfplay~ 1 120960 0
#P newobj 58 172 43 196617 sfplay~
#P bpatcher 76 203 200 50 0 0 tl.rtwave~ 0
#P comment 33 77 109 196617 Left inlet: audio signal
#P connect 3 0 2 0
#P fasten 4 0 2 0 98 167 63 167
#P connect 2 0 5 0
#P fasten 7 0 5 0 178 291 63 291
#P fasten 6 0 5 0 110 291 63 291
#P connect 2 0 1 0
#P fasten 2 0 5 1 63 283 83 283
#P hidden connect 14 0 13 0
#P connect 13 0 1 1
#P pop