View previous topic :: View next topic |
Author |
Message |
Leff
Joined: 04 Dec 2006 Posts: 1315
|
Posted: Fri Dec 28, 2007 6:00 am Post subject: |
|
|
Wow I can't believe I didn't re-read those. Thanks for the heads up Robin!
I'm back to campus now so I'm gunna see if those sustains are fixed and try to come up with the calculation for that bpm used for the offset (help is welcome, I tend to get confused when working with seconds/ticks/bpm/mpq).
EDIT: Success! No infinite sustains! I also updated the Offset handling, here's the basic calculation so someone can check it and confirm that it's right, though it worked with bodom's A7X chart and I got the same GHex results and it looks perfect (I don't have the mp3, so I can't 100% check).
If Offset is not 0, multiply by 1million to convert to microseconds;
divide by 4 to get ms per quarter note;
store in bytes;
add tempo event (0x51) to tempo track with offset bytes at tick 0;
set Offset to 1920 to move all other events ahead by one measure.
If Offset is 0, take no action.
That seems to be correct, and I've converted a few charts and they all look perfect in GHex, so woo hoo! OP link updated, this baby's basically done. _________________
Last edited by Leff on Fri Dec 28, 2007 7:09 am; edited 1 time in total |
|
Back to top |
|
|
GameZelda
Joined: 30 Mar 2007 Posts: 1705
|
Posted: Fri Dec 28, 2007 7:08 am Post subject: |
|
|
Well, I hope that I've helped to solve this
Not related to your tool but related to GH Midi, anyone knows because the GH2 songs have only note-ons? It's a problem with my midi parser?
Here's the start of FoP:
Code: | Valid MTrk chunk! (42257 bytes)
0 (+0): Track name > PART GUITAR
0 (+0): Text > [idle]
1905 (+1905): Note-on > Note 105, Speed 100
1905 (+0): Note-on > Note 93, Speed 100
1905 (+0): Note-on > Note 81, Speed 100
1905 (+0): Note-on > Note 69, Speed 100
1920 (+15): Note-on > Note 96, Speed 100
1920 (+0): Note-on > Note 72, Speed 100
1920 (+0): Note-on > Note 60, Speed 100
1920 (+0): Note-on > Note 46, Speed 100
1920 (+0): Text > [play]
1920 (+0): Note-on > Note 84, Speed 100
2035 (+115): Note-on > Note 96, Speed 0
2035 (+0): Note-on > Note 72, Speed 0
2035 (+0): Note-on > Note 60, Speed 0
2035 (+0): Note-on > Note 84, Speed 0
2239 (+0): Note-on > Note 86, Speed 100
2355 (+116): Note-on > Note 98, Speed 0
2355 (+0): Note-on > Note 86, Speed 0
2395 (+40): Note-on > Note 46, Speed 0
|
As you can see, all are note-ons and with speeds "0" for note-off and "100" for note-on _________________
(Ok, I failed to do it in 24 hours... ).
GH:WT-PS2 Customization Progress
[ 100%] Make it work (w/songs loading) in a DVD5 (thanks psychospacefish!)
[ 100%] Modify audio (Finally done 25/11/2008)
[ 100%] Modify charts (Done 26/11/2008! Customs finally ) |
|
Back to top |
|
|
Leff
Joined: 04 Dec 2006 Posts: 1315
|
Posted: Fri Dec 28, 2007 7:52 am Post subject: |
|
|
OK, so I'm losing precision on my bpm calculations. I think this is pretty obviously because I was just using integers when I was storing the ms per quarter note in bytes. I did that because, I'll admit, I... don't know how to store Double values into bytes...
I noticed this when testing xSergeantMinorx's "Holiday" chart. The first bpm event has a value of 14,370 (14.370 bpm). Converting this to mpq gets (60,000,000 / 14.370) = 4175365.34447... mpq. And I have no idea how to turn that into a byte array to send as a parameter when creating a tempo event. Thoughts? (at this point I should barely take credit at all for this program, with all the help I've needed...)
It amazes me the kind of practical, useful things you're not in a university Computer Science program... </complaint> _________________
|
|
Back to top |
|
|
bodom0015
Joined: 17 Mar 2007 Posts: 768
|
Posted: Fri Dec 28, 2007 12:18 pm Post subject: |
|
|
Leff wrote: | OK, so I'm losing precision on my bpm calculations. I think this is pretty obviously because I was just using integers when I was storing the ms per quarter note in bytes. I did that because, I'll admit, I... don't know how to store Double values into bytes...
I noticed this when testing xSergeantMinorx's "Holiday" chart. The first bpm event has a value of 14,370 (14.370 bpm). Converting this to mpq gets (60,000,000 / 14.370) = 4175365.34447... mpq. And I have no idea how to turn that into a byte array to send as a parameter when creating a tempo event. Thoughts? (at this point I should barely take credit at all for this program, with all the help I've needed...)
It amazes me the kind of practical, useful things you're not in a university Computer Science program... </complaint> |
Hmmm, I'm currently taking a programming class myself and have yet to learn Java (we're using VB.NET). What's the difference between a Byte Value and a Byte Array if there is one? Is an Array just multiple values for that Byte or something? (Would THIS match your problem at all? I don't really know because, again, I don't speak Java... D: )
That bolded part is nonsense. You think when kata made GHex it went smoothly? I doubt it. Do you think when malictus made GWiz it was perfect first try? Bullshit. Every program has obstacles. Once you get past them, you achieve greatness! Beta testers are required for every program as each one will have its own unique kinks to unravel. Too many metaphors? Deal with it.
And as for the last line YOU'VE BEEN EXPOSED! Lol. _________________
[quote:e0e72f52e0="J.T."]One week, only 7 people had Awesomeness Detection on, and they were all young and did not play well. Thus, Naked Brothers became DLC. | |
|
Back to top |
|
|
SixStringedBass
Joined: 14 Jul 2007 Posts: 181
|
Posted: Fri Dec 28, 2007 4:34 pm Post subject: |
|
|
This is from a chart to mid that I had started (and actually almost finished, but would've been command line) but you got it up and working before me so I will help you instead. Just import java.io.* or those collections directly.Code: | public static byte[] toBytes(int num) throws IOException
{
ByteArrayOutputStream byte_out = new ByteArrayOutputStream ();
DataOutputStream data_out = new DataOutputStream (byte_out);
data_out.writeInt(num<<8);
return byte_out.toByteArray();
}
|
Also, I believe that chart files use a resolution of 192, so when calculating the offset, you need to take that into consideration, unless you resample the whole chart into 480. |
|
Back to top |
|
|
Leff
Joined: 04 Dec 2006 Posts: 1315
|
Posted: Fri Dec 28, 2007 8:07 pm Post subject: |
|
|
God I can't seem to get this! I thought I had it working with a suggestion from bodom's link, and I got really excited, but I was wrong. I've been looking into ByteArray/DataOutputStreams, but the thing is that it needs to be a Double value (I was using ints, lost too much precision), so I can't quite use your code, SixStringedBass, and it also has to be a byte array of size 3, since you can only pass 3 bytes to create a tempo event, and the toByteArray() method just returns as many bytes as it needs. Maybe I'm just missing a simple adjustment to your code, SSB, but I'm still stumped.
Oh, and the resolution thing is fine, just had to multiply the .chart time-stamps by 2.5 actually. I was surprised that actually worked so simply, but hey, jackpot. _________________
|
|
Back to top |
|
|
GameZelda
Joined: 30 Mar 2007 Posts: 1705
|
Posted: Fri Dec 28, 2007 8:21 pm Post subject: |
|
|
Leff wrote: | God I can't seem to get this! I thought I had it working with a suggestion from bodom's link, and I got really excited, but I was wrong. I've been looking into ByteArray/DataOutputStreams, but the thing is that it needs to be a Double value (I was using ints, lost too much precision), so I can't quite use your code, SixStringedBass, and it also has to be a byte array of size 3, since you can only pass 3 bytes to create a tempo event, and the toByteArray() method just returns as many bytes as it needs. Maybe I'm just missing a simple adjustment to your code, SSB, but I'm still stumped.
Oh, and the resolution thing is fine, just had to multiply the .chart time-stamps by 2.5 actually. I was surprised that actually worked so simply, but hey, jackpot. |
I don't recommend you to multiply ALWAYS by 2.5. Multiply it to (480 / resolution) _________________
(Ok, I failed to do it in 24 hours... ).
GH:WT-PS2 Customization Progress
[ 100%] Make it work (w/songs loading) in a DVD5 (thanks psychospacefish!)
[ 100%] Modify audio (Finally done 25/11/2008)
[ 100%] Modify charts (Done 26/11/2008! Customs finally ) |
|
Back to top |
|
|
Leff
Joined: 04 Dec 2006 Posts: 1315
|
Posted: Fri Dec 28, 2007 9:54 pm Post subject: |
|
|
Good call. Done. I just sorta figure all charts were a 192 resolution.
Once again I was way over-thinking that whole Double thing. I looked at what GHex generates when it imports a chart, and it turns out that it just floors the mpq into an int. Apparently this is plenty of precision because that Holiday chart syncs up just like the original chart now. So now I'm just gunna clean a few things up and then I'll update the OP and we should be good-to-go.
EDIT: All done! Changed the GUI so you don't have to select Bass/Rhythm Coop anymore, since I realized that info is already in the chart header. Syncing should be precise, sustains are correct, Star Power and Player Sections are correct, dB Offsets are created, if anything else is buggy, let me know. _________________
|
|
Back to top |
|
|
bodom0015
Joined: 17 Mar 2007 Posts: 768
|
|
|