Viewing Issue Advanced Details
|ID||Category [?]||Severity [?]||Reproducibility||Date Submitted||Last Update|
|05800||Sound||Minor||Always||Dec 17, 2014, 01:39||25 days ago|
|Version||0.156||Fixed in Version||0.230||Build|
|Fixed in Git Commit||Github Pull Request #|
|Summary||05800: genesis / megadriv / megadrij [microm96] [microm96a] [micromm]: Incorrect horn sound in Micro Machines Turbo Tournament '96|
|Description||The horn sound in Micro Machines Turbo Tournament '96 is incorrect/muffled.|
|Steps To Reproduce||
MAME/MESS developer R. Belmont describes it:
"It plays "beep-beep" at the end of the intro (around the 10 second mark in ) and in-game one of the controller buttons does it." (pressing C on gameplay)
I found a fix for the MESS genesis/megadrive driver, by changing the rate value that is set in file 2612intf.c, function ym2612_device::device_start(). Rate was set with "clock()/72" and to fix the problem I just doubled the value of the divider ("clock()/144"), after tests with different values.
I don't know exactly why the 72 divider was used and why 144 is required to fix the problem, but after seen the sound_init() function of Genplus-GX SVN rev. 707 (sound.c file), I found there that 144 was used as a multipler when HQ mode of YM2612 is enabled, while 72 was used for HQ mode of the YM2413 chip. The values were used by Genplus-GX until SVN rev. 781, when some structural changes were made to files ym2612.c and sound.c, better described by this line of ym2612.c:
- removed input clock / output samplerate frequency ratio, chip now always run at (original) internal sample frequency
Those changes don't seem trivial to port to MAME/MESS. The rate parameter, that needed to be changed, isn't used anymore by Genplus-GX.
|Affected Sets / Systems||genesis / megadriv / megadrij [microm96] [microm96a] [micromm]|
|There are no relationship linked to this issue.|
Dec 17, 2014, 05:25
|Same behavior also happens in Micro Machines Military [micromm]|
Dec 23, 2014, 01:47
I would like to remember what I was doing when mistakenly wrote about 144 and 72 removed from Genplus-GX, because actually they are still used by the sound_init() function:
Another mistake was the SVN revision when major sound changes were done to Genplus-GX: the correct number is 715. Both 144 and 72 multipliers survived those changes, with the difference that they are now applied regardless of HQ mode. The only relevant change was the rate parameter that was removed from the YM2612Init() function (named ym2612_init() in MAME), because MAME call that function from ym2612_device::device_start() to pass the rate that was calculated dividing by 72.
Dec 27, 2014, 01:53
I was looking for a scientific basis about the 144 number and found a nice commented description in a file of the BizHawk emulator, namely the file YM2612.Timers.cs. In my research, the specification of the source tree revision (rev. 2478) was needed, because I haven't found the same file in the current trunk repository of that emulator:
Here's the commented description (16 lines):
// The master clock on the genesis is 53,693,175 MCLK / sec (NTSC)
// 53,203,424 MCLK / sec (PAL)
// 7,670,454 68K cycles / sec (7 MCLK divisor)
// 3,579,545 Z80 cycles / sec (15 MCLK divisor)
// YM2612 is fed by EXT CLOCK: 7,670,454 ECLK / sec (NTSC)
// (Same clock on 68000) 7,600,489 ECLK / sec (PAL)
// YM2612 has /6 divisor on the EXT CLOCK.
// YM2612 takes 24 cycles to generate a sample. 6*24 = 144. This is where the /144 divisor comes from.
// YM2612 native output rate is 7670454 / 144 = 53267 hz (NTSC), 52781 hz (PAL)
// Timer A ticks at the native output rate (53267 times per second for NTSC).
// Timer B ticks down with a /16 divisor. (3329 times per second for NTSC).
// Ergo, Timer A ticks every 67.2 Z80 cycles. Timer B ticks every 1075.2 Z80 cycles.
In MAME/MESS, the current src/emu/sound/fm2612.c file contains some related reference in the init_timetables() function. Also, the multiplication 6*24 is used for two parameters in the call of the OPNSetPres( ) function: OPNSetPres( OPN, 6*24, 6*24, 0). One of the parameters is a prescaler value used to calculate the frequency base and the other parameter is a prescaler value used to calculate the timer base time.