A problem with a music

Discussion in 'Discussion and Q&A Archive' started by SpirituInsanum, Sep 13, 2010.

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

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Edit: Solved this problem, see 3rd post for solution, please check 6th post for a problem porting spring yard's music.


    I have a problem converting the 5th fm channel of Star Light zone's music for the s3k driver. After the long trumpet sound, the music goes wrong on that channel and I can't manage to find the error.


    Here is the channel:


    -- -- EF 04 80 0C C4 C6 D0 EF 04 F8 68 90 CD 06


    EF 03 E6 EC F8 75 93 E1 14 C6 01 E7 E1 00 C6 05


    F8 99 93 B4 E6 07 B4 EF 03 E6 E8 FB CD 80 06 E1


    14 CD 01 E7 E1 00 CD 05 CE 06 CD CE D0 80 C9 80


    06 F8 75 93 E8 05 C6 03 03 E8 00 F8 99 93 EF 03


    E6 EF FB CD CD 03 CE D0 03 80 09 E1 EC D5 01 E7


    E1 00 F0 2C 01 04 04 D5 23 F4 E6 14 F6 0F 93 F8


    9E 93 B4 E6 07 B4 EF 03 E6 E8 FB CD 80 06 E1 14


    CD 01 E7 E1 00 05 80 06 E1 14 C9 01 E7 E1 00 05


    80 06 F9 C9 06 C6 80 06 E1 14 C4 01 E7 E1 00 02


    C6 03 E8 05 C9 03 C9 06 C6 03 C9 03 E8 00 C9 80


    E6 FC FB 33 EF 05 B4 03 E6 07 B4 E6 07 B4 E6 07


    F9 F6 C7 93 F6 CA 93


    The music's address in the bank is 9016, the channel begins at 9308 (2F2 relatively). The pitch/volume channel modifier is the same as the original, F4 20.


    In red is the long trumpet note, in orange and green are the two jumps after it and the address they're pointing at. The original values for the orange and green are FF9B and 0027 respectively. I guess the error is in that area since it's right at the end of the long note, but I really can't find it.


    Now, what it sounds like. At the end of the long trumpet note (red), the sound begins to vary, maybe it's related to the modulation before it (in blue), then the music on that channel continues with a wrong timing, highly treble notes and possibly modulation as well (which is weird since afaik, F4 should stop it).


    Does someone know what is wrong?


    edit: underlined changes
     
    Last edited by a moderator: Sep 16, 2010
  2. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    I myself have attempted to port SLZ to the Z80 driver, and got it working to some extent, but it sounded all screwy, and no trumpets at all.
     
  3. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    AAAAAH! Of course, the trumpet! xD


    Thanks, it isn't related at all, but it made me look at it from another standpoint, now it's fixed. -_-


    I only had to move the F4 after the F6xxxx pointer. I really don't know why though, and why I tried is beyond me (instinct, probably).


    Now, spring yard...
     
  4. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Are you porting these to sonic3k? or the s3k driver in sonic 1? because if so then you could trying doing a compare with the sonic 1 driver for the music you want for sonic 1 and the same for the s3k driver. Not sure if this works so anyone can say if I'm right or not. Theres proberly a better way to do it.
     
  5. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Hmm... how to say that... put s3k driver in s1, reimporting s1 musics to s1 with s3k driver.


    I can't find the s3k driver's source (pb #2 would be to be able to understand them), and I can't find what could be related to the flags in the 68k part of the code in s1's driver. I guess it's in the z80 driver. So I can only experiment according to what I read in the guides and what looks wrong to me. Comparing the two drivers would indeed probably help a lot.


    I already re-imported the first 4 musics, they don't sound exactly the same but they sound ok to me. Star Light is surprisingly almost identical to the original after fixing that detail.


    Now though, Spring Yard is completely wrong. There looks to be several reasons, the first two being that the tempo divider (e5xx) doesn't appear to change correctly (or maybe once changed it just sounds wrong), and there are two E2xx and an f9 which I can't find in the guides and have a different meaning in s3k's driver.


    I'm currently checking again all the pointers and f9/e3 nonetheless, maybe they're wrong, who knows? ^^'


    edit2: Does someone know where I could find either the sources or reliable informations about the coordination flags of the 2 drivers?
     
    Last edited by a moderator: Sep 19, 2010
  6. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    I can't find a way to fix Spring Yard's music. Three channels are pointing at the same part, and that part is unfortunately wrong. And it sounds so awful that I can't fix the previous channels properly either.


    I'm not good at analyzing sound, but to me, it's like the notes of that part are being slowed down, when they should be faster instead. The music is wrong from the very first notes on that channel, so it has to be near the beginning (considering the jumps).


    Here's the channel that contains the wrong part, I tried to comment it to find what could be wrong (please, tell me if you notice a mistake). Addresses in comments are relative to the beginning of the file:



    E0 80 ; left channel !!!! 1 !!!!
    E1 03 ; add 3 to frequency ? !!!! 2 !!!!


    F8 3F97 ; jump to 2BC >>


    E1 00 ; add 0 to frequency ?


    F0 01010104 ; modulation ; << 23F


    EF 02 ; change current voice to 2


    F8 D896 ; jump to 255 ? >>


    E6 FC ; channel volume +4


    CB 02 ; music


    F8 FE96 ; jump to 27B >>


    E6 04 ; channel volume -4


    F6 C296 ; jump to 23F <<


    F8 EE96 ; << 255 ; jump to 26B >>


    D2 30 ; music


    F8 EE96 ; jump to 26B >>


    D6 03 80 D6 80 D6 80 D6 80 D6 03 80 13 ; music


    F9


    CD 24 CE 06 D0 CD 24 C9 06 CB CD 24 CE 06 D0 ; music ; << 26B


    F9


    F8 2297 ; << 27B ; jump to 29F >>


    80 13 CB 02 ; music


    F8 2297 ; jump to 29F >>


    80 C6 80 C7 04 C9 80 02 CB ; music


    F8 2297 ; Jump to 29F >>


    80 13 C6 0E CA 0C CD D6 0A D7 02 80 30 ; music


    F9


    80 04 CB 08 CB 03 80 CB 80 C9 80 D2 80 CE 80 07 C7 02 80 04 C7 08 C7 03 80 C7 80 C6 ; music ; << 29F


    F9


    EF 03 ; << 2BC ; change voice to 3 !!!! 3 !!!!


    E6 FE ; channel volume +2 !!!! 4 !!!!


    F8 4997 ; jump to 2C6 >>


    E6 06 ; channel volume -6


    F9


    E5 01 ; << 2C6 ; set tempo divider to 1 !!!! 5 !!!!


    AF 01 E7 AE 04 80 07 AF 01 E7 AE 04 80 07 B1 01 E7 B0 04 80 07 B1 01 E7 B0 04 80 07 B2 01 E7 B1 04 80 07 B2 01 E7 B1 04 80 07 B3 01 E7 B2 04 80 07 B3 01 E7 B2 04 80 07 ; music


    E5 02 ; set tempo divider to 2


    F9



    So, from what I read here, when the music begins, left sound channel is set (!!!! 1 !!!!), the frequency of the sound is slightly modified (!!!! 2 !!!!), then it jumps to 2BC where voice 3 is selected (!!!! 3 !!!!), then volume is increased (it works backwards, right? !!!! 4 !!!!), and finally the tempo divider is set to 1 (!!!! 5 !!!!).


    I know the tempo dividers in s1 and s3k aren't the same, though I don't really know much more about it (I read several things about it but it didn't help much). If I set bytes 4 and 5 of the music to 03 03 or 02 30, the music's tempo sounds to be the right one. I tried both but couldn't fix that channel.


    I tried by modifying the 4 flags before the E501, but that didn't help, and modifying the E501 itself doesn't seem to influence the music in any way. :/


    I also tried using EA instead (the parameters are a word in the format of bytes 4 and 5, right? MarkeyJester's guide and retro's music hacking how-to disagree on that point, tried both) but it didn't work either. I changed the instrument/voice, didn't help. I tried to move E501, not better. I also tried to modify the tempo instead, the result was really weird and immensely wrong.


    Any idea?


    EDIT:


    Fixed! It took me one full week but I fixed that stupid song and I heard it so many times, I'm so fed up with it that I had to change the last two instruments to xylophone and wood block from the uvb to make it less painful for me to hear, at least now it makes me laugh when I hear it.


    For those who wonder how to fix it, get rid of the e5xx, they don't work at all, then double the length of all notes but the ones that were requiring the e5's, get rid of the f4 near the beginning of the first channel (it crashes the sound), as well as the f9 that was in the original s1 file, swap a few functions where necessary, and finally correct the duration of the notes until the first channel is perfectly synchronized with the rest of the music (still have to put the finishing touches to this part myself, but that should be easy).
     
    Last edited by a moderator: Sep 20, 2010
Thread Status:
Not open for further replies.