Adding the Sonic 3 DAC samples to MegaPCM

Discussion in 'Tutorials Archive' started by amphobius, Jul 19, 2013.

Thread Status:
Not open for further replies.
  1. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    This isn't much of a guide, more of something for convenience if you so desire to use the S3 DAC samples in your hacks. You might want these if you are porting songs from S3K/S3D to your hack, or if you simply like the sound of them. Either way, this is what you'll need if you want them in your hack. Remember, this is for MegaPCM; you can take the same samples and pitch numbers for other drivers, but you'll need to manage banks and/or sizes yourself.

    First of all, in MegaPCM.asm, copy this into your DAC Samples table:



    ; ---------------------------------------------------------------

    ; Sonic 3 Sample definitions

    ; ---------------------------------------------------------------

        DAC_Entry   $04+2, D81,     dpcm ; 81 - Kick

        DAC_Entry   $0E+2, D8285,   dpcm ; 82 - High-Tom

        DAC_Entry   $14+2, D8285,   dpcm ; 83 - Mid-Tom

        DAC_Entry   $1A+2, D8285,   dpcm ; 84 - Low-Tom

        DAC_Entry   $20+2, D8285,   dpcm ; 85 - Floor Tom

        DAC_Entry   $04+2, D86,     dpcm ; 86 - Kick

        DAC_Entry   $04+2, D87,     dpcm ; 87 - Kick + Snare

        DAC_Entry   $06+2, D88,     dpcm ; 88 - Crash Cymbal

        DAC_Entry   $0A+2, D89,     dpcm ; 89 - Ride Cymbal

        DAC_Entry   $14+2, D8A8B,   dpcm ; 8A - Low Metal Hit

        DAC_Entry   $1B+2, D8A8B,   dpcm ; 8B - Metal Hit

        DAC_Entry   $08+2, D8C,     dpcm ; 8C - High Metal Hit

        DAC_Entry   $0B+2, D8D8E,   dpcm ; 8D - Higher Metal Hit

        DAC_Entry   $11+2, D8D8E,   dpcm ; 8E - Low Metal Hit

        DAC_Entry   $08+2, D8F,     dpcm ; 8F - Clap

        DAC_Entry   $03+2, D9093,   dpcm ; 90 - Electric High-Tom

        DAC_Entry   $07+2, D9093,   dpcm ; 91 - Electric Mid-Tom

        DAC_Entry   $0A+2, D9093,   dpcm ; 92 - Electric Low-Tom

        DAC_Entry   $0E+2, D9093,   dpcm ; 93 - Electric Floor Tom

        DAC_Entry   $06+2, D9497,   dpcm ; 94 - Tight Snare

        DAC_Entry   $0A+2, D9497,   dpcm ; 95 - Mid-pitch snare

        DAC_Entry   $0D+2, D9497,   dpcm ; 96 - Loose Snare

        DAC_Entry   $12+2, D9497,   dpcm ; 97 - Looser Snare

        DAC_Entry   $0B+2, D989A,   dpcm ; 98 - Hi-Timpani

        DAC_Entry   $13+2, D989A,   dpcm ; 99 - Low-Timpani

        DAC_Entry   $16+2, D989A,   dpcm ; 9A - Mid-Timpani

        DAC_Entry   $0C+2, D9B,     dpcm ; 9B - Quick Loose Snare

        DAC_Entry   $0A+2, D9C,     dpcm ; 9C - Click

        DAC_Entry   $18+2, D9D,     dpcm ; 9D - Power Kick

        DAC_Entry   $18+2, D9E,     dpcm ; 9E - Quick Glass Crash

        DAC_Entry   $0C+2, D9F,     dpcm ; 9F - Glass Crash with Snare

        DAC_Entry   $0C+2, DA0,     dpcm ; A0 - Glass Crash

        DAC_Entry   $0A+2, DA1,     dpcm ; A1 - Glass Crash with Kick

        DAC_Entry   $0A+2, DA2,     dpcm ; A2 - Quiet Glass Crash

        DAC_Entry   $18+2, DA3,     dpcm ; A3 - Odd Snare with Kick

        DAC_Entry   $18+2, DA4,     dpcm ; A4 - Kick with extra bass

        DAC_Entry   $0C+2, DA5,     dpcm ; A5 - "Come on!"

        DAC_Entry   $09+2, DA6,     dpcm ; A6 - Dance Snare

        DAC_Entry   $18+2, DA7,     dpcm ; A7 - Loose Kick

        DAC_Entry   $18+2, DA8,     dpcm ; A8 - Moderately Loose Kick

        DAC_Entry   $0C+2, DA9,     dpcm ; A9 - "Woo!"

        DAC_Entry   $0A+2, DAA,     dpcm ; AA - "Go!"

        DAC_Entry   $0D+2, DAB,     dpcm ; AB - Snare with voice going "Go!"

        DAC_Entry   $06+2, DAC,     dpcm ; AC - Power Tom

        DAC_Entry   $10+2, DADAE,   dpcm ; AD - Hi-Wood Block

        DAC_Entry   $18+2, DADAE,   dpcm ; AE - Low-Wood Block

        DAC_Entry   $09+2, DAFB0,   dpcm ; AF - Hi-Hit Drum

        DAC_Entry   $12+2, DAFB0,   dpcm ; B0 - Low-Hit Drum

        DAC_Entry   $18+2, DB1,     dpcm ; B1 - Metal Crash Hit

        DAC_Entry   $16+2, DB2B3,   dpcm ; B2 - Echoed Clap Hit

        DAC_Entry   $20+2, DB2B3,   dpcm ; B3 - Lower Echoed Clap Hit

        DAC_Entry   $0C+2, DB4C1C4, dpcm ; B4 - Hip-Hop style hit with a kick

        DAC_Entry   $0C+2, DB5,     dpcm ; B5 - Hip-Hop style hit with a Power Kick

        DAC_Entry   $0C+2, DB6,     dpcm ; B6 - Som Bass with a voice going "Hey!"

        DAC_Entry   $18+2, DB7,     dpcm ; B7 - Dance Style Kick

        DAC_Entry   $0C+2, DB8B9,   dpcm ; B8 - Hip-Hop hit with a kick

        DAC_Entry   $0C+2, DB8B9,   dpcm ; B9 - Hip-Hop hit with a kick

        DAC_Entry   $18+2, DBA,     dpcm ; BA - Reverse Fading Wind Sound

        DAC_Entry   $18+2, DBB,     dpcm ; BB - Scratch

        DAC_Entry   $18+2, DBC,     dpcm ; BC - Loose Snare with noise

        DAC_Entry   $0C+2, DBD,     dpcm ; BD - Power Kick

        DAC_Entry   $0C+2, DBE,     dpcm ; BE - Crashing noise with voice going "Woo!"

        DAC_Entry   $1C+2, DBF,     dpcm ; BF - Quick hit

        DAC_Entry   $0B+2, DC0,     dpcm ; C0 - Kick with a voice going "Hey!"

        DAC_Entry   $0F+2, DB4C1C4, dpcm ; C1 - Power Kick with hit

        DAC_Entry   $11+2, DB4C1C4, dpcm ; C2 - Low Power Kick with hit

        DAC_Entry   $12+2, DB4C1C4, dpcm ; C3 - Lower Power Kick with hit

        DAC_Entry   $0B+2, DB4C1C4, dpcm ; C4 - Lowest Power Kick with hit



    I would heavily recommend having this starting from $81, as I think the main reason you'd want the entire library of samples if you aren't insane is to have ports that will sound reasonably the same as the original in your hack. These pitches are taken from the Sonic 3 disassembly and have had two added to them. The samples play faster than what they would in Sonic 3 if you leave them as the original pitch, so this puts them to the same if not in the right ballpark that the original samples are.

    Next, we need to put the sample definitions in. Still in MegaPCM.asm, put this where your DAC sample files are, this should be right after the table.



        IncludeDAC  D81, bin

        IncludeDAC  D8285, bin

        IncludeDAC  D86, bin

        IncludeDAC  D87, bin

        IncludeDAC  D88, bin

        IncludeDAC  D89, bin

        IncludeDAC  D8A8B, bin

        IncludeDAC  D8C, bin

        IncludeDAC  D8D8E, bin

        IncludeDAC  D8F, bin

        IncludeDAC  D9093, bin

        IncludeDAC  D9497, bin

        IncludeDAC  D989A, bin

        IncludeDAC  D9B, bin

        IncludeDAC  D9C, bin

        IncludeDAC  D9D, bin

        IncludeDAC  D9E, bin

        IncludeDAC  D9F, bin

        IncludeDAC  DA0, bin

        IncludeDAC  DA1, bin

        IncludeDAC  DA2, bin

        IncludeDAC  DA3, bin

        IncludeDAC  DA4, bin

        IncludeDAC  DA5, bin

        IncludeDAC  DA6, bin

        IncludeDAC  DA7, bin

        IncludeDAC  DA8, bin

        IncludeDAC  DA9, bin

        IncludeDAC  DAA, bin    

        IncludeDAC  DAB, bin

        IncludeDAC  DAC, bin    

        IncludeDAC  DADAE, bin

        IncludeDAC  DAFB0, bin

        IncludeDAC  DB1, bin

        IncludeDAC  DB2B3, bin  

        IncludeDAC  DB4C1C4, bin    

        IncludeDAC  DB5, bin    

        IncludeDAC  DB6, bin    

        IncludeDAC  DB7, bin    

        IncludeDAC  DB8B9, bin      

        IncludeDAC  DBA, bin    

        IncludeDAC  DBB, bin    

        IncludeDAC  DBC, bin

        IncludeDAC  DBD, bin    

        IncludeDAC  DBE, bin    

        IncludeDAC  DBF, bin    

        IncludeDAC  DC0, bin    



    After this, you should have the entire library of Sonic 3 DAC samples! There are a few more samples unique to Sonic and Knuckles and Sonic 3D, but you can locate these from flamewing's smps2asm. All you'd need to do is add the samples, find the pitch definition and add +2 to it.

    The last things that need mentioning is after porting songs from Sonic 3 & Knuckles and Sonic 3D is that the PSG needs to be lowered an octave to be at the same pitch as the original. You can do this by looking at the SMPS header of the song, finding the PSG1 and PSG2 headers and subtracting $C from them. For example, $00 would become $F4, $F4 would become $E8 and so on. This is easier if you are using s1smps2asm/smps2asm in your hack, where you'd just need to convert it to asm and add -12 after the original PSG number. Lastly, if you want your ports to be really accurate I'd recommend porting over the PSG flutters from S3K or S3D; this will add more PSG volume envelopes to your hack and most crucially songs that are using flutters not found in Sonic 1 will play correctly (the S3K Invincible theme is notorious for not being fixed properly in hacks).

    Oh, and before I finish, you can download the DAC samples I used here.
     
    Last edited by a moderator: Jul 19, 2013
    kenny0989 and Clownacy like this.
  2. ValleyBell

    ValleyBell Well-Known Member Member

    Joined:
    Dec 23, 2011
    Messages:
    166
    There's one tiny thing you also need to know about the PSG notes: There aren't just 12 more notes at the beginning, but there are actually two more at the end. (an additional frequency $10 and a redundant $0 that could also be padding)
    So in order to correctly convert songs from S3K, you need to subtract 1 or 2 from the last few PSG notes. (I think the last version of SMPSConv I released didn't take care of that either, although I fixed that meanwhile.)
    Here is the conversion for the notes, if the transpose (key displacement) value is set to 0 in S3K:


    D2 -> D1 (PSG freq. $10 -> $11)
    D3 -> D2 (PSG freq. $0)
    D4 -> D2 (PSG freq. $0)
    If you don't do that conversion, it will read from the code section, although you can be lucky and it still sounds fine. (something that xm4smps conversions prove, btw)
     
  3. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    Bumping this since a very certain *REMOVED UPON REQUEST* decided to attack my host with false claims. Naturally, this meant the link died, so I apologise for that. That being said, I've reuploaded them here with thanks to temp hosting by Spanner.
     
    Last edited by a moderator: Jan 8, 2014
  4. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    I've no idea who that is. Seriously, I don't.
     
  5. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    It's a lot better like that.
     
Thread Status:
Not open for further replies.