5 var d= Document.allDocuments.choose.front,
6 b, c, i, j= 1, k= 1, m= 0, n= 0, o= 1, p= 1,
7 syn= {|j, k, b, c, a| SinOsc.ar(a, BPF.ar(Saw.ar([j, k], [b, c]), 200, 0.1))}.play;
9 i= d.string.size.div(2);
11 d.selectRange(i-j, k+j);
12 b= d.selectedText.first; c= d.selectedText.last;
13 if(b==$-, {o= o.neg; n= n+1}); j= j+o;
14 if(c==$-, {p= p.neg; m= m+1}); k= k+p;
15 if(j<=k.neg, {o= 1}); if(k<=j.neg, {p= 1});
16 if(m%4==0, {m= m+1; i= i+1});
17 if(n%4==0, {n= n+1; i= i-1});
18 if(j-i>=0, {j= i+k; i= (d.string.size-j).div(2); k= d.string.size; o= p.neg; p= -1});
19 if(k+i>=d.string.size, {k= (i-j).div(2); i= k; j= k; p= o.neg; o= -1});
20 syn.set(\j, j, \k, k, \b, b.ascii, \c, c.ascii, \a, j+k/d.string.size);