Digital Music Programming II: Homework 3
The echo object
You shall make a Max object which generates a set of echos whenever
you play a note on a MIDI keyboard connected to Max.
The object should have four inlets:
- MIDI key number
- MIDI key velocity
- duration between note-off and next note-on in echo pattern
- decay value for the amplitude of each note. (must be a float).
There are two outlets: the first is for the
output key numbers, and the second outlet is for the velocities that go
with the key number.
- Only one note echo is necessary at a time. Either ignore a new
input note while the old echo is dieing out, or cut the old echo
short and start echoing the new note instead.
- Output note durations should be the same as the input note durations.
- No stuck note-ons should be generated by the object.
- To calculate the input note durations, refer to the
- To schedule the next note in the echo, refer to the
- The decay of the amplitude will be using float data types.
Decay of 1.0 will mean that the echo notes will never stop
playing. A decay value of 0.0 will mean to never echo the note.
To calculate the next note attack velocity, do something
amplitude = decay * amplitude;
Then, when you are ready to send the attack velocity for the
next note, output the value like this:
- The decay parameter inlet should limit the decay range
between 0.0 and 0.99 (or so.) it should not be allowed
to exceed 1.0 (unless you really want that).
Here is the function call which will add the decay inlet:
- Instead of echoing the same note as the input note, have each
echo be 1/2-step higher, or 1/2-step lower, or some other melodic
- Add a "stop" message to your echo object to tell it to stop
outputing echo notes.
- Allow your object to echo notes polyphonically. In other words,
make your object keep track of several echoing notes at the same
time, so that you can play echoing chords, or fast melodies which
echos all of the notes in the main() function.
Email me the source code for your program when it is finished
and after you have compiled it and tested it in Max.