Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Roxurface

    Roxurface Well-Known Member Member

    Joined:
    Oct 5, 2014
    Messages:
    69
    More music questions: How do I go about changing the "instrument" of the PSG channels using mid2smps? From what I understand, there's different sounds that the PSG can make than just "square wave" especially since, for example, Marble Zone's PSG sounds different in its original form than when converted to midi through smps2mid and back to SMPS. The Readme for mid2smps only mentions this in one place:

    20/32 Bank Select LSB
    [FM] Set instrument range for unmapped banks (Bank Select MSB 50/51)
    00 - use instruments 00..7F
    01 - use instruments 80..FF
    [PSG] Set PSG Tone (only for instrument changes >= 50 [81 Square Wave])

    I am unsure how to interpret this information. I am sure the answer is painfully obvious just like most of my questions, but you guys have been such a big help.
     
  2. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    The way PSG 'instruments' are handled, is by code which changes PSG volume each frame. This is a very limited technology and does not allow for complex instruments, but it can create nice hi-hats and background sound/backing tune for FM channels (even echoes!). Thus system is very unlike the FM voice system, and is handled differently in mid2smps. You can use the original envelope data, or create your own fairly simply. I am not quite sure on how mid2smps handles this though, but I remember there was some setting or menu for either 'PSG tones' or 'volume envelopes'.
     
    EMK-20218 likes this.
  3. AkumaYin

    AkumaYin Well-Known Member Exiled

    Joined:
    Aug 21, 2014
    Messages:
    157
    If I recall correctly, the number of the MIDI patch used on a channel that's being converted is what's used to determine which envelope to set for the output channel. For instance, "Acoustic Grand Piano" is 001, and therefore would equate to the first envelope of the set you're using (Sonic 1 in this case). Or you could use the square wave patch, but from what I can tell doing so defaults to the first envelope (?). Mid2smps comes with a tool that allows you to view and edit PSG envelope lists along with being able to visualize the square waves for each.

    Looking at the original song outputted from smps2asm, it seems like the eighth envelope is used, so using the "Clavi" patch in your MIDI should get you pretty close to the original sound.
     
  4. ValleyBell

    ValleyBell Well-Known Member Member

    Joined:
    Dec 23, 2011
    Messages:
    166
    The documentation is indeed unclear about how it works. (partly because of a fallback mode for smps2mid)
    And the fact that the readme uses hexadecimal numbers for everything doesn't make it easier, I guess.

    At first a general note: All SMPS-based games come with a set of predefined PSG envelopes. They are hardcoded into the sound driver, but you can customize them. Changing existing ones will affect all songs though.
    Sonic 1 has a total of $0A PSG envelopes that use IDs 00 to 09. PSG envelope 00 is a static tone, PSG 01 and higher are editable and only those are part of the PSG.lst files you can load into mid2smps.

    Anyway, there are 2 ways to select the PSG instrument:
    1. just set the instrument to 1..80 where 1 (Grand Piano) refers to the static PSG tone, 2 (Bright Piano) refers to PSG envelope 01, 3 refers to PSG envelope 02, etc.
      This is my preferred method.
    2. use instrument 81 (Square Wave) and use Bank Select LSB (MIDI CC #32) to select the PSG instrument (0 = static, 1 = PSG 01, 2 = PSG 02)
      This is a fallback mode that is supposed to make smps2mid → mid2smps conversions work. DAWs like FL Studio might break it though.
    An important thing to note is, that almost all MIDI editors count instruments from 1 to 128, but MIDI controllers (like Bank MSB/LSB and Main Volume) use a range of 0 to 127.
     
    Roxurface, EMK-20218, Niko and 2 others like this.
  5. Artemis

    Artemis Newcomer Trialist

    Joined:
    May 27, 2018
    Messages:
    2
    I'm trying to follow the guide here

    http://sonicresearch.org/community/index.php?threads/how-to-work-with-sram.1948/

    to add a simple save feature to my Sonic 1 hack, but I'm having an issue getting it to to work.

    First things off, I was able to get it to set the size of the SRAM and enable it following step 1, but then I got to step 2 (writing to and loading save data) and ran into a problem. I was not able to find loc_37B6 in the latest version of the disassembly via the search tool, nor was I able to find it in a bunch of slightly older versions of the disassembly. I feel stupid for getting stumped by such a simple problem, and even more so for asking for help, but I've been trying to get this to work for months now with out help, and have no more options. What am I doing wrong here?
     
  6. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    That guide was originally made with the 2005 Hivebrain disassembly in mind. You should be able to find it in there.
     
  7. rika_chou

    rika_chou Adopt Member

    Joined:
    Aug 11, 2007
    Messages:
    689
    loc_37B6 is Level_NoMusicFade in the newer dissasemblies
     
  8. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    Do you recommend any program to take the music from Sonic 3 & Knuckles to Sonic 2?
     
    Last edited: May 28, 2018
  9. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    I would recommend using SMPS2ASM, and set the "uncompressed" flag on the playlist in the sound driver code. Depending on the song, you may need to use SMPSConv to integrate the Universal Voice Bank voices into the song, and then use SMPS2ASM to convert it to ASM. You may also need to make some changes in the sound driver or SMPS2ASM macros to accommodate the S3K songs, I don't know exactly what the changes are, but the sound driver in Knuckles' Emerald Hunt has them, and the source code is available. Or you could be lame and use the Clone Driver v2.
     
    Clownacy and Niko like this.
  10. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    Hello everyone, again!
    I have a very small question:
    I'm trying to add Pachinko objects into CNZ to make a casino-esque zone. Is there a way to make the objects use their tileset from that minigame? Or would I have to add it to the tileset and remake the mapping?
     
    Last edited: May 29, 2018
  11. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    If the tiles are already loaded in VRAM, make sure the object's "art tile" points to there. If not, find some free VRAM space to load the art in to first.
     
  12. ROM hacking

    ROM hacking Newcomer Trialist

    Joined:
    May 5, 2018
    Messages:
    6
    Putting sonic in the lower section of the map causes an instant kill. It doesn't show up on the screen. Lower y-boundaries get reset dynamically. What's the option here?
     
  13. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Have you tried changing the lower Y boundary?
     
  14. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    The level bounds are modified in two ways; one is hardcoded in a list, and the other is handled by a "level events" routine, which modifies the bounds dynamically as the level moves on.

    The first is in "LevelSizeArray". It has all the hardcoded values used to initially setup the level bounds. I recommend examining the existing values, and seeing what they do in game to get an idea about how to edit them (for example, Scrap Brain Zones Y-wrapping is possible because of the values in this list).

    The second one is handled in "DLE_Index". It contains pointers to all the routines that handle level bounds. Keep in mind that other events (labyrinth zone water movement, boss spawning, etc.) are handled in these routines as well, so I don't recommend deleting or disabling them all together.
     
  15. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    A question, as I edit the "Sonic Wins" of Sonic 2 Special stage?
     
  16. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
  17. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    Thanks!
     
  18. Lunatic

    Lunatic Newcomer Trialist

    Joined:
    Jul 21, 2017
    Messages:
    5
    Just a question. What program would you all recommend using for changing the music in Sonic The Hedgehog (Sonic 1) and what sound driver do you all recommend using? The disassembly I am using is the GitHub disassembly.
     
  19. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    People commonly use MID2SMPS for converting MIDIs to the SMPS format. Also, XM3SMPS was at one point very popular. There is fair bit to learn with both methods to make music sound great, and instrument choice is very important to keep in mind. Third method is going with the SMPS2ASM route, which is my choice certainly, but for someone new to hacking, the difficulty and downsides may outweigh the benefits.

    As for sound drivers, there isnt anything too concrete out yet. Clone Driver v2 is one option, as is porting S3K or other drivers from games, but I am waiting to get my driver finished and ready for release, but that could be whenever...
     
    Lunatic and EMK-20218 like this.
  20. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    The disassembly doesn't make much of a difference in music, since the music format management doesn't differ from a source to the other one. I used XM3SMPS for a pretty long time in my life but I think it lacks many functionalities, so for the current moment I recommend to use the MID2SMPS tool for convert from MIDIs, the FL Studio for the MIDI file creation and editing, WinJammer Shareware (thanks to Joenick for the suggestion) and to install the Vladikcomper's Mega PCM sound engine for better management of the DAC Samples data. And also, Audacity for the DAC samples creation and conversion.

    These are suggestion only. Many options are available to be used according to your needs, so you choose what you think it would be better for you.
     
    Lunatic, Samey and AURORA☆FIELDS like this.