How DAC works ?

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

How DAC works ?

Post by tryphon » Sat Jun 15, 2019 9:22 am

I have some questions about channel 6 DAC mode :

1) do you confirm there's a 9th bit of value at bit 3 of register 2C ? I don't see this register mentioned in most documentations, nor in VGM specs, in particular data blocks are byte based, does it mean that all YM2612 vgm dumps are wrong ?

2) if I want to translate those values in raw signal, how do I proceed ? Are they stored in a reverse-log form, like TL or SL values ?

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: How DAC works ?

Post by Sik » Sat Jun 15, 2019 3:56 pm

$2C is a test register (hence why it's "undocumented") and from what I gather the exact behavior differs between the two YM2612 variants used on the Mega Drive. No proper game will use it to attempt to boost the DAC either (especially as it prevents the remaining channels from being used for FM).

The value written to the DAC register is actually linear (although I forgot the exact maximum amplitude >.>). Well, as linear as the YM2612's actual DAC is, anyway.
Sik is pronounced as "seek", not as "sick".

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: How DAC works ?

Post by tryphon » Sat Jun 15, 2019 7:15 pm

Thank you !

nukeykt
Interested
Posts: 12
Joined: Thu Sep 20, 2018 10:42 am

Re: How DAC works ?

Post by nukeykt » Mon Jun 17, 2019 6:42 am

Sik wrote:
Sat Jun 15, 2019 3:56 pm
$2C is a test register (hence why it's "undocumented") and from what I gather the exact behavior differs between the two YM2612 variants used on the Mega Drive.
Well, both test registers are same across YM2612 and discrete YM3438. so i assume they're same on ASIC YM3438 too(it's different on YMF276 though, but it's not used on any official sega hardware afaik).
Sik wrote:
Sat Jun 15, 2019 3:56 pm
No proper game will use it to attempt to boost the DAC either (especially as it prevents the remaining channels from being used for FM).
LSB bit of DAC register does not interfere with DAC test register(aka stereo/loud DAC mode)

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: How DAC works ?

Post by Sik » Mon Jun 17, 2019 5:09 pm

I recall from tests that the amount of amplification seems to differ between discrete and integrated YM2612 tho (which can ruin attempts at using it, though I suppose you could try detecting which version it is by checking the behavior of reading back the status…), i.e. the register bits are fundamentally the same but the actual result seems to differ.

Then again we probably need to test this again if it's not written down somewhere…
Sik is pronounced as "seek", not as "sick".

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: How DAC works ?

Post by Stef » Tue Jun 18, 2019 7:48 am

Is not amplification always just 6x base DAC volume as all YM channels output DAC instead of just channel 5 ?
That could also be used to do stereo DAC by setting ch0-2 to LEFT and ch3-5 to RIGHT.. but then you need to be perfect sync for DAC update which is almost impossible to do (and it requires update at 106 Khz, i don't even know if DAC register can be updated that fast).

nukeykt
Interested
Posts: 12
Joined: Thu Sep 20, 2018 10:42 am

Re: How DAC works ?

Post by nukeykt » Tue Jun 18, 2019 11:06 am

Stef wrote:
Tue Jun 18, 2019 7:48 am
Is not amplification always just 6x base DAC volume as all YM channels output DAC instead of just channel 5 ?
That could also be used to do stereo DAC by setting ch0-2 to LEFT and ch3-5 to RIGHT.. but then you need to be perfect sync for DAC update which is almost impossible to do (and it requires update at 106 Khz, i don't even know if DAC register can be updated that fast).
For YM2612 amplification is ~24x, for YM3438 it's ~6x. IIRC, DAC register is updated within 4 internal cycles(24 master clocks), so In theory it's possible to output up to 319kHz audio in DAC test mode.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: How DAC works ?

Post by Stef » Tue Jun 18, 2019 9:31 pm

24x, that is *really* loud !
Ok i can understand the difference, YM2612 has gap in sound multiplexing.. maybe the YM3438 process the multiplexing differently (without any gap).
It's interesting to learn than DAC register can be updated that quickly, even if at that rate the Z80 can't follow ^^

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: How DAC works ?

Post by TmEE co.(TM) » Tue Jun 18, 2019 9:39 pm

YM2612 outputs for one cycle every 6 cycles (one channel time), while YM3438 output at 5 (at least I recall gaps between each channel) of these 6 cycles IIRC. This gives 3438 much better SNR and also makes it need much less amplification and easier filter to get good output level compared to 2612. The loud bit makes DAC output happen on every cycle.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Post Reply