Golden Sun Hacking Community
December 15, 2017, 09:50:12 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: 1 [2]   Go Down
  Print  
Author Topic: Charon's New and Improved Music Hacking Tutorials  (Read 15860 times)
0 Members and 1 Guest are viewing this topic.
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4565

« Reply #15 on: July 07, 2011, 06:42:31 PM »

Cool, thanks for all of your help! Just to make sure, the song's header goes right before the actual tracks start, right?

Never mind, I misread the guide. Thanks for all of your help!
« Last Edit: July 07, 2011, 06:45:10 PM by Salanewt » Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW
Charon
On Probation
Veteran Member
*

Coins: 11
Offline Offline

Emblems: GBA Music Expert
Clan Position: Trickster Goddess of Luna
Posts: 1758

« Reply #16 on: July 07, 2011, 06:46:46 PM »

If you're curious about header structure, its just

[# of tracks] 00 [flag] [flag]
[pointer to instruments (which is 0x1C3714 in TLA)]
[track 1 pointer]
[track 2 pointer]
...

[track 16 pointer]

It's usually after the last track in a song, and its always located at a location ending at 0, 4, 8, or C. Also, I have no idea what the flags do, I think they are really only used during certain SFX/fanfares. This means that a header will take up at least 12 bytes, and 4 extra bytes for each extra track.
« Last Edit: July 07, 2011, 06:48:38 PM by Charon the Ferryman » Logged
View Profile
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4565

« Reply #17 on: July 07, 2011, 07:03:29 PM »

Ah, so that explains why Sappy works until I try playing that one song. Excellent, thanks for clarifying that!

And... I just messed up the track pointers, so I shall go and fix them.
Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW

New User


Coins: 0
Offline Offline

Posts: 1

« Reply #18 on: March 07, 2012, 11:20:57 PM »

So I've been diggin a bit and trying to figure what is the correct order of loading the music from rom, my goal is to play pokemon fire red music from ROM.

So first there is a Music Table.
4Bytes, Song Header Pointer ?
4Bytes, Unknown

Song Headers contain number of tracks in songs, then two pointers: VoiceGroups and Tracks.
Struct:
1Byte, Number of tracks - range from 0x00 to 0x0F
1Byte, 00
1Byte, Flag
1Byte, Flag
4Bytes, Pointer to VoiceGroups
LoopStart for < Number of Tracks >
4Bytes, Track Pointer
LoopEnd

VoiceGroups ( Up to 128 voices )
Struct:
4Bytes, Voice Type
4Bytes, WAV Sample Pointer
4Bytes, Unknown

Tracks contain track data and are based on argument/commands, they start with BC 00 end with B1.

So order of loading would be
Music Table -> Song Header -> ( VoiceGroups -> VoiceSamples ) + Tracks

Also a question, how exacly loading of tracks works? Since there is a loop in song header that can contain few tracks.
Does it play like Track1, Track2, Track3, Track4 [...] ? But then how jump commands inside tracks itself behave with few track pointers?
Or maybe it's the fact that the Tracks itself are programmed to jump between Tracks inside the track data.
Logged
View Profile
Atrius
Programmer Extraordinaire
Web Host

Fear my blades

Veteran Member
*

Coins: 1
Offline Offline

Gender: Male
Emblems: Website Founder
Clan Position: Creation God of Sol
Posts: 1756

« Reply #19 on: March 09, 2012, 10:52:17 AM »

All of the tracks are played simultaneously.  Basically each one is the sheet music that an individual member of a band would play during a song.  Also, tracks don't necessarily have to start with BC 00

Quote
So first there is a Music Table.
4Bytes, Song Header Pointer ?
4Bytes, Unknown
The last 4 bytes of each entry in the music table have to do with how the game prioritizes, and categorizes audio.

Quote
VoiceGroups ( Up to 128 voices )
Struct:
4Bytes, Voice Type
4Bytes, WAV Sample Pointer
4Bytes, Unknown
The last 4 bytes of a voice group are the ADSR envelope settings (Read second post in this topic)


As for the question on load order, you should know the GBA doesn't really "load" any of the raw audio data into RAM, it just streams it directly from the ROM as it plays.  As for the order it looks at things:

Music Table -> Song Header -> Tracks -> Voices as tracks ask for them (0xBD command in the track)
Logged

I'm shaking my head in general disapproval of everything
View Profile WWW
Charon
On Probation
Veteran Member
*

Coins: 11
Offline Offline

Emblems: GBA Music Expert
Clan Position: Trickster Goddess of Luna
Posts: 1758

« Reply #20 on: March 12, 2012, 03:32:49 PM »

So I've been diggin a bit and trying to figure what is the correct order of loading the music from rom, my goal is to play pokemon fire red music from ROM.
For this all you would really need to know is the pointer to the song table. I can't recall what it is atm but I could look it up later.

Quote
Does it play like Track1, Track2, Track3, Track4 [...] ? But then how jump commands inside tracks itself behave with few track pointers?
Or maybe it's the fact that the Tracks itself are programmed to jump between Tracks inside the track data.
By tracks we mean an individual set of notes for one instrument, for example a song with a flute, guitar and drumline would have 3 tracks playing all at the same time. Its like a MIDI editor, actually. Although technically you can change the instrument midway, I hope this helps make the concept of a track in a MIDI piece a bit easier to grasp.

Hope we cleared it up for you a bit.
Logged
View Profile
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Cbox
December 13, 2017, 09:19:38 PM
Fox: Okay, so that Summon Night games adds the fram number to the seed, before generating another seed via mul/add....  (GS1-GS3 never adds the fram number.) ... So um, that makes sense! ;  Summon Night:  ((seed + frame) * 0x343FD + 0x269E3C) >> 0x10 ; Which is also on the list here: https://en.wikipedia.org/wiki/Linear_congruential_generator
December 12, 2017, 11:10:45 PM
Fox: Yes, and there could be contests. Maybe ones where 1st/2nd/3rd place get a cash reward, but eh. Dunno.... Kind of thinking about making a topic about how people got their job, and what was their experience. (e.g. Did they use references of people already working in the job, and various other things.)
December 09, 2017, 04:24:14 AM
Majora: Import old forum posts for reference, perhaps take posts containing important info like documentation away from the old stickied forum post model and make them into their own pages on a site with an in-built search bar. Might help with SEO, too. If nothing else, perhaps whipping them into PDFs and hosting them via Scribd? The possibilities are boundless when it comes to restructuring a site
December 09, 2017, 04:20:02 AM
Majora: Just a nice idea to have even if it doesn't come to fruition. Updating, modernizing, always a good idea. Could probably do something pretty nifty using a good Wordpress theme
December 09, 2017, 04:15:45 AM
Majora: Would be kind of neat to do something like that for GSHC. Could change it up a bit to show all tweets/instagram posts/facebook posts/golden sun subreddit posts all in one sidebar. It would be cool in that it gives the site it's on (and the topic in general) appear more lively and active, which is a plus
December 09, 2017, 04:14:19 AM
Majora: That does sound interesting. One cool thing I've seen some sites use is a sort of unique take on a sidebar option that acts like a social media integration (like, "See GSHC's latest Tweets"). It displays activity from a variety of related sites, such as Reddit, Twitter, Instagram, etc.
December 09, 2017, 12:58:53 AM
Fox: And the way it'd work via code is not that all users would instantly get nicknames the minute you register... but rather, the moment you view a name if it doesn't have a nickname, it gets one. (My Thoughts.)
December 09, 2017, 12:53:55 AM
Fox: (I was thinking that it would be "Name (Nickname)" ... The nickname is what you first known the user as, and you can change that yourself... and the Name is what the user wants to be called... Something like that.
December 09, 2017, 12:47:56 AM
Fox: So like... for starters, one idea I had was to make it so anyone can name anyone... much like how it works on Skype, and you (the namer) would be the only one to see it, and such...
December 09, 2017, 12:45:02 AM
Fox: Would need to be carefully thought out and tested, though.
December 09, 2017, 12:43:02 AM
Fox: I'm thinking I could make it so that name changes can happen whenever... (Without any limit)... Since I believe there's a way to do it with minimum confusion. (I think.) Hmm....
December 09, 2017, 12:31:36 AM
Fox: (I mean an offline version... at least initially.)
December 09, 2017, 12:25:01 AM
Fox: Now that I have thought about it a bit more, would I be right to assume that GSHC would be one of the most interesting websites to administrate, or no? It's sad to see not much going on with it. == I almost want to make a concept website at some point. :D Anyway, how is everyone doing today?
December 06, 2017, 12:12:59 AM
Fox: Like... Start using Github or something... Do like how many of those other projects such as Citra (WIP 3DS Emulator) does. Etc.
December 06, 2017, 12:08:12 AM
Fox: No idea. I just wish OpenGoldenSun would release it as unfinished, but oh well.
December 05, 2017, 06:52:09 AM
MaxiPower: Bummed out that the open golden sun project is dead it seems with no actitivy in close to a year at this point. Is there any hope left in any other projects?
November 27, 2017, 10:25:28 AM
Fox: (When I say research, mainly refering to the data in the game, though checking websites can count to a degree.)
November 27, 2017, 09:52:27 AM
Fox: Maybe. But Dark Dawn is meh, hahah... I still research it, though, because data can be interesting.
November 27, 2017, 05:28:36 AM
Portakin: I'm here! This game is underrated!
November 25, 2017, 08:03:23 PM
Fox: .... and the email listed in that post makes me think we should just make a new rules topic with most of the same information. (So the old ones can be sort o archived.)

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.045 seconds with 22 queries.