Tasker includes basic support for interacting with a (single) musical instrument which support the MIDI protocol.
You don't need to know anything about MIDI in order to play complex tunes on an instrument via Tasker.
The Android ROM on the Android device must support the USB Host protocol.
A USB OTG (On The Go) adapter is required for the Android device.
If the MIDI device has a USB-To-Host connecter, a normal USB lead can then be used from the OTG adapter to the MIDI device.
If the MIDI device has only MIDI inputs, a USB-To-MIDI adapter must be used from the OTG adapter to the MIDI device.
When a connection has been established with the MIDI device, Android should ask whether permission should be granted to Tasker to use the device. In order to make things easier and allow automation without user-interaction, it's recommended that Always be selected.
The Score parameter in the MIDI Play action uses a Tasker-specific format to hopefully allow even non-musicians to easily 'code' some music.
D . . C
D!10 !100,C C C
C2 C3 C4
@1 C C C
C, C#, D, D#, E, F, F#, G, G#, A, A#, B. These represent the notes starting at middle C on a piano, which are in the 4th octave. Flat notes are also possible e.g.
Deeper notes can be achieved
by specifying a lower octave e.g.
A#3 and higher notes a higher octave
For convenience, lower case versions of the notes are an octave
deeper than the upper case versions e.g.
c is equivalent
Other locales may have different note naming conventions.
*indicates the note should be held longer e.g.
C*6holds a C for 6 beats. A
/indicates the note should be shorter e.g.
C/2indicates that the note should be played for half a beat.
!6means 'play this note with velocity 6'.
The lowest value is 0 and the highest 127.
C@1'play a C using voice 1'.
The voice can be from 0 to 127.
Most MIDI instruments don't have more than 128 voices and so you probably don't need to read any further in this section.
However, if your instrument has more voices you will probably need to specify them using the values MSB and/or LSB which you will need to find in the instrument's user manual.
Tasker allows specificaton of LSB and Program
(the name of the basic parameter) together e.g:
specifies LSB 3 and Program 1.
To specify an MSB also, add it on the left e.g.
specifies MSB 6, LSB 5 and Program 3.
CDboth play a C and a D.
A channel consists of a set of beats separated by whitespace which are dealt with one-by-one at the same time as the corresponding beats on other channels. In that way, it's possible to see which notes are going to be played simultaneously.
Beats usually consist purely of a few notes, but they can also specify default values of velocity and voice for the channel.
!10,C D E!100 F will play a quiet C,
a quiet D, a loud E then a quiet F.
@2 C D E@3 F plays a C then a D in voice 2, an E in voice 3, then an F in voice 2 again.
When you reach the end of a line with a channel, do not go
further on the next line. If you do so, the next line will be treated
as a new channel. Instead, leave a blank line.
See the last two examples above.
A dash character
- as the whole beat means 'do nothing this beat'.
A dash followed by a number will rest for that number of beats. This will mess up the channel alignment, but can be useful for channel which isn't used very often.
|characters so they do not count as a beat.
The remainder of a line can be ignored by inserting a single quotation character '. The line before the quotation mark, and subsequent lines, are unaffected.
The rest of a whole channel can be ignored by inserting a double quotation mark ". The line before the quotation marks are unaffected.
Comments can be useful for testing specific parts of a score independently.
Score parameter supports variable just like most other
places in Tasker.
That means you can e.g. specify a voice specification
with Variable Set and then use the name to make it easier to read
the music e.g.
@%piano,C @%guitar,D (play a C
with piano then a D with guitar: assuming you've first set
the variables to a voice which matches their name on your
You can also define variables with sequences of notes and then
define a song as being repeating names e.g.
%intro %verse %chorus %verse %end.
For, %loudness, 20:100:20 For, %voice, 1:10 MIDI Play, @%voice,!%loudness C,E,G