Beruflich Dokumente
Kultur Dokumente
TODAY
List operations
Text-to-MIDI converter!
midiinfo umenu
umenu outputs selected item number out leftmost outlet, and the chosen item
text out middle outlet
Will mostly use 2nd outlet of the umenu, the chosen device name
NB: always good to provide both a loadbang, and a refresh MIDI devices
textbutton, so that MIDI devices can be added arbitrarily
Raw MIDI data includes note ons, note offs, controller data, timing/sync
data, etc.
Max is bundled with helper objects to make MIDI easier to deal with
PITCH (as a MIDI note number from 0 to 127 use mtof to convert to
MIDI CHANNEL (that tells you which MIDI instrument sent the message)
ctlin is like notein, but only for controller information (e.g. an external MIDI
controller)
Outputs
CONTROLLER NUMBER
How could we use the controller number to route the controller value?
How could we use the controller number to route the controller value?
PRO TIP: The sprintf object is great because it does true string
concatenation, which append and prepend dont (they append a list item)
10
MIDI SYNTH
11
TEXT-TO-MIDI CONVERTER
TEXT-TO-MIDI CONVERTER
13
Lets the user enter (or copy and paste) some text into a text box
Any letter used (e.g. az) will be mapped to a MIDI pitch, based on a sevennote scale covering almost 4 octaves (7 x 4 = 28, two more than the number
of letters in the alphabet)
TEXT ENTRY
15
textedit
Attributes:
Outlets:
1. Text output (as list prepended by text)
2. ASCII value of character typed
3. word/character clicked on
4. textchanged message output when text is changed
16
17
ASCII is arranged in
blocks of 32
ASCII BASICS
BLOCK 1
(non-printing)
BLOCK 2
(punctuation + numbers)
BLOCK 3
(uppercase letters)
BLOCK 4
(lowercase letters)
032
32
SPACE character
3347
4857
NUMBERS (09)
5864
6590
9196
97122
123127
18
Now were going to have a counter that will move through the list of ASCII
codes, pick one out, and convert it into a MIDI note
NB: the counter assumes no text to begin with how will we update it
when text is entered?
19
LIST OPERATIONS
LIST OPERATIONS
The zl object lets you create, parse and transform lists in multiple ways
21
zl.join
zl.len
zl.nth
zl.rev
REVERSES a list
zl.rot
ROTATES a list
zl.sort
SORTS a list
zl.sub
zl.sum
SUMS a list
22
LIST OPERATIONS
zl example
23
LIST OPERATIONS
24
number t b i
zl.sub t b i
This patch will watch for a match to any of the ints in the message box,
then output a new number from the corresponding list in zl.nth
LIST OPERATIONS
25
To get length of our textedit list, we use zl.len rightmost inlet of counter
NB: unfortunately zl.mth hot/cold inlets are slightly the wrong way
around text changes in leftmost inlet will immediately output, but we
only want to output when the counter changes, not the text
atoi will only store text sent into rightmost inlet, not output a bang
in leftmost inlet will then output