Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
07378 Sound Major Always Jul 17, 2019, 01:59 22 days ago
Tester trebor View Status Public Platform MAME (Official Binary)
Assigned To Resolution Open OS Windows 10 (64-bit)
Status [?] Acknowledged Driver
Version 0.211 Fixed in Version Build 64-bit
Summary MESS-specific 07378: pokey.cpp: Inaccurate distortion playback.
Description The issue arise when using some distortions values in either 8-bit or 16-bit modes.
When using the pure tone setting (AUDC0=$Ax or $Ex) it sounds fine; however sound problems are present when using other distortion settings on AUDC0.
Values from $2x and $Cx (12a and 12b) in the attached spreadsheet (See zip archive file 'pokey notes.zip'), provides inaccurate results every time.
Steps To Reproduce The issue occurs for any platform utilizing POKEY chip in the ways mentioned in the aforementioned "Description" field.
Nonetheless, A7800 examples are provided in this report. Just load the ROM(s) contained in the zip archive(s) and playback accordingly.
Take note of the real hardware POKEY captures compared to what is heard for POKEY emulation under MAME from the wav files provided.
Additional Information Complete POKEY note table for all distortion settings:
https://atariage.com/forums/topic/216807-complete-pokey-note-table-for-all-distortion-settings/?do=findComment&comment=4315649

A good explanation of the $Cx distortion in POKEY:
https://atariage.com/forums/topic/212280-pokey-question-distortion-12-donkey-kong-bass/

More details and test file cases:
https://atariage.com/forums/topic/293427-pokey-16-bit-mode-and-other-audctl-settings-a7800-emulation/
Flags Verified with Original
Regression Version Always present(?)
Affected Sets / Systems pokey.cpp
Attached Files
zip file icon A7800_AtariAgeJingle_ROMs.zip (2,299 bytes) Jul 17, 2019, 02:03 Uploaded by trebor
ROM files
zip file icon atariage-jingle (20190708) Real HW.zip (2,038,971 bytes) Jul 17, 2019, 02:03 Uploaded by trebor
Real hardware playback of ROM files (x3)
zip file icon atariage-jingle (20190708) MAME 0_211.zip (2,449,664 bytes) Jul 17, 2019, 02:04 Uploaded by trebor
MAME 0.211 playback of ROM files (x3)
zip file icon pokey notes.zip (16,221 bytes) Jul 17, 2019, 02:05 Uploaded by trebor
Frequency values from a POKEY note table, mapped out using actual hardware.
zip file icon Arkanoid2LevelStartSoundDemo.zip (760,042 bytes) Jul 24, 2019, 18:01 Uploaded by trebor
POKEY 8-bit mode sample: Channels 0 and 1 are the lead sound, with SKCTLS put into two tone mode. Channel 2 is $CX base in 8-bit mode. Channel 3 is $AX lead detuned.
zip file icon RollingThunderIntroMelody.zip (3,512,470 bytes) Aug 14, 2019, 00:42 Uploaded by trebor
A rendition of the opening level theme from Namco's Rolling Thunder - See Notes below for more details.
Relationships
There are no relationship linked to this issue.
Notes
7
User avatar
No.16687
trebor
Tester
Jul 24, 2019, 18:03
Another sample/test case provided. It is a POKEY sound demo/sample of the Level Start theme of the game Arkanoid 2. The archive file uploaded 'Arkanoid2LevelStartSoundDemo.zip' includes two ROM files (*.BIN and *.A78) as well as two recorded clips. One recording taken from an Atari 7800 console and the other running under MAME.
User avatar
No.16750
trebor
Tester
Aug 13, 2019, 23:56
edited on: Aug 13, 2019, 23:59
At least part of the problems is SKCTL two-tone mode is broken.
This constant is defined for the relevant bit in SKCTL...

#define SK_FM 0x08 /* FM mode */

...but none of the MAME code base uses SK_FM at all.

Additionally, while many MAME devices normally get defined with clocks up front. In this mode, the second voice gets the regular clock, and the first voice is clocked by the second voice's output.
User avatar
No.16751
trebor
Tester
Aug 14, 2019, 00:46
edited on: Aug 14, 2019, 00:53
Regarding the attachment zip for the rendition of the opening level theme from Namco's Rolling Thunder:

Channel layout is as follows:
Channel 0: $8x distortion, 9-bit polycounter, 16-bit mode, clocked at 1.79 mhz - guitar lead
Channel 1: silent. Frequency set to 0.
Channel 2 $Cx distortion, saw wave, no modulation - bass channel
Channel 3 $Ax distortion, square wave, no modulation - accompaniment

AUDCTL is set to $D0 ... engaging the 9-bit poly-counter, 16-bit mode on channels 0 and 1, and clocking channel 0 at 1.79 MHz. Unlike other 16-bit examples, in this case channel 0 is played while channel 1 is silenced, and the frequency set to a constant 0. This is a mostly undocumented POKEY setting.
User avatar
No.16752
Haze
Senior Tester
Aug 14, 2019, 10:17
is this a recent regression, or has MAME always been this way?
User avatar
No.16759
trebor
Tester
Aug 16, 2019, 01:52
Wouldn't state it is necessarily a "recent" regression, as the same POKEY issues exist under MAME 0.162.
However, POKEY sounds better under MESS 0.120, for at least the Rolling Thunder example, so it wasn't "always" as bad as it is now.
User avatar
No.16764
trebor
Tester
Aug 16, 2019, 23:25
edited on: Aug 17, 2019, 01:53
Better breakdown respecting the 3 sample files provided:

AtariAge Jingle = Wrong on MAME 0.211 & MAME 0.162. Correct under MESS 0.120.
Rolling Thunder Intro = Wrong on MAME 0.211 & MAME 0.162. Correct under MESS 0.120.
Arkanoid 2 Level Start = Wrong on MAME 0.211, MAME 0.162, and MESS 0.120.

The short of it is while there has 'always' been some thing(s) inaccurate, it has become worse over time.

*EDIT: I recently realized MAME 0.162 coincidentally was the 'merger' version. So, I tried MESS 0.161. Same results as with MAME 0.162. That at least eliminates anything to do with the merger of the project(s).

EDIT 2: Narrowed down the playing field some more... MESS 0.130 and 0.140 both same as MESS 0.120.
MESS 0.150 same as recent MAME. So, we're down to change(s) sometime between MESS 0.140 and MESS 0.150 that made things worse.

EDIT 3: MESS 0.145 sounds same as MESS 0.120. We're down to updates between MESS 0.145 and MESS 0.150.
User avatar
No.16765
trebor
Tester
Aug 17, 2019, 02:20
edited on: Aug 17, 2019, 02:28
Identified when POKEY audio emulation became worse:

MESS 0.145u8 (Dated 2012/05/07) = Last 'better' POKEY audio emulation version.

MESS 0.146 (Dated 2012/05/21) = Worse POKEY audio emulation - same as recent versions of MAME.

Whatever change(s) took place after MESS v0.145u8 until MESS 0.146 made POKEY emulation worse.

Again, issue(s) "always" existed. I tested as far back as MESS 0.100 and the Arkanoid 2 Level Start sound demo is still wrong, but the other two sound demos tested fine.

Reference guide on what is being leveraged for each of the three demos:

Arkanoid 2 Level Start: "Always" inaccurate:
8-bit mode.
Channels 0 and 1 are the lead sound, with SKCTLS put into two tone mode
Channel 2 is $CX base in 8-bit mode
Channel 3 is $AX lead detuned ...
SOURCE: https://atariage.com/forums/topic/293427-pokey-16-bit-mode-and-other-audctl-settings-a7800-emulation/?do=findComment&comment=4314567


AtariAge Jingle: Fine MESS 0.145u8 and earlier - Inaccurate MESS 0.146 through recent MAME:
Using AUDC0=$2x for the lead sound while $Ax in 8-bit mode does the remaining two voices.
SOURCE: https://atariage.com/forums/topic/293427-pokey-16-bit-mode-and-other-audctl-settings-a7800-emulation/?do=findComment&comment=4311327

Rolling Thunder: Fine MESS 0.145u8 and earlier - Inaccurate MESS 0.146 through recent MAME:
Channel layout is as follows:
Channel 0: $8x distortion, 9-bit polycounter, 16-bit mode, clocked at 1.79 mhz - guitar lead
Channel 1: silent. Frequency set to 0.
Channel 2 $Cx distortion, saw wave, no modulation - bass channel
Channel 3 $Ax distortion, square wave, no modulation - accompaniment

AUDCTL is set to $D0 ... engaging the 9-bit poly-counter, 16-bit mode on channels 0 and 1, and clocking channel 0 at 1.79 mhz. Unlike other 16-bit examples, in this case channel 0 is played while channel 1 is silenced, and the frequency set to a constant 0. This is a mostly undocumented POKEY setting.
SOURCE: https://atariage.com/forums/topic/293427-pokey-16-bit-mode-and-other-audctl-settings-a7800-emulation/?do=findComment&comment=4323784