|
Another MIDI Question + 1st Version of VirtualPiano Attached! |
Mr. Big
Member #6,196
September 2005
|
Now that I know how to find out which note the MIDI player is playing, how do I change the tempo? |
Johan Halmén
Member #1,550
September 2001
|
Quote: Watch the program play the third move of the Moonlight Sonata Ahaa, so you wrote it in C#. Well, C# minor. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
Mr. Big
Member #6,196
September 2005
|
L0L! |
Arthur Kalliokoski
Second in Command
February 2005
|
I remember slowing down MIDI files by altering one of the bytes in the header with a hex editor. Might have been byte 0xC? Global speed or something. Maybe you can have your program alter how it uses that or alter the value after it's read into memory so you don't have to alter the files. They all watch too much MSNBC... they get ideas. |
Evert
Member #794
November 2000
|
May I suggest that you use something other than a self-extracting RAR archive to distribute your source? |
Mr. Big
Member #6,196
September 2005
|
I've included the source code so you could compile and run the program on other platforms and packed it in a .EXE self extractor... [EDIT] I found this during a Google search: "To extract the tempo data of a MIDI file, you must find the metaevent which Use filein and then use the match object to find FF 51 03 (247 81 3 in decimal) and Bear in mind that this event may be used throughout the MIDI file for dynamic tempo So I need to modify the next three bytes after FF 51 03. |
Todd Cope
Member #998
November 2000
|
You need to construct the MIDI command data yourself and send it to midi_out(). char mdata[6] = {0xFF, 0x51, 0x03}; mdata[3] = blah; mdata[4] = blah; mdata[5] = blah; midi_out(mdata, 6); To get the BPM I believe it will be: 60,000,000 / BPM; I don't know how to construct the 24-bit integer value but I'm sure you could get it with just a couple of tries. |
Paladin
Member #6,645
December 2005
|
You have another problem to look at. Your program doesn't read the key of the midis. I know how to play about half of the moonlight sonata myself and it's playing it incorrectly because it's reading all the notes as naturals. I could be reading an arranged piece, but I'm pretty sure it's correct. |
Jeff Bernard
Member #6,698
December 2005
|
Evert said: May I suggest that you use something other than a self-extracting RAR archive to distribute your source? What's wrong with .rar archives? Typically smaller filesize than .zip and you can just download a free program to open them. RARLabs -- |
gnolam
Member #2,030
March 2002
|
There's nothing wrong with regular RAR archives. Self-extracting archives, however, are works of the devil. -- |
Mr. Big
Member #6,196
September 2005
|
Todd Cope, thanks, now all I have to do is to figure what to put there instead of "blah-blah-blah". Brian, everything is fine. |
Paladin
Member #6,645
December 2005
|
Oh ok I fixed it up, it works now. Heh. |
|