Basic Questions and Answers Thread

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

  1. Unlimited Trees

    Unlimited Trees Banned for being a fucking cockwomble Exiled

    Joined:
    Apr 2, 2016
    Messages:
    168
    Location:
    A tree field in the middle of nowhere
    For changing the level size, I think you have to change the level size array which is in the lvl_size.bin thing, though I don't know how to mess with that stuff.

    As for the palette thing, if you're talking about changing the palettes of the tiles, just click on one of the palettes lines on the top of the thing and the colors of the tiles in the tiles section will change. You could also change the palette of a tile when placing it in a block (where it says "Palette:")
     
  2. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    In misc/lvlsize.bin, you can edit the level size. Each act uses $12 bytes and in each $12 bytes the 5th and 6th bytes are use as a word to determine the level length. Increase the value to increase the level size. When opening this file, it's best to set length of the hex editor to $12 bytes instead of the standard $16 so all the values line up vertically.
     
  3. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    you can edit the level size, I personalty have not done this in while so it's kind of blury , but like Unlimited trees said you need to find "lvl_size.bin" which is located in the "misc" folder. this file basically contains the size for each level in the game. however you will have to change the values through a hex editor so you better download one of those if you don't got one. once you open the file in the editor you will need to change the X and Y position's values, every 12 bytes represent 1 act of each zone in order. for example at the beginning of the file "00 04 00 00 24 bf 00 00 03 00 00 60 " are the values of GHZ act 1, after that "00 04 00 00 1e bf 00 00 03 00 00 06 " are the values for act 2 and so on. if you didn't understood any of that then i'll try to break it down. you see , each 3 bytes is 1 value of something in the stage . I am not sure what all this values means, but if you want to change the horizontal size then you will need to change the 4th and 5th bytes (in GHZ1 fir example its "00 24 bf" or $24bf) if you increase this number then stage should be longer, if you want to determined what is the best value to change it, you can look it up on SonLVL, if you look at the top left corner the program provides the vertical and horizontal position of where you are pointed at in the program, so just go to where you think will be a reasonable size and take the value from there. if that's not good enough for you. you can always use Debug Mode. yes, in Debug Mode the Score is replaced with the X and Y positions of both Sonic and the camera.

    well, I don't have much time to continue writing this, so if you need to change the Y position then respond and I may continue this. Hopefully my explanation wasn't to complicated because I am usually not the best at explanation
     
  4. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    To be clear, what everyone there is talking about is the camera boundaries, if you're asking how to physically expand the size of the level data in the editor, you can find that in "Edit -> Resize Level...", if you need the level to be larger than 64x8 chunks, you'll need to modify the game's code to accept larger sizes.
     
    HackGame and Baraksha like this.
  5. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    I've been wondering if this is possible and if it should be done:
    1. Remove the option to select a tile's priority in a block
    2. Make every tile in the foreground have a high priority and every tile in the background have a low priority which would, while somewhat limiting options, allow for background-only objects (like Ristar's birds in the first level)
    3. Use the available bit to enable shadow mode for selected tiles, expanding the number of colors onscreen
    I don't know how flexible shadow mode is but, considering how many games are able to use it reliably, I believe this could be done.

    Edit: I think shadowing a transparent pixel shadows whatever's behind it so I guess that's a limitation or a feature depending on how you want to use it.
     
    Last edited: Jan 11, 2017
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    You can remove the priority bit from blocks and use it for something else, but trying to use it for shadow mode control is where the irony comes in. Because what controls the status of the tiles becoming shadowed or not, is whether or not it's high or low priority. Shadowing is controlled by the tile's priority, and in relation to the planes/sprites priority above it. They are... "intertwinned" so to speak.
     
    Pacca and ProjectFM like this.
  7. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Question about SMPS2ASM (or SMPS in general)
    Is it Possible to have More than 6 FM channels, More than 3 PSG channels, & More than 1 DAC channel, probably through SMPS2ASM & editing the ASM (since i am bad with HEX editing)?
     
  8. Devon

    Devon You are the perfect drug Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    Due to hardware limitations, you cannot add more sound channels. You can add support for extra tracks in the music and SFX data and try to mix them to fit the limitations (I guess like how GEMS does it. GEMS uses Dynamic Voice Allocation to fit (I think 16) tracks into the limited number of channels on the Genesis).

    'What about Dual PCM? Doesn't that add an extra DAC channel?" you may ask.

    Dual PCM takes 2 DAC samples and mixes them to fit into the 1 DAC channel, so you can add an extra DAC track, and Dual PCM will take the current 2 samples that are set to be played and mixes them into 1, so there's still 1 DAC channel, it just mixes 2 samples together into 1 so make it seem like an extra DAC channel is there.

    Also, it's either 5 FM channels and 1 DAC or 6 FM channels and no DAC. FM6 is either an FM channel or a DAC channel.
     
    Last edited: Feb 4, 2017
    AURORA☆FIELDS likes this.
  9. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    It is actually possible to have 4 PSG channels, but not many sound drivers implement this... SMPS didn't, s you'd have to add support manually.
     
  10. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,015
    IIRC SMPS-Pico and SMPS-SMS/GG did. You can use those as reference for implementing it into your driver.

    My Clone Driver v2 supports having six FM tracks and one DAC track defined, you just shouldn't play something on both at the same time.
     
  11. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Yes, but using the 4 PSG channels at the same time is most definitely a bad idea. The third melodic PSG channel comes at the cost of an almost unusable PSG noise channel, so the soft limit (2+1 or 3+0) imposed by the Mega Drive/Genesis version of the SMPS driver makes actually more sense than it might appear. At most, I'd like to see a coordination flag which would allow to switch from 2+1 to 3+0 on the fly, since there is a flag which does the vice-versa (e.g. you can start a song with 3 melodic PSG channels, and switch to 2 melodic PSG + one PSG noise channel in the middle of the song).
     
  12. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    According to the SCHG on Sonic Retro, Sonic 3 allows you switch between noise and PSG 3. It's only in Sonic 1 and 2 that you can't switch back. I wonder if this is used in any of Sonic 3's music.
     
  13. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    It entirely depends on what you redeem as being a "channel".

    The 6 FM channels themselves control 4 operators, each operator can be controlled and ouput independantly, or fed into another operator, using the algorithm, allowing you to divide the channel up into 2, 3 or even 4 different idepenantly controlled outputs. Obviously, the more you divide the channel feeding up, the less complex the sound will be, however, each operator controls; the multiple (a multiplied pitch), and the various attack/decay/release/total volumes. So you have some form of independant control over each sinewave output (or each duo/trio group), the multiple may be a bit of a challenge. FM channels 3 however, has a mode to allow each operator to have its own frequency, instead of using the multiple, this allows you to control the pitch of each mono/duo/trio/quad operator group independantly to your needs.

    Just an example here, you could have operators 1 fed into 2, and 3 fed into 4, and treat 1/2 as a single channel of it's own, independant of 3/4. Or, 1 fed into 2, and 3 and 4 independant, giving you 3 independantly controlled sounds, or, all channels independantly. However, an operator on its own will only generate a sinewave, and nothing complex. You also won't be able to control the panning independantly. I would at this stage argue that the PSG's first three channels outputs nothing but squarewaves and has no panning support, so, you'd have basically a form of PSG on a single channel of the YM2612 (in essence). You may also try reducing the frequency of a channel to 0000 ensuring that the sinewave position has maxed out first, and with realtime control over the operator's volume, you should be able to create more complex sounds through one operator (probably going as far as pushing PCM sample data through it, though I'd imagine the audio quality wouldn't be so good since the early models have the residual ladder effect in play, so you may need to keep it simple).

    It should also be noted that while having the DAC enabled, does disable FM6, it only disables its output audio. The internal sinewave generator and operator controls equally as if it were off, meaning, if you played a note on FM6 that has a gradual decay for example, and you switch to DAC to play a sample for a brief moment, and then switch back to FM6, you'll find that the channel was still decaying, and that having DAC on merely muted the channel, but did not disable it. When I wrote my sound driver, I had FM6 and 2 PCM (DAC) tracker channels running, and had the driver automatically enable/disable DAC when samples played/stopped, this did become useful for drum rest sections where a percussion instrument will only briefly play minorly while you use the FM6 to play an instrument/note.

    The DAC of the YM2612 is nothing more than a port, meaning, it outputs the electrical pulse equal to what's in the port at a regular constant basis, and changing the pulse has to be done by software. This provides you with addition control over the samples, any effect with sample audio (if you can do it quick enough) can be done. Including; sample mixing which Sonic Boom nicely covered, this will in effect provide you with the ability to independantly control the playback of more than one specific sample through the one port, be it 2 or more.

    The PSG portion, has 3 squarewave tones that can be played independantly of each other (pitch/volume), and a noise channel which is also independant, though you are limited to 1 of 3 different pitches based on a fraction of the clock rate, clock/2, clock/4, and clock/8. With one of two different noises possible, periodic (which almost sounds like some sort of triangle wave), and white (static noise). Of course, you do have the forth option for the pitch, which allows it to use PSG 3's frequency. Both PSG 3 and 4 are still independant outputs, with independant volume controls, but they will share the same pitch. This mode does not disable PSG 3, but literally just lets PSG 4 use 3's frequency as its own.

    Writing new volumes to a PSG channel causes its wave to reset, this provides you with the advantage of controlling the output wave to some degree, you can create waves other than square, such as triangle, sawtooth, sine, or anything even sample based, but again, the quality will be limited, you may however use all 3 tone channels together to play a single sample to increase the bitrate output quality, again, far from perfect, but it works.

    The main subject here is what is a channel? What do YOU define as a channel? Do you define it has a fixed hardware slot, an imaginary tracker slot, or do you (like myself) consider it to be any sound of a particular independant control (no matter how limited)?

    With the above mentioned, your channel limits may surpass the intended amounts, it's all in how you look at it, and whether or not you'd be willing to make sacrifices to certain quality, to allow quantity.
     
    Last edited: Feb 4, 2017
    ProjectFM likes this.
  14. breakthetargets

    breakthetargets Well-Known Member Member

    Joined:
    Aug 6, 2009
    Messages:
    180
    Otterboi, most of the post seems correct but FM6 doesn't allow you to output each operator's frequency, only FM3. It is a common misconception due to the fact that people thought the YM2612 was two YM2203s added together, while the FM portion is actually much more similiar to the YM2608 instead.
     
    FireRat, ProjectFM and MarkeyJester like this.
  15. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I made a ROM and checked this for myself, and good lord, you're right!

    Well done~
     
  16. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Hi!
    I want to change my DAC voices, and i search a tool like SMPSplay.exe, but to listen at instruments, samples, voices..
    Is there a way?
    Thanks
     
  17. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    The best way to listen to DACs, is to use some regular music editing software, such as Audacity. Do mind, it MUST support RAW input. What you would do, is import the raw data, make it 8-bit unsigned, big-endian mono audio stream. You will have to look out for the sample rate, it is usually between 8kHz and 22kHz, but it may be difficult to find it out. Either through trial and error or by looking at the code and trying to figure it out based on it. Do not, some samples may actually be 4-bit DPCM, so you will need something like Vladikcompers dpmc2pcm converter in order to listen to them. At least, I do not know any application that can play back 4-bit samples. You'd also be surprised that you can actually listen to most if not all PWM samples from 32X games, because the poor sods didn't use the DMA features of PWM and just converted the sample from 8-bit PCM to PWM...

    Though theoretically you could build you own listening thing on the Mega Drive to play samples directly, and control a few variables to make it faster but... Its still hardly as effective and you need to still build the ROM, open an emulator, and fiddle around with settings anyways.
     
    Ashuro likes this.
  18. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Oh thank you!

    It works, by this way:

    Put the DAC file into DPCM2PCM, import it to Audacity in raw unsigned 8bit PCM, bid-endian mono and set 8000Hz.
    EDIT: for the Kick, you need to use 8000hz and for the Timpani you need 22050Hz :)
    (But this is boring, because i have a lot of DAC voices :p )
    Thank you Natsu!
     
    Last edited: Feb 5, 2017
    MarkeyJester and Misinko like this.
  19. ValleyBell

    ValleyBell Well-Known Member Member

    Joined:
    Dec 23, 2011
    Messages:
    166
    The easiest way (for me) to test DAC sounds was to write a small SMPS file in hex (Sonic 1 format) that just plays every possible DAC note for $40 ticks. (If you use a tempo of 01 02 that makes about 2 seconds per sample.)
    I recommend to make multiple files that play certain ranges. (I have separate files for DAC 81-90, 91-A0, A1-B0, etc., but that's still a lot of samples per file if you just want to listen to a certain sample.)

    You can play the SMPS with SMPSPlay or in a ROM, so it's pretty easy to use.
     
    Ashuro likes this.
  20. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Thank you ValleyBell, i'll try this method