Quantcast

Page 1 of 4 1234 LastLast
Results 1 to 15 of 51

Thread: Digital Sample Quality: Genesis Vs.CD Vs. 32x

  1. #1
    Hero of Algol kool kitty89's Avatar
    Join Date
    Mar 2009
    Location
    San Jose, CA
    Age
    32
    Posts
    9,725
    Rep Power
    65

    Default Digital Sample Quality: Genesis Vs.CD Vs. 32x

    How does the sample playback capabilities of the YM2612 channel 6 DAC, CD's RF5C164, and 32x's PWM DACs compare in terms of quality and ease of programming?
    (I know the PSG has limited PCM playback capabilities too -using the noise channel iirc, like the NES and others, but it was very poor)

    I immagine the CD's audio capabilities are the best (which seem very similar to the SNES's), with the 32x's second, and the YM2612's last. (though I've heard that the quality on the latter is often limited by programming, and sounds worse than it could)

    Also, on the 32x's PWM channels, I've heard that there are a possible 2 channels (1 mono channels or 2 channels with stereo), but I noticed in the (unusually detailed) sound test in Knuckles Chaotix that PWM channels 1-4 are listed...

  2. #2
    Shining Hero Joe Redifer's Avatar
    Join Date
    Dec 2005
    Location
    Denver, CO - USA
    Posts
    13,160
    Rep Power
    131

    Default

    Moving thread since this really isn't a technical problem and hopefully it'll get more views and some good answers as well.

  3. #3
    ding-doaw Raging in the Streets tomaitheous's Avatar
    Join Date
    Sep 2007
    Location
    Sonoran Desert
    Age
    45
    Posts
    3,981
    Rep Power
    78

    Default

    Quote Originally Posted by kool kitty89 View Post
    How does the sample playback capabilities of the YM2612 channel 6 DAC, CD's RF5C164, and 32x's PWM DACs compare in terms of quality and ease of programming?
    (I know the PSG has limited PCM playback capabilities too -using the noise channel iirc, like the NES and others, but it was very poor)
    The NES had a true separate sample playback DAC channel. It's 7bits if you directly wrote to it. It also has a mode that uses 1bit deltas and actually feeds itself without CPU intervention, only generating an IRQ when bank limit is reached (used for swapping out the memory segment and continuing playback for longer samples).

    Also, on the 32x's PWM channels, I've heard that there are a possible 2 channels (1 mono channels or 2 channels with stereo), but I noticed in the (unusually detailed) sound test in Knuckles Chaotix that PWM channels 1-4 are listed...
    Waveforms accumulate. If you have a single DAC/channel, then you can mix more channels via software on that same output.

  4. #4
    ESWAT Veteran Chilly Willy's Avatar
    Join Date
    Feb 2009
    Posts
    6,744
    Rep Power
    79

    Default

    Quote Originally Posted by kool kitty89 View Post
    How does the sample playback capabilities of the YM2612 channel 6 DAC, CD's RF5C164, and 32x's PWM DACs compare in terms of quality and ease of programming?
    YM2612 DAC:
    ===========
    A single 8 bit DAC that can be output to the left, right, or both. There's no timing or volume. You enable the DAC, set L/R/M, then start storing the PCM to the DAC register.

    Pros: Very easy.
    Cons: No volume - if you need volume control, it has to be done in software, which reduces the accuracy. No timing - your routine sets the sample rate... which means the routine has to account for cycles or your sample rate will vary, causing distortion in the sound. No DMA - the CPU has to set every single sample.

    So while the YM2612 DAC is simple, it also doesn't give good results unless you write very tight and clean code.

    CD PCM:
    =======
    Eight 8 bit PCM channels with 8 bit volume control and 8 bit pan control (4 bit left & 4 bits right). Waveforms are stored in PCM RAM, you have very good timing up to 32 kHz, and the ability to loop waveforms.

    Pros: Eight channels with volume and panning, and a decent sample rate (for the time). Samples can be looped. The samples are fetched by the PCM chip, so very little CPU time is consumed to play the samples.
    Cons: A bit more work to use. You have to load the sample into the PCM RAM, of which you have 64 KB. The small size of the RAM limits the size and number of samples you can play without needing to reload the RAM. The samples themselves are a little odd: they are 8 bit sign/magnitude samples. The msb is the sign (positive or negative), and the other seven bits are the magnitude (amplitude) of the sample. That's not a very widespread format, so all your samples will need to be converted. Also, 255 is reserved as the loop marker. When 255 is fetched from the sample RAM, the sample address is set to the loop address and sampling begins at that new location. That means if a sample DOESN'T loop, you need to store an extra zero sample and set the loop address to it.

    So the CD PCM is a bit more complicated, but worth the extra effort as you get the ability to play samples at almost any rate with no jitter, and with very little CPU usage. The main limitation is the amount of sample RAM.

    32X PWM:
    ========
    Two channels of audio, left and right. There is a "mono" channel, but all it does is set both the left and right channels to the data written into the mono channel. There is no volume control. The timing is set by setting a count, which is the main CPU clock divided by the sample rate. The left and right channels can be any value from 1 up to the count. So the "bits" of the channels isn't set like the other sound sources. The samples can be set using any CPU (including the Z80), or by DMA (I had problems using the DMA, so I'm not 100% sure if you really can use the DMA). The sound channels have a FIFO and status bits so that an even sample rate can be maintained, even with sloppy code.

    Pros: You can have better than 8 bit samples, and high sample rates. Relatively easy to program.
    Cons: No volume - like the YM2612, if you want volume, you have to do it in software. The sample format is a bit odd. You have to convert the samples into PWM format. For example, let's say you want to output at 22050 Hz. That gives a count of (NTSC) 23.01 MHz / 22050 Hz = 1043. This means that samples can be 1 through 1043, where 1 will give the lowest amplitude, and 1043 the highest. So you COULD make your samples 10 bits (10 bits gives 0 to 1023), or you COULD take four 8 bit channels and add then together (8 bits gives 0 to 255, so four of them gives 0 to 1020). That is generally what you see games do - add together multiple 8 bit channels in software, then offset them a little for the PWM output.

    So 32X PWM can be rather flexible about the sample rate and samples. It can generate a decent output with little/moderate/heavy CPU overhead (depending on if you're adding channels and/or doing volume). However, it's even more odd than the CD audio. However, it's worth a little extra study.

  5. #5
    Shining Hero Joe Redifer's Avatar
    Join Date
    Dec 2005
    Location
    Denver, CO - USA
    Posts
    13,160
    Rep Power
    131

    Default

    Question: Could the 32X approximate "CD quality" audio, ROM memory nonwithstanding? If not, could it come closer than, say, the SNES sound chip? Could the SNES sound chip come closer than the NEO GEO PCM?

    I realize we are straying from the Sega systems here and I am the one who moved this to the Genesis forum, but it is fun to compare everything. If it strays too far I'll move it to the General Gaming forum or whatever we call it.

  6. #6
    Hero of Algol kool kitty89's Avatar
    Join Date
    Mar 2009
    Location
    San Jose, CA
    Age
    32
    Posts
    9,725
    Rep Power
    65

    Default

    Quote Originally Posted by Joe Redifer View Post
    Question: Could the 32X approximate "CD quality" audio, ROM memory nonwithstanding? If not, could it come closer than, say, the SNES sound chip? Could the SNES sound chip come closer than the NEO GEO PCM?
    From what I've read the SNES's audio capabilities are very close to the Sega CD's (not counting CD-DA), with both having maximum 32 kHz sample rates.

    The SNES has an S-SMP which uses an 8-bit Sony SP 700 with a 16-bit DSP with 64 kB of SRAM for storing samples in compressed BRB format. (I assume the samples are in 8-bit format) The system mixes 8 individual voices (channels) into a 16-bit waveform in stereo with a 32 kHz sample rate.

    As listed above the CD had 8x 8-bit PCM channels with a 32 kHz sample rate and 64 kB of ram (albeit w/out the compression of the SNES), however since it has a 16-bit DAC I would assume it also ouputs a 16-bit waveform. (but I'm not sure)


    The 32x's PWM won't be able to acheive CD-DA audio quality, that's encoded in a 16-bit format at a 44.1 kHz sample rate. So based on Chilly Willy's discription, it would require a CPU running at 2.89 GHz!

    Of course you could acheive a 44.1 kHz sample rate, but you'd only get a single 9-bit channel (or 2x 8-bit ones to mix) when using one of the 23 MHz SH-2's, if I understand this right.


    Chilly Willy,
    So there are 2 seperate PWM channels available, each capable of mixing multiple indevidual channels depending on how high the resolution and sample rate you choose. (and which CPU, as the SH-2's are the only ones fast enough to generate 10-bit). Would this mean that to get 2x 10-bit channels with 22,050 kHz sampling, both SH-2's would needed to be used? (and the sample resolution and sample rate are only dependent on the clock speed, no matter which procesor is used?)

    Thus the 68000 would be capable of a single 8-bit channel with a 30 kHz sample rate? And the Z80 could do an 8-bit channel at 14 kHz sampling? (or 7-bit at 28 kHz?)
    Last edited by kool kitty89; 04-25-2009 at 05:40 AM.

  7. #7
    ding-doaw Raging in the Streets tomaitheous's Avatar
    Join Date
    Sep 2007
    Location
    Sonoran Desert
    Age
    45
    Posts
    3,981
    Rep Power
    78

    Default

    (I assume the samples are in 8-bit format)
    The samples are 16bit format per sample (the original ADPCM saturated(or wrapped depending on the hardware decoder) to 10bit and 12bit). The '4bit' value is a delta, accumulating into an index to another delta layer (the actual sample), that itself accumulates. It's a variant of ADPCM in that it adds per block filtering typing and repeat markers. ADPCM is pretty good compression relative to its uncompressed source, then add in filtering and it's even more accurate to its original form. But the 64k ram has nothing to do with streaming audio. You just need to transfer 154bytes per frame (vblank interrupt).

    Thus the 68000 would be capable of a single 8-bit channel with a 30 kHz sample rate? And the Z80 could do an 8-bit channel at 14 kHz sampling? (or 7-bit at 28 kHz?)
    I'm not sure how the CPU is relevant in any of that.
    Last edited by tomaitheous; 04-25-2009 at 08:29 PM.

  8. #8
    Go Get-Em! Wildside Expert philiptwood's Avatar
    Join Date
    Apr 2009
    Location
    Birmingham, Alabama
    Age
    44
    Posts
    137
    Rep Power
    13

    Default

    I would rather use the M68K for something else other then audio purposes... Not that the thought haven't crossed my mine though; here's a website of a synthesizer that started on an Amiga computer as a synthesizer simulator using the M68K so it's certainly possible for Motorola 68000 to produce audio. I'd rather use it for game logic and AI, stuff like that.

    http://www.finished.nl/
    Some call me PTW-ACE.

  9. #9
    Hero of Algol kool kitty89's Avatar
    Join Date
    Mar 2009
    Location
    San Jose, CA
    Age
    32
    Posts
    9,725
    Rep Power
    65

    Default

    Quote Originally Posted by tomaitheous View Post
    I'm not sure how the CPU is relevant in any of that.
    I was referring to Chilly Willy's explanation, though perhaps I misunderstood.

    Quote Originally Posted by Chilly Willy View Post
    The timing is set by setting a count, which is the main CPU clock divided by the sample rate. The left and right channels can be any value from 1 up to the count. So the "bits" of the channels isn't set like the other sound sources. The samples can be set using any CPU (including the Z80), or by DMA (I had problems using the DMA, so I'm not 100% sure if you really can use the DMA). The sound channels have a FIFO and status bits so that an even sample rate can be maintained, even with sloppy code.

    For example, let's say you want to output at 22050 Hz. That gives a count of (NTSC) 23.01 MHz / 22050 Hz = 1043. This means that samples can be 1 through 1043, where 1 will give the lowest amplitude, and 1043 the highest. So you COULD make your samples 10 bits (10 bits gives 0 to 1023), or you COULD take four 8 bit channels and add then together (8 bits gives 0 to 255, so four of them gives 0 to 1020). That is generally what you see games do - add together multiple 8 bit channels in software, then offset them a little for the PWM output.
    But does "main cpu" refer to whichever processor is actually being used as the CPU (depening on the configuration it will vary, but is usually one of the SH-2's, or both, I don't know if the 68000 can be used), or is it referring to the processor which is being used to set the samples.

    Edit: I was mistaken about the clock, it's always the SH2's 23.011 MHz signal that gets devided.
    Last edited by kool kitty89; 04-26-2009 at 12:05 AM.

  10. #10
    ESWAT Veteran Chilly Willy's Avatar
    Join Date
    Feb 2009
    Posts
    6,744
    Rep Power
    79

    Default

    Quote Originally Posted by kool kitty89 View Post
    As listed above the CD had 8x 8-bit PCM channels with a 32 kHz sample rate and 64 kB of ram (albeit w/out the compression of the SNES), however since it has a 16-bit DAC I would assume it also ouputs a 16-bit waveform. (but I'm not sure)
    For each of the eight channels:

    The channel's PCM sample magnitude is multiplied by the volume (7 bits x 8 bits -> 15 bit result). That 15 bit value then goes through two paths (Left and Right) where it is multiplied by the pan (4 bits x 15 bits -> 19 bits). The top 14 bits of that 19 bit result is added or subtracted (depending on the sample sign) from the 16 bit accumulator (which is limited to 0 and 65535).

    After all eight channels have been processed, the top ten bits of the accumulator is sent to a DAC. So in the end, the output is 10 bits. The notes about the 16 bit DAC in the CD is for the CDDA audio, not the PCM.


    The 32x's PWM won't be able to acheive CD-DA audio quality, that's encoded in a 16-bit format at a 44.1 kHz sample rate. So based on Chilly Willy's discription, it would require a CPU running at 2.89 GHz!

    Of course you could acheive a 44.1 kHz sample rate, but you'd only get a single 9-bit channel (or 2x 8-bit ones to mix) when using one of the 23 MHz SH-2's, if I understand this right.
    That is correct.


    So there are 2 seperate PWM channels available, each capable of mixing multiple indevidual channels depending on how high the resolution and sample rate you choose. (and which CPU, as the SH-2's are the only ones fast enough to generate 10-bit). Would this mean that to get 2x 10-bit channels with 22,050 kHz sampling, both SH-2's would needed to be used? (and the sample resolution and sample rate are only dependent on the clock speed, no matter which procesor is used?)
    It is better to think of it as ONE STEREO CHANNEL, not two independent channels. They both use the same count, which means they run at the same rate at the same time. You can disable one side or the other, or flip the sides, but they are still linked together.

    Thus the 68000 would be capable of a single 8-bit channel with a 30 kHz sample rate? And the Z80 could do an 8-bit channel at 14 kHz sampling? (or 7-bit at 28 kHz?)
    You mean with the 32X PWM? The count is always based on the SH2 clock. No matter the source of samples, the width (count) will always be 23.01 (NTSC) / rate. The FIFOs for the samples are a word wide, and are arranged in the 32X registers as LEFT followed by RIGHT, meaning you can write to both with a single longword write by either the 68000 or the SH2. The Z80 obviously only writes a byte at a time, so it would have to write the upper byte for one channel, the lower byte for the same channel, then the upper byte for the other channel, and last the lower byte for that channel (or just the upper and lower bytes of the mono register).

    So the Z80 or 68000 can do the same output as the SH2... for example, the aforementioned 10 bit 22050 Hz samples.

  11. #11
    Mastering your Systems Shining Hero TmEE's Avatar
    Join Date
    Oct 2007
    Location
    Estonia, Rapla City
    Age
    32
    Posts
    10,101
    Rep Power
    112

    Default

    Quote Originally Posted by Chilly Willy View Post
    The samples themselves are a little odd: they are 8 bit sign/magnitude samples.
    So that's how this freak format is called... nice mix of signed and unsigned data........


    Regarding PCM from YM2612, it sounds poor in most games simply because of poor code since there's absolutely no help from hardware whatsoever regarding playback. There are some games that have really good sample playback though, such as Atomic Runner, which uses Z80+68K driver, where Z80 is doing nothing but managing sample playback and 68K does all the rest.
    Death To MP3, :3
    Mida sa loed ? Nagunii aru ei saa "Gnirts test is a shit" New and growing website of total jawusumness !
    If any of my images in my posts no longer work you can find them in "FileDen Dump" on my site ^

  12. #12
    ESWAT Veteran Chilly Willy's Avatar
    Join Date
    Feb 2009
    Posts
    6,744
    Rep Power
    79

    Default

    Quote Originally Posted by TmEE View Post
    So that's how this freak format is called... nice mix of signed and unsigned data........
    Which is why I called it odd.

    You see this format more often in signal processing where ABS() functions appear as the function merely becomes ignoring the sign bit. I've a number of digital video processing circuits (comb color filters, for example) that use this format.


    Regarding PCM from YM2612, it sounds poor in most games simply because of poor code since there's absolutely no help from hardware whatsoever regarding playback. There are some games that have really good sample playback though, such as Atomic Runner, which uses Z80+68K driver, where Z80 is doing nothing but managing sample playback and 68K does all the rest.
    Yeah. That's why I mentioned tight code being something you need for YM2612 DAC playback... IF you want it to sound good.

  13. #13
    Outrunner
    Join Date
    Jun 2008
    Posts
    678
    Rep Power
    23

    Default

    Quote Originally Posted by Joe Redifer View Post
    Question: Could the 32X approximate "CD quality" audio, ROM memory nonwithstanding? If not, could it come closer than, say, the SNES sound chip? Could the SNES sound chip come closer than the NEO GEO PCM?

    I realize we are straying from the Sega systems here and I am the one who moved this to the Genesis forum, but it is fun to compare everything. If it strays too far I'll move it to the General Gaming forum or whatever we call it.
    Dunno about the machines you've mentioned but I know that the 8-bit Paula chip in the Amiga can achieve MP3 playback that is very close to CD quality. Processor overhead is very high to do this as the software mixes the four independent 8-bit channels to produce stereo 12-bit channels, all at the same time as decoding an MP3 file. You need much faster than a stock 68k processor to do this; I've only tried it with a 68060 but you could probably get away with it by using a 40Mhz '040. Not bad for a sound chip first produced in 1984 though!

  14. #14
    ESWAT Veteran Chilly Willy's Avatar
    Join Date
    Feb 2009
    Posts
    6,744
    Rep Power
    79

    Default

    Quote Originally Posted by crazyteknohed View Post
    Dunno about the machines you've mentioned but I know that the 8-bit Paula chip in the Amiga can achieve MP3 playback that is very close to CD quality. Processor overhead is very high to do this as the software mixes the four independent 8-bit channels to produce stereo 12-bit channels, all at the same time as decoding an MP3 file. You need much faster than a stock 68k processor to do this; I've only tried it with a 68060 but you could probably get away with it by using a 40Mhz '040. Not bad for a sound chip first produced in 1984 though!
    Incorrect. "14-bit" mode was produced by setting two of the channels to data, and the other two to volume effects mode. The volume is a 6 bit log curve, so the best audio was had by converting the 8 bits to 6 using a table set to the inverse log. This has the effect of reducing the effective sample from 14 bits to about 12 bits, but improves the sound. This is all done via a simple lookup table, and played back via DMA, so it was easily accomplished on a 68000. The basic decompression (mp3, ogg-vorbis, whatever) is what took all the CPU power, not the "enhanced" Paula output.

    Adding four 8 bit channels wouldn't give you 12 bit output in any case - it would give you 10 bit output... IF you could do mono... which the Amiga can't. Two channels ALWAYS go to right, and the other two to the left. So adding channels together would allow 9 bit stereo. As I explained above, you use the chained channel effects to do better output. There are two effects that could be chained: use one channel to modulate the period (for a tremolo effect), or use one channel to modulate the volume (for AM effect). By using the same period for the AM as the channel being modulated, you in affect change the volume for every single sample, allowing for 14 bit non-linear audio.

  15. #15
    Raging in the Streets Aarzak's Avatar
    Join Date
    Jun 2007
    Location
    NYC
    Age
    35
    Posts
    2,513
    Rep Power
    37

    Default

    So (considering my mind boggles at trying to understand everything in this thread so far!), the 32X's sound hardware is actually easier to use than most thought? Most developers (like Probe in their lazy 32X ports of MKII & Primal Rage) used it for clearer and/or added voice samples, while the Genny did the music (early games such as "Cosmic Carnage") entirely or recycled music from the Genny ports (again, MKII & Primal Rage). Some utilized a nice mix of the Genny's sound and added instruments and samples from the 32X (WWF RAW & Wrestlemania, Knuckles Chaotix, Tempo) while very few used it all out ("After Burner Complete" OMG at the crisp, sharp samples and blasting stereo w/very little help from the Genesis hardware, and this is from only 2 channels on the 32X?).

    So yeah, up until now the 32X sound hardware (and the Sega CD sound hardware, when it WASN'T used to just play back Redbook music i.e Sonic CD, Silpheed) were mysteries to me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •