Digital Music Programming II: Henon MapThis lab demonstrates a Max external object which outputs a fractal sequence of MIDI note numbers. There are two integer inputs into the object, plus a bang input, making the interface to the object similar to the diff example object presented in the last class. Here are the functions of each input into the henon object:
Here is a picture of what the final object will look like in Max:
The output from the object will be a sequence of numbers from 0-127 which can be used as MIDI note numbers, or for any other purpose. The following equation is the difference equation for the Henon map: y[n] = a * y[n-1]^2 + b * y[n-2] + 1Or in English: The current output is equal to alpha times the previous output squared PLUS beta times the previous-previous output from the sequence PLUS one. The significance of this equation was discovered in the 1960's and 1970's by French astronomer Michel Henon in work he had done on calculating the orbits of stars in globular clusters. Here is sample output from the henon external object which maps output from the Henon map equation into the range from 0 to 127: 0 27 94 104 86 114 64 126 29 98 99 96 101 92 107 81 119 51 122 41 64 126 29 98 99 96 101 92 106 81 119 52 123 40 112 68 126 31 100 94 87 113 65 126 30 98 98 97 100 94 103 88 112 69 126 32 102 92 107 80 48 121 46 119 51 122 42 115 62 126 29 98 99 96 100 94 104 86 114 63 29 98 99 96 101 92 106 81 119 52 123 39 112 69 126 32 102 92 107 80 49 121 45 118 53 124 38 110 74 124 37 109 76 123 40 113 67 126 30 99 101 92 107 80 119 50 122 44 117 57 125 33 103 89 110 73 124 36 108 79 120 47 120 49 121 45 118 55 125 35 106 82 118 54 124 36 108 78 121 44 117 56 125 34 104 86 114 64 126 29 98 99 96 101 92 107 81 119 51 122 115 63 126 29 98 99 96 101 93 105 83 117 56 125 33 104 87 113 66 126 98 97 98 97 100 94 103 88 112 68 126 31 100 94 104 87 113 66 126 30 98 98 97 99 96 100 94 104 86 114 65 126 29 98 99 96 100 94 104 86 The henon object is designed to receive a steady pulse of bang messages. To generate an interesting rhythm, the henon object has control over the minimum and maximum note which will be output. If a number in the above sequence falls outside of the range from 21 to 107, the output will be suppressed. This can generate interesting rhythmic patterns, since some of the notes in the sequence will be removed which lengthens the duration of other notes. Here is the output from the henon object showing the suppressed values in green: 0 27 94 104 86 114 64 126 29 98 99 96 101 92 107 81 119 51 122 41 64 126 29 98 99 96 101 92 106 81 119 52 123 40 112 68 126 31 100 94 87 113 65 126 30 98 98 97 100 94 103 88 112 69 126 32 102 92 107 80 48 121 46 119 51 122 42 115 62 126 29 98 99 96 100 94 104 86 114 63 29 98 99 96 101 92 106 81 119 52 123 39 112 69 126 32 102 92 107 80 49 121 45 118 53 124 38 110 74 124 37 109 76 123 40 113 67 126 30 99 101 92 107 80 119 50 122 44 117 57 125 33 103 89 110 73 124 36 108 79 120 47 120 49 121 45 118 55 125 35 106 82 118 54 124 36 108 78 121 44 117 56 125 34 104 86 114 64 126 29 98 99 96 101 92 107 81 119 51 122 115 63 126 29 98 99 96 101 93 105 83 117 56 125 33 104 87 113 66 126 98 97 98 97 100 94 103 88 112 68 126 31 100 94 104 87 113 66 126 30 98 98 97 99 96 100 94 104 86 114 65 126 29 98 99 96 100 94 104 86 Source Code for the Henon External ObjectThere are four general sections to the source code for the henon object which are given different colors:
Parameter SpaceThe following picture visualizes the periodic behavior of the generated sequence. Each color represents a different number of notes into which the sequence settles down into (after 10,000 notes have been generated). Black regions either decay to one note, or they go off to infinity. White regions continue to generate non-repeating sequences, even after 10,000 notes. Other colors generate repetitive patterns of notes depending on legend on the right of the picture. For example, the color red indicates the sequence decays to a cycle of two notes.
Further Reading
ExercisesEveryone must do exercise 1. Then, pick one of the other exercises to do as well. Do more than one other exercise for extra credit.
|