Integers to soundnote for midi generation

To generate a midi file given two lists of integers of equal length, one for the note pitch and one for the corresponding note duration (tempo), I'd like to use the built in Midi file generator, but am not sure how to proceed to map the integers to the soundnote "C#" etc, I would like to use an 88 note mapping like a piano, and perhaps 5 discrete note duration values. Thanks.

I saw this but it takes a sound note and gives a number, whereas I'd like to generate 88 soundnotes scaled linearly from my list of integers.

Getting MIDI SoundNote Pitches as Numeric Values

This is what I have so far, a 0.25second fixed note duration, and a list of values which I am not sure about for the range of soundnotes they generate:

Sound[SoundNote[#, 0.25, "Piano"] & /@ {0, -7, -50, 7, 12, 50, 0, -10,
50, -50, 0, 0, 10, 60, 65, 67}]

Export["sequence.mid", %]


Thanks.

cheers, Jamie

If you want to use 2 integer lists, try this

pitch = {0, 2, 4, 5, 7, 9, 11, 12};
tempo = {.5, 1, .5, 1, .3, .2, .1, .1};
Sound[SoundNote[#, #2, "Piano"] & @@@ Transpose@{pitch, tempo}]


As for the mapping the 88 keys are the Range[-39,48]

-39 is A-1, -38 is A#-1 ,-37 is B-1 , -36 is C0 ,-35 is C#0 etc

If Mod[Tone,12]=0 then you have a C

so -36 is C0, -24 is C1, -12 is C2 , 0 is C3, 12 is C4 ... 48 is C7

using Mod[#,12] you can easily find the tones
0 is C, 1 is C#, 2 is D, 3 is D#, 4 is E, 5 is F, 6 is F#, 7 is G, 8 is G#, 9 is A, 10 is A# and 11 is B

Mod[#,12] actually is the reminder of the division #/12,
so it can take values from 0 to 11 which are the 12 notes

But if you don't want to use integers you can use the builtin notation:

pitch = {"C3", "D3", "E3", "F3", "G3", "A3", "B3", "C4"};
tempo = {.5, 1, .5, 1, .3, .2, .1, .1};
Sound[SoundNote[#, #2, "Piano"] & @@@ Transpose@{pitch, tempo}]