You are not logged in.
I am currently working on a tool that reads music from a gold/silver ROM and plays it.
It works okay so far, but I have a problem: I don't know how to get the music tempo, so I can only play at a fixed, predefined speed and sound channels will get out of sync when one channel changes it tempo.
Lugia2000 says in his tutorial:
D8*: take 1 extra byte to determine the tempo of the following melody
but here it says:
D8 xx yz - xx Frames per note delay unit, Velocity y, Note Length z
DA hh ll - Set Tempo (yes, hh ll, not ll hh, the lower the value the faster)
So, which is actually correct?
And how would I go about converting it to beats per minute?
For bpm you would have to count the notes.
Lugias documentation is indeed off about this one. In the German version he even kind of commented on it in his example. Not sure about any English version.
As for the header, Melash documented it wrong:
The header is 4 bits telling how many channels are active:
[(A << 6)|Channel No][Pointer] (A - 1) * ([Channel No] [Pointer])
You will have to parse that correctly in your program anyway. Obviously, a 0x00 will mean no channel is present.
Last edited by Tauwasser (2012-06-01 18:29:40)
Since I'm German as well, do you have a link to the German version of Lugias tutorial?
I've only found the English one on your Google Site.
My method for getting the channel count works fine btw.
ch_count = (memory->getByte(offset) >> 6) + 1;
If you're interested in what I've got so far, here is the intro music:
Melash seems to be wrong about the jump instruction:
It isn't FD 00 xx xx, it's FD yy xx xx, where yy is the number of loops, 0 = infinite.
I've made some other small changes and now I can play some songs nicely.
Last edited by compu (2012-06-01 16:02:43)
Obviously you were right about the shift. It was late yesterday :(
Anyway, I don't understand anything about music. While I have all opcodes decoded, I cannot tell you what any of them do in a meaningful way for a composer. Also, there are some internal states internal states which none of you have mentioned so far... However, I'm not sure if they actually ever exist, so I'm likely to investigate first...
Also, the later opcodes 0xF1 through 0xF8 are actually NOPs. This means the music format is probably not unique and might be shared with other games and they kept these for compatibility.
Thanks for the info about NOPs, I have found 3 undocumented instructions so far (F2, D9, E5) and I thought all of them would take 1 extra byte - looks like that's wrong for F2 ^^
Another thing that's frustrating... When you play the intro in the emulator and listen only to channel 2, the speed increases/doubles at some time (around 0:11 on the mp3 I uploaded) but there is no change in speed or note lengths...
Music pointer offset: e9164 Music header offset: f7055 Channel count: 3 Channel 0 sound data offset: f705e (pointer: 5e70) Channel 1 sound data offset: f70f8 (pointer: f870) Channel 2 sound data offset: f71c8 (pointer: c871) CH1:F70F8: E6 - Tune 0, 1 CH1:F70FB: EF - Panning f CH1:F70FD: D8 - Tempo: c CH1:F7100: DB - Duty cycle 2 CH1:F7102: D6 - Octave 2 CH1:F7103: 1F - Note 1, delay f CH1:F7104: 1F - Note 1, delay f CH1:F7105: DB - Duty cycle 3 CH1:F7107: D8 - Tempo: c CH1:F710A: 1 - No note, 1 delay CH1:F710B: D8 - Tempo: 6 CH1:F710E: D7 - Octave 1 CH1:F710F: 61 - Note 6, delay 1 CH1:F7110: A1 - Note a, delay 1 CH1:F7111: D6 - Octave 2 CH1:F7112: 11 - Note 1, delay 1 CH1:F7113: 51 - Note 5, delay 1 CH1:F7114: 61 - Note 6, delay 1 CH1:F7115: A1 - Note a, delay 1 CH1:F7116: D5 - Octave 3 CH1:F7117: 11 - Note 1, delay 1 CH1:F7118: 51 - Note 5, delay 1 CH1:F7119: 61 - Note 6, delay 1 CH1:F711A: A1 - Note a, delay 1 CH1:F711B: D4 - Octave 4 CH1:F711C: 11 - Note 1, delay 1 CH1:F711D: 51 - Note 5, delay 1 CH1:F711E: 61 - Note 6, delay 1 CH1:F711F: A1 - Note a, delay 1 CH1:F7120: D3 - Octave 5 CH1:F7121: 11 - Note 1, delay 1 CH1:F7122: 51 - Note 5, delay 1 =============================================================== speed doubles here in emulator CH1:F7123: D7 - Octave 1 CH1:F7124: 41 - Note 4, delay 1 CH1:F7125: 81 - Note 8, delay 1 CH1:F7126: B1 - Note b, delay 1 CH1:F7127: D6 - Octave 2 CH1:F7128: 31 - Note 3, delay 1 CH1:F7129: 41 - Note 4, delay 1 CH1:F712A: 81 - Note 8, delay 1 CH1:F712B: B1 - Note b, delay 1 CH1:F712C: D5 - Octave 3 CH1:F712D: 31 - Note 3, delay 1 CH1:F712E: 41 - Note 4, delay 1 CH1:F712F: 81 - Note 8, delay 1 CH1:F7130: B1 - Note b, delay 1 CH1:F7131: D4 - Octave 4 CH1:F7132: 31 - Note 3, delay 1 CH1:F7133: 41 - Note 4, delay 1 CH1:F7134: 81 - Note 8, delay 1 CH1:F7135: D8 - Tempo: c ...
Might this be because of any internal values?