IPB

Welcome Guest ( Log In | Register )

4 Pages V  « < 2 3 4  
Reply to this topicStart new topic
> Zahlman's tools
Zahlman
post Jul 20 2010, 12:45 PM
Post #61


Member
Group Icon

Group: Members
Joined: 24-April 09
Member No.: 873



^ What are you talking about?

Anyway, I couldn't sleep, so here's a super-early (as in I haven't even started on the code to implement this) teaser for NM3 - a sample of what I expect some of the modules to look like.

CODE

# From any '#' to the end of a line is a comment.

# Values default to display as decimal and unsigned.
# To display hex, we put 'h' after a byte count; for signed decimal, use 's'.
# A value like x.y means x bytes and y bits.
# I.e. you should never see .8 or .9.

struct song:
instrument_count: 1
1 {0}
priority: 1
reverb: 1
instruments: ptr instrument # list of unknown length
tracks: instrument_count of ptr track

struct instrument:
type: 1h {0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 64, 128}
base_note: 1h
switch type:
1, 9:
timelength: 1
sweep: 1 {0, 8}
2, 3, 4, 10, 11, 12:
timelength: 1
1 {0}
0, 8, 64, 128:
1 {0}
panning: 1
switch type:
1, 2, 4, 9, 10, 12:
duty: {0, 1, 2}
3 {0}
3, 11:
wavetable: ptr 16h # 32 4-bit samples
0, 8:
sample: ptr sample
64, 128:
sub_map: ptr instrument
switch type:
1, 2, 3, 4, 9, 10, 11, 12:
attack: .3
.5 {0}
decay: .3
.5 {0}
sustain: .4
.4 {0}
release: .3
.5 {0}
0, 8:
attack: 1
decay: 1
sustain: 1
release: 1
64:
split_table: ptr 128h # 128-byte key-split table
128:
4 {0}

struct sample:
3 {0}
looped: {0, 64}
1.2 {0} # will it always be 0?
base_pitch: 2.6 # the value is shifted by 10, i.e. multiplied by 1024
switch looped:
0:
4 {0}
64:
loop_start: 4
size: 4
pcm: size + 1 # Not exactly sure how this is going to work...
align 4

struct track:
sequence:
command: 1h
switch command:
0xB1:
last # marks the end of the current 'sequence'
0xB2, 0xB3:
offset track
# a pointer into the current data -
# not to the beginning of some other thing
else:
# Nothing here.
# We could make this more detailed,
# but there's no point right now.
align 4


This describes several data structures used for song data. There would be another file to say things like "in the stock ROM, there are song structures at XYZ locations", and then the actual edits would be described in yet another sort of file.

This means that most existing NM/NM2 modules are going to need to be redone, and end up in two separate files probably - one describing a structure and another that's just like "in FE7: 42 of foobar at 0x123456". This will hopefully remove a lot of duplication, since the FE games share a lot of common data structures (just have that data at different locations, and in differing amounts).

The first piece of actual code will be something that can read a file like what I put in the codebox above, and take a ROM and an offset and try to read structured data from that offset - breaking it down and labelling each byte accordingly, or else complaining that the data is corrupt.

Plugins are almost certainly going to require you to write actual code. On the up side, I'll be supplying a handful of common ones (the 'ptr' keyword is likely to be implemented as a plugin ;) ) and others will really only be needed for very specialized purposes anyway. They're intended to take care of things like LZ77/Huffman compression (so that it "just works" transparently; you see the uncompressed text in the editor and edit it in that form, and it gets re-compressed when saved).

This post has been edited by Zahlman: Jul 20 2010, 12:47 PM
Go to the top of the page
 
+Quote Post
Zahlman
post Aug 26 2010, 04:55 AM
Post #62


Member
Group Icon

Group: Members
Joined: 24-April 09
Member No.: 873



GBA Song Editor has been updated to v0.37. ZOMG, go get it now.

Please refer to the newly-edited OP for details.
Go to the top of the page
 
+Quote Post
Xenesis
post Aug 26 2010, 01:02 PM
Post #63


New Member
Group Icon

Group: Members
Joined: 4-December 09
From: Australia
Member No.: 2,098



Oh wow.

This is like Christmas. I'm going to go convert some more midis when I next get the chance.
Go to the top of the page
 
+Quote Post
Ryrumeli
post Aug 26 2010, 05:20 PM
Post #64


Member
Group Icon

Group: Members
Joined: 22-August 08
Member No.: 403



When I woke up today I knew it was going to be a great day, for some reason. Then I come here and I find this. <3 You just made my day, Zahlman, thanks again for making something as awesome as your program so awesome. :3



It is because of contributions like this that our hobby today is such a plausible and even in a few points too easy work. Thanks for all your work in this, I think I speak for everyone when I say we appreciate it so. :3
Go to the top of the page
 
+Quote Post
Blazing_Soul
post Aug 27 2010, 07:03 AM
Post #65


PS3/NIS Fanboi
Group Icon

Group: Members
Joined: 15-May 08
From: Somewhere close yet far.
Member No.: 50



This update is great. Truly great. Thank you for the update. Songs convert a little better now. They don't hurt my ears anymore.
Go to the top of the page
 
+Quote Post
Zahlman
post Aug 27 2010, 09:40 PM
Post #66


Member
Group Icon

Group: Members
Joined: 24-April 09
Member No.: 873



QUOTE (Blazing_Soul @ Aug 27 2010, 03:03 AM) *
This update is great. Truly great. Thank you for the update. Songs convert a little better now. They don't hurt my ears anymore.


Some songs were messed up before because notes would stick. This in turn is because MIDI has more than one way to specify that a note should be turned off and I hadn't accounted for one of them.

Also I added support for one of the ways that MIDI sets the relative volume of tracks.
Go to the top of the page
 
+Quote Post
Xenesis
post Aug 29 2010, 04:12 AM
Post #67


New Member
Group Icon

Group: Members
Joined: 4-December 09
From: Australia
Member No.: 2,098



Okay, this is cool - some of the midis I want to use that mid2agb/sappy couldn't convert I can now convert in some fashion.

Although, I'm seeing a lot of this whenever I do a convert:
CODE
> convert 93
Ignored unimportant metadata [9 time(s)].
Ignored nonzero velocity for note-off [1498 time(s)].
Ignored pitch wheel change [63 time(s)].
Ignored control change [225 time(s)].


Should I be concerned?
Go to the top of the page
 
+Quote Post
Zahlman
post Aug 29 2010, 08:06 AM
Post #68


Member
Group Icon

Group: Members
Joined: 24-April 09
Member No.: 873



Not really. The program takes a note of everything in the midi file that it's ignoring, as kind of a note about midi features that either aren't supported, or don't actually affect the playback.

I added support for one (1) control change: the one that governs track volume. There are a bunch of others. It's not easy to find really comprehensive documentation on them.

Pitch wheel changes should be easy enough to support, but I haven't gotten around to them.

"nonzero velocity for note off" refers to one of the things I fixed in this release. I fixed it by saying "if the midi file says the note is off, it's off" - i.e. ignoring the "velocity" (which is used as a note volume for note-on commands). I haven't figured out why midi files ever use non-zero values here. Making things more confusing, another thing I fixed is that when a midi file has a note-on command with zero velocity, it's actually a note-off. (And yes, the name "velocity" is weird. It's supposed to come from the idea of how fast you're pushing down a key on a midi keyboard, or something.)

If there's supposed to be some kind of fancy thing where you control how quickly the note fades away... well, the GBA format doesn't support that. Or at least, not without creating a new instrument for every different note-off velocity that gets used, and making some possibly horrible assumptions about how to map the midi values to gba values.

But just in case there is a better way to deal with these values than ignoring them, I set up the logging code to log them.

Unimportant metadata is... unimportant.

tl;dr: if you don't already know a lot about the technical side of MIDI, don't worry about it. Except the pitch wheel thing. If your midi is supposed to have a lot of pitch bends/slides and the GBA output doesn't, that's because the converter isn't quite l33t enough yet. If you do actually know this technical MIDI stuff, like really well, please help me fix stuff!

This post has been edited by Zahlman: Aug 29 2010, 08:10 AM
Go to the top of the page
 
+Quote Post
Xenesis
post Aug 29 2010, 11:14 PM
Post #69


New Member
Group Icon

Group: Members
Joined: 4-December 09
From: Australia
Member No.: 2,098



Unfortunately, I don't have enough knowledge to be helpful :(

But good to know that most of the stuff that it is spitting out I don't need to worry about. The fact that it is getting midis I couldn't convert to work and the actual conversion seems to be a better quality than the on one Sappy uses it means I can get back to work. :D

Also, the looping support is <3. Doing that crap by hand was tiresome :)
Go to the top of the page
 
+Quote Post
Zahlman
post Sep 2 2010, 11:21 PM
Post #70


Member
Group Icon

Group: Members
Joined: 24-April 09
Member No.: 873



Just a quick note to say that work on NM3 has begun in earnest. The first step will be a "disassembler", and the basics for it should be ready within a couple of days, although it will be longer before it's really usable.
Go to the top of the page
 
+Quote Post
Ryrumeli
post Sep 5 2010, 03:40 PM
Post #71


Member
Group Icon

Group: Members
Joined: 22-August 08
Member No.: 403



Heh, can't wait to retire my Crystal Tile 2 and it's disassembling, dude, can't wait. :3 *Cheering*
Go to the top of the page
 
+Quote Post
Blazing_Soul
post Today, 09:39 AM
Post #72


PS3/NIS Fanboi
Group Icon

Group: Members
Joined: 15-May 08
From: Somewhere close yet far.
Member No.: 50



Good to know about NM3 but here's a quick question for you about the song editor I have tried the loop feature but I can't get it to work. It says it loops but my songs still only play once.
Go to the top of the page
 
+Quote Post

4 Pages V  « < 2 3 4
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version

Skin Created By xDoug from IPB Design.info

Time is now: 9th September 2010 - 12:31 PM