Forums > MaxMSP

Getting sync~ (run by phasor~) to send start

June 15, 2006 | 9:19 pm

In trying to overcome the problems of midi sync timing on OSX, I’ve written a mini patch that receives the output from a phasor~ on another computer via SPDIF and converts that to midi sync. Naturally enough, I’m using sync~.

phasor~ > dac~ > spdif > adc~ > sync~.

The point of this, is that the first computer is pretty busy being a synth, and the midi beat clock it puts out is very unreliable (especially in front of audiences). The second computer is being a drum sequencer, and has plenty of time for generating midi notes and beat clock signals.

It would be rather neat, if it only worked. But of course, I have no start/stop messages going into sync~, and so none coming out. The sequencing software is getting midi sync, and is champing at the bit, waiting for the starting pistol…

I thought aboput using the other spdif channel to carry a signal of 0 or 1, and using edge~, which, however, only sends it output once per IO vector. If I understand it correctly.

Any ideas ?


June 15, 2006 | 10:06 pm

I’ll start again.

You can’t run a sync~ with a phasor~. Don’t know why I thought you could.

So the question would then be: Is there a way of producing reliable midi beat clock (that is, a succession of integer 248 messages)from an audio ramp signal that has been produced by a phasor~ or sync~ ?


June 16, 2006 | 8:31 pm

Midi? (just for start, stop and alike…)

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


June 17, 2006 | 10:01 am

there use to be a patch in examples folder to create a midi clock from MSP. dunno if its still there since sync~ came along…

anyway i remember it being something like:

phasor~ (ramp time = 1 bar @ bpm)
*~ 96 (24 tics per quarter note)
pong~ 1 0. 1.
change~
==~ -1.
edge~
int 248 (MIDI timestamp)

the send start + stop message when needed.

j


June 17, 2006 | 11:06 am

Quote: grimshaw@grimshaw.de wrote on Thu, 15 June 2006 16:06
—————————————————-
> I’ll start again.
>
> You can’t run a sync~ with a phasor~. Don’t know why I thought you could.
>
> So the question would then be: Is there a way of producing reliable midi beat clock (that is, a succession of integer 248 messages)from an audio ramp signal that has been produced by a phasor~ or sync~ ?
—————————————————-

an audio signal itself aready has a "timecode" – its
sampling rate.

so connecting 2 computers via digital audio IOs alsready
"syncs" them in a way.

in another context (software2software communication)
i have been making my own sync protocol by using a
signal of 0, 1, 2, 3 … where the numbers stand for
bar, beat, event on, event off …

use sig~ or click~

max v2;
#N vpatcher 464 252 1420 932;
#P user scope~ 567 222 697 352 64 3 16 -10. 10. 0 0. 0 0. 102 255 51 135 135 135 0;
#P newex 605 155 52 196617 sig~;
#B color 5;
#P flonum 318 29 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 114 147 105 196617 sel 1 2 3 4;
#P newex 215 98 105 196617 counter 1 4;
#P message 307 195 74 196617 set 0.4 , bang;
#P message 227 195 74 196617 set 0.3 , bang;
#P message 149 195 74 196617 set 0.2 , bang;
#P message 71 195 74 196617 set 0.1 , bang;
#P message 27 40 31 196626 1;
#B color 15;
#P newex 202 69 105 196617 metro 250;
#P newex 170 240 52 196617 click~;
#B color 5;
#P user ezdac~ 41 292 85 325 0;
#P connect 3 0 0 0;
#P connect 1 0 0 0;
#P connect 9 0 4 0;
#P connect 1 0 0 1;
#P connect 8 0 9 0;
#P connect 9 1 5 0;
#P connect 4 0 1 0;
#P connect 5 0 1 0;
#P connect 6 0 1 0;
#P connect 7 0 1 0;
#P connect 3 0 2 0;
#P connect 2 0 8 0;
#P connect 9 2 6 0;
#P connect 10 0 2 1;
#P connect 9 3 7 0;
#P connect 11 0 12 0;
#P connect 8 0 11 0;
#P pop;


June 20, 2006 | 12:15 am

The problem with this patch, in the original context at least, is that it relies on a metro, which under OSX is unreliable. It is this unreliability that prompted me to try audio signals as sync.

My computer is under some strain, the timing of all midi stuff is extremely dodgy, but there’s too much of it to bump it up into the high priority thread.

The signal gets sent via spdif to a second computer, one that has a lot less to do. If it were to use only my software, then I would indeed already have my sync. But the man needs midi notes to be sent out to his sound thingy.It makes more sense to do the midi sync on his computer than mine.

So what I’m looking for is the best way to turn an audio rate signal (pulse or whatever) into midi sync. Is there a better way than edge~ (or one of its relations) ?


June 20, 2006 | 6:09 am

Stuart,

I don’t know if this patch will help, but it does set an audio rate
sync dependent on metronome settings fed to a phasor–but I imagine
that’s what your’e already doing. Is the problem how to supply the
actual MIDI clocks–outputting system real time messages? Or would a
seq object do the trick?

Anyhow, this relies on edge~ for the final output.

– Paul

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 239 54 26 196617 120;
#P hidden newex 226 28 62 196617 loadbang;
#P comment 103 69 99 196617 beat duration ms.;
#P flonum 54 69 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 54 46 114 196617 expr 60. / $f1 * 1000;
#P newex 54 91 34 196617 / 24.;
#P number 54 25 78 9 20 320 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 176 306 46 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 66 306 46 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P comment 205 181 97 196617 duration values update at the end of
previous cycle;
#P window linecount 1;
#P comment 125 164 60 196617 update now;
#P button 120 177 15 0;
#P toggle 15 187 15 0;
#P newex 15 201 35 196617 mute~;
#P toggle 186 177 15 0;
#P flonum 116 276 58 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 116 255 34 196617 timer;
#P button 116 228 15 0;
#N vpatcher 625 516 1059 868;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 100 63 48 196617 !/ 1000.;
#P comment 126 48 59 196617 update;
#P comment 126 37 59 196617 immediate;
#P comment 203 305 65 196617 bang out;
#P comment 126 25 48 196617 bang for;
#N comlet bang for immediate update;
#P inlet 175 25 15 0;
#P window linecount 0;
#P newex 187 277 34 196617 t b b;
#P newex 100 111 49 196617 v bw321;
#P newex 100 133 64 196617 change 0.;
#N comlet signal (phasor~);
#P outlet 89 303 15 0;
#N comlet gate on/off;
#P inlet 194 25 15 0;
#N comlet bang if gate open;
#P outlet 187 303 15 0;
#N comlet duration (ms);
#P inlet 100 25 15 0;
#P newex 100 230 35 196617 pass~;
#P flonum 100 85 56 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 100 188 35 196617 delta~;
#P newex 100 209 31 196617 < ~ 0.;
#P newex 100 251 35 196617 edge~;
#P newex 100 158 63 196617 phasor~ 1.;
#P toggle 137 277 15 0;
#P objectname toggle;
#P newex 153 277 27 196617 gate;
#P comment 53 25 47 196617 duration;
#P comment 210 25 64 196617 right outlet gate on/off;
#P comment 105 305 65 196617 phasor~ out;
#P comment 62 87 36 196617 freq;
#P fasten 6 0 15 0 105 181 94 181;
#P connect 12 0 24 0;
#P connect 24 0 10 0;
#P fasten 19 0 17 0 180 105 105 105;
#P fasten 18 1 17 0 216 298 224 298 224 105 105 105;
#P connect 10 0 17 0;
#P connect 17 0 16 0;
#P connect 16 0 6 0;
#P fasten 6 0 9 0 105 181 105 181;
#P connect 9 0 8 0;
#P connect 8 0 11 0;
#P connect 11 0 7 0;
#P fasten 14 0 5 0 199 184 142 240;
#P hidden connect 5 0 4 0;
#P fasten 7 0 4 1 105 272 175 272;
#P fasten 4 0 18 0 158 298 183 298 183 272 192 272;
#P connect 18 0 13 0;
#P pop;
#P newobj 54 201 142 196617 p sync2;
#P user scope~ 54 326 186 414 16 3 128 -1. 1. 0 0. 0 0. 102 255 51 135
135 135 0;
#P flonum 54 177 58 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 305 355 27 196617 stop;
#P message 267 336 65 196617 startwindow;
#P newex 267 378 30 196617 dac~;
#P user panel 246 329 112 72;
#X brgb 255 255 255;
#X frgb 55 199 76;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 2;
#P comment 61 152 52 196617 clock duration;
#P window linecount 1;
#P comment 189 164 60 196617 gate on/off;
#P comment 131 25 40 196617 MM.;
#P comment 91 92 100 196617 / clocks per beat;
#P window linecount 4;
#P comment 251 263 100 196617 Open the gate on right inlet or bang on
middle inlet to update frequency.;
#P fasten 8 0 6 0 310 374 272 374;
#P connect 7 0 6 0;
#P hidden connect 28 0 15 0;
#P hidden connect 28 0 29 0;
#P fasten 15 0 11 2 191 196 191 196;
#P connect 22 0 10 1;
#P connect 12 0 13 0;
#P connect 12 0 13 1;
#P fasten 18 0 11 1 125 196 125 196;
#P connect 13 0 14 0;
#P fasten 11 1 12 0 191 221 121 221;
#P connect 21 0 10 0;
#P connect 11 0 10 0;
#P connect 9 0 11 0;
#P connect 16 0 11 0;
#P connect 24 0 9 0;
#P connect 26 0 24 0;
#P connect 25 0 26 0;
#P connect 23 0 25 0;
#P hidden connect 29 0 23 0;
#P connect 17 0 16 0;
#P window clipboard copycount 30;


—– |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| —–


June 20, 2006 | 8:51 am

You could try Shigeto Wada’s divider~ object which is
at
http://www.geocities.com/maxmsp/
cheers
Roger


Viewing 8 posts - 1 through 8 (of 8 total)