MIDI/Peer control value fields use a text based system to determine their output values. It's worth reading this bit.
In general, modes can't be mixed but modifiers can. The order that modifiers are specified does not dictate the order in which they are processed.
For MIDI Events, the order of processing is Value > AND > OR > Bounds. For Peer Events, the order is: Value > Bounds > AND > OR. This is because AND destroys negative values, breaking the Peer clamp/wrap/ping-pong functions.
Magic will prevent you from typing invalid characters into the field but will not stop you from entering invalid combinations of valid characters. Invalid values are shown in red text, making it obvious when something is wrong.
Magic 1.17 allows Peer/MIDI values to contain a comma separated sequence of values, with each triggering of the Event advancing the sequence. Value sequences can run in forwards, backwards, ping-pong or random modes, which can be set from the value field context menu.
These tokens control how Magic interprets values. When a value type specifier is found, all following values are assumed to be of the same type until another type specifier is found. Note that the Decimal specifier = is assumed (except in bitwise modifiers) until an explicit type specifier is encountered, so = is only needed if you want to revert to decimal after using another type.
Value type effects persist across multiple values, so "%1, 2, 3, 4" is seen as "%1, %2, %3, %4",
Token | Example | Value mode |
= | =127 | Decimal value. Numeric values are assumed to be decimal unless another type specifier has been found, so you only need this if you want to change back. |
x | x7F | Hexadecimal. Hexadecimal format is implied for bitmask values, so you can just type &F00 instead of &xF00. |
% | %50 | Percentage of specified value range (see "Value bounds modifier" below.) Decimal fractions are allowed eg. %12.5 |
%% | %%50 | Percentage of full parameter range. Decimal fractions are allowed. |
' | 'C5 |
Note name. Valid note values are C0 to B9. If no octave is specified the default octave is 4. There are two other note values: 'Pass and 'Off. 'Pass resolves to whichever note triggered the Event and 'Off is simply a note-off. Note values can be used for non-note parameters too, which might be useful in some situations (see below for an example.) |
Token | Function | Description |
Space | You can have spaces pretty much anywhere you like in a value and Magic will generally ignore them. | |
( ) | Braces |
Braces are optional but can sometimes useful to clarify the meaning of a value string. Usually you don't need them but for example "Rx4" could mean either "a random value from 0 to 4" or "a random value, four times". Magic will interpret it as the first option, so to specify the second you need write "(R)x4". Braces also limit persistent effects. In "R(%50), 99", the percentage only applies inside the braces so the 99 is just that, rather than 99%. Braces should always form matching pairs in each value ie. between commas. |
N | Nothing | Specifies that no value will be sent. Cannot be used with any other tokens except for 'repeat'. |
V | Velocity | Specifies that the value should be derived from the velocity used to trigger the event. Can be used in conjunction with relative modes. See value range and bounds below. |
VI or IV | Inverse Velocity | Same as velocity mode but values are inverted so that a low velocity is treated as high and vice-versa. |
R | Random | Generates a random value. Can be used in conjunction with both relative and range modes. 'R' will send the same random value to all tracks/channels. See below for examples and also Notes for more info on randomness. |
M or RM | Multi-Random | Same as Random mode but sends a different random value to each track/channel. |
P | Previous | Only available for Off values. Causes the parameter to be restored to the value it had before the Event was triggered. Cannot be used in conjunction with any other modes. Not available for parameters which are only visible in the pattern editor. |
: | Value bounds | Specifies that values should be constrained to within a given range. Can be used in two forms :20 (range is n-20 where n is the minimum value of the parameter) or :10-20 (range is 10-20). Values outside the range will be clamped to the low/high end of the range as appropriate. All value types are valid. |
& | Bitwise AND | Applies a bitwise AND mask to the value. Mask values are always in hexadecimal format. For example, the value R&0F will result in the mask 0x0F being applied to a randomly generated value. For more information on bitwise operations see wikipedia.org. If both AND and OR are present, AND is applied first. Note that the bitwise modifiers are applied last and can cause values outside of the specified range/bounds. |
| | Bitwise OR | Applies a bitwise OR mask to the value. Mask values are always in hexadecimal format. For example, the value R|0100 will result in the mask 0x0100 being applied to a randomly generated value. For more information on bitwise operations see wikipedia.org. If both AND and OR are present, AND is applied first. Note that the bitwise modifiers are applied last and can cause values outside of the specified range/bounds. |
Peer Only | ||
+ | Relative Add | Causes the value to be added to the parameter's current value until it reaches the upper limit of the current range. Cannot follow the bounds definition. Not available for parameters which are only visible in the pattern editor. |
- | Relative Subtract | Causes the value to be subtracted from the parameter's current value until it reaches the lower limit of the current range. Cannot follow the bounds definition. Not available for parameters which are only visible in the pattern editor. |
w or w! | Relative Wrap modifier |
Used with the relative modes. Specifies that when the upper/lower boundary of the value range is reached, the value sequence will be resumed at the opposite end of the range. For example a value of +1w for a parameter with the value range 1-3 will result in the sequence 1, 2, 3, 1, 2, 3, 1 etc. If followed by the ! character, value overshoot will be ignored. If not, overshoot will be included in the modified value. eg. if range is 1-5 a value of 6 overshoots by one, so w will add the overshoot giving 2 while w! will ignore it and give 1. Note that the wrap switch cannot preceed the relative mode symbol. Ping-pong and wrap are mutually exclusive. |
p or p! | Relative Ping-pong modifier |
Used with the relative modes. Specifies that when the upper/lower boundary of the value range is reached, the relative mode polarity be reversed. For example a value of +1p for a parameter with the value range 1-3 will result in the sequence 1, 2, 3, 2, 1, 2, 3 etc. If followed by the ! character, value overshoot will be ignored. If not, overshoot will be included in the modified value. eg. if range is 1-5 a value of 6 overshoots by one, so p will subtract the overshoot giving 4 while p! will ignore it and give 5. Note that the ping-pong switch cannot preceed the relative mode symbol. Ping-pong and wrap are mutually exclusive. |
x | Repeat value |
To use the same value multiple times, instead of "1,1,1,1,2" you can write "1x4,2". Repeats must be specified after the value. You need to use braces around velocity and random tokens, so that the repeat is not interpreted as a hexadecimal range eg. "(R)x4, 5" |
Relative values and those generated by the Velocity and Random functions can be restricted to a certain range, allowing for example modulation of a filter cutoff while keeping it within an ideal range where it sounds best.
Further restriction can be applied using the "bounds" feature. Normally the bounds would be the whole of a parameter range but you could for example restrict values to within the top 50% of the range. If bounds are specified, percentage values produce a percentage relative to the bounds, unless you explicitly use the %% operator (percentage of full range.)
I know, it's complicated. Just be glad you didn't have to code it. 'Some examples might help to clarify things a bit...
Example | Explanation |
R10 or R(10) | Generate a random value from n-10 where n is the minimum value for the target parameter. You can enclose the range in braces if you want but it's optional. |
R10-20 | Generate a random value from 10-20. R followed by a value range will generate numbers from within that range. |
R:10-20 or R:(10-20) | Generate a random value from 10-20. Although the result is the same as above, the method is different. Here R doesn't have its own range so it uses the full range of the value bounds, in this case 10-20. Again, braces are optional. |
R%10:50-100 | Generate a random value from ten percent of the bounds. The bounds are interpreted as 50%-100% because the percentage specifier persists. If the target parameter range was 0-1000, the bounds would be 500 to 1000 and the maximum random value would be 50 (10% of 500), so the output values would be between 500 and 550. |
R(%10):50-100 | Generate a random value from ten percent of the bounds. The bounds are interpreted as 50-100 because the effect of the percentage specifier is confined to the braces. The maximum random value would be 5 (10% of 50) and output values would be between 50 and 55. |
R%10:(50-100) | Same as above, generate a random value from ten percent of the bounds. In this case the bounds are interpreted as 50-100 because the braces block the effect of the earlier percentage specifier. Output values would be 50-55 as above. |
R%%100:40-60 | Generate a random value from the full parameter range and clamp the result to the bounds, 40-60 percent of the range. This will tend to produce more values at the boundary edges as many values will be generated outside the boundaries and will subsequently be clamped to the minimum/maximum values. If the target parameter range was 0-1000, output values would be from 400-600. |
V%50 | Map incoming velocity to fifty percent of the full parameter range. Velocity 1 will be the parameter minimum and velocity 127 will be the parameter maximum. |
V%50:=50-80 | Map incoming velocity to fifty percent of the bounds 50-80. The = sign in the bounds cancels the effect of the previous percentage specifier. The range is 30 (80 minus 50) and 50% of 30 is 15, therefore minimum velocity will output a value of 50 and maximum velocity will output 65. |
+V%10p:20-70 | Map incoming velocity to ten percent of the bounds %20-70, add it to the current value and ping-pong if necessary. The size of the bounds is 50% (70% minus 20%) so 10% of that will be 5%. So the target parameter will be incremented by up to 5% of the its range until it hits 70%, at which point it will decrease by 5% until it hits 20% and then it will switch direction again. |
R'C4-B6 |
Generate a random note value from C4-B6. Note parameters will simply output the note as you would expect but non-note parameters have more complex behaviour. Imagine a piano keyboard C0-B9 overlaid on the parameter slider. The output values will be in the range C4-B6 on that keyboard, if that makes sense. Does that make sense? |
V'C4-B6 | Map the incoming velocity to the note range C4-B6. Note parameters will play the note, minimum velocity outputting C4, maximum outputting B6. Non-note parameters will interpret the value as described above. |
+5:%50-80 | Add five to the current value, clamping the result to 50-80% of the parameter range. Without the ping-pong (p) or wrap (w) switches, the value will peak at 80% and stay there. If the parameter value is less than 50% when the Event first triggers, it will jump to 50%. |
+5:%50-80w | As above but now when the output hits 80% of the parameter range, it will wrap back to 50% and add the overshoot amount. |
+5:%50-80w! | As above but without overshoot. When the output exceeds 80% of the parameter range, it will wrap back to exactly 50%. |
+R%1:50-100 | Generate a random value from 0% to 1% of the bounds (1% of the bounds is 0.5% of the full range in this case) and add it to the current value. When the value reaches 100% it will stay there. |
R%%1+:50-100 | Generate a random value from 0% to 1% of the full parameter range and add it to the current value. If the parameter value is less than 50% it will jump to 50% on first triggering. |
If you wanted a sequence of relative values with the amount increasing each time, you would have to write something like "+1,+2,+3,+4,+5". For situations like that you can instead use the persistent versions of the relative symbols, so you only have to type the relative sign once. Using this method, the previous example becomes "++1,2,3,4,5" with all the values following the relative sign being regarded as relative.
A persistent token stays in effect until it is either cancelled or replaced by a different token. For example "++1,2,3,--4,5" will add the first three values then subtract the last two.
Persistent tokens can also be overridden by their non-persistent counterparts, which has an interesting effect with relative values. In the sequence "++10, 20, -30, 40" the first, second and fourth values are additive while the third is subtractive, so if the parameter started at zero, the output from twice round the sequence would be 10, 30, 0, 40, 50, 70, 40, 80. It gets even more interesting with ping-pong, as the persistent values share their direction while any temporary overrides have their own. Each relative token, whether persistent or temporary, can have its own setting for ping-pong/wrap behaviour.
These are the persistent tokens that are available:
Token | Description |
++ | Persistent add. As shown above, subsequent values will be added to the current value until the persistence is cancelled or overridden. |
-- | Persistent subract. Subsequent values will be subtracted from the current value until the persistence is cancelled or overridden. |
/+ | Cancel additive persistence. In the sequence "++1,2,/+3" 1 and 2 will be added to the parameter value but on the third triggering, the parameter will be set to exactly 3. |
/- | Cancel subtractive persistence. In the sequence "--1,2,/-3" 1 and 2 will be subtracted from the parameter value and on the third triggering, the parameter will be set to exactly 3. |
&& | Persistent AND mask. Subsequent values will have the same bitwise AND mask applied until the persistence is cancelled or overridden. |
|| | Persistent OR mask. Subsequent values will have the same bitwise OR mask applied until the persistence is cancelled or overridden. |
/& | Cancel persistent AND. |
/| | Cancel persistent OR. |
There are three different kinds of persistent transpose; One General transpose and two specific. The effects are cumulative, with the specific and general amounts being added together.
Note that persistent transpose and persistent add share the same symbol, but you can only use transpose after a note value ('C0 - 'B9 or 'Pass) and it doesn't make much sense to add a note to another so the two shouldn't clash.
Token | Description |
++ | General transpose up. All subsequent note output will be transposed up by the specified amount. The sequence "'C4++12, D, E,'Pass" will be seen as "C5, D5, E5, 'Pass+12" with all notes shifted up by an octave. |
-- | General transpose down. As above but down. |
+* |
Specific transpose up. This transposes either explicit note values or triggering notes, depending on context. In the sequence "'Pass+*12, C, 'Pass, E, 'Pass, 'G", only the triggering notes will be transposed, leaving the C, E and G unchanged. In the sequence "'Pass, C+*12, 'Pass, E, 'Pass, 'G", the C, E and G will be transposed while the triggering notes will be unchanged. |
-* | Specific transpose down. As above but down. |
// | Cancel general transpose. Applies to both transpose up and down. |
/* | Cancel specific transpose. End specific transpose of explicit or triggering notes, depending on context. |
Right-click a value field to bring up a context menu which contains the following options:
Item | Description |
Sequence mode | Sets the direction of travel for the value sequence. The default setting is forward (left to right). |
Value seed | Options to set the seed used by the random number generator when generating random values. See Notes for more about random things. |
Position seed | Options to set the seed used to determine which value to use when sequence mode is set to random. See Notes for more about random things. |