PMapSpec


maps the output of a stream from one range to another

the ranges are supplied in the form of ControlSpecs


PMapSpec( pattern, fromSpec,toSpec,autoMap=true)


fromSpec

the range that the pattern is expected to output

toSpec

the range that you would like to map to

autoMap(true,false)

this tests the pattern to discover what it is actually outputting.

it then maps from that range onto the toSpec.

the default is true


The gui also presents a range slider to manually adjust the output range mapping.


a = Pseq([0,0.05,0.1],inf);

m = PMapSpec(a, [0,1],\freq);


t = m.asStream


t.next

t.next

t.next




Since this maps onto the entire range of \freq (20,20000) and that might be a bit painful, you should suppply a spec that states the exact range you are interested in.


one way is the ControlSpec extension method -optimalRange


f = \freq.asSpec.optimalRange(0.3);


a ControlSpec(55.392718118943, 3495.0442327868, 'exp', 0, 440, " Hz")


This is 0.3 standardDeviation around the default value of 440.0

ControlSpecs with the default low/high at the minval/maxval will simply clip the optimal range to that.


a = Pseq([0,0.05,0.1],inf);

m = PMapSpec(a, [0,1],\freq.asSpec.optimalRange);


t = m.asStream


t.next

t.next

t.next


and if you wanted to quantize that to musical chromatic pitches:


l = m.cpsmidi.round(1.0).midicps


n = l.asStream


n.next

n.next

n.next