This project has moved and is read-only. For the latest updates, please go here.

MIDI tempo --> solved

Jan 13, 2011 at 4:48 PM

If you wish to change the tempo into a midi file here are the steps to do it.


MidiEventCollectionreponse = new MidiEventCollection(1, 120);      //--->the midi collection 

/// Add this line to your midi collection.

reponse.AddEvent(new TempoEvent(Micro_second_calculator_for_quater_note(bpm),0),0);     //---->the tempo event



à(bpm),0),0) =      bpm is the speed of the song in Beats Per Minute

à(bpm),0),0) =      0 is the delta time where the tempo event begins

à(bpm),0),1) =      1 is the track number that will kept this information


/// <summary>

/// Method to calculate the number of microseconds for a quater note for a precise BPM.

/// </summary>

/// <param name="bpm"></param>

/// <returns></returns>

private static int Micro_second_calculator_for_quater_note (double bpm)   //---->the static method


       //one micro second = 0,000001 second

       //So, multiplication by 1000000 (1 million)

       const int microsecond= 1000000;

       int answer = 0;

       double temp=60;


       temp = temp / bpm;

       temp = temp * microsecond;

       answer = (int)temp;


       return answer;




Distorsion13 says:  tada!