how can i do music on megadrive?

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

Moderator: BigEvilCorporation

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sun Aug 26, 2007 8:39 am

Shiru, as you seem to know YMxxx chips pretty well, do you know if CH3 special mode (where each four operator can have a separate frequencie), also apply to CH6 (DAC disabled) when setting bit6 in register 27h ?

Sega's devellopper manual tell so and this seems logic as "Part II" is only a duplication of 30H - B4H, where channels 1-3 are replaced by 4-6 but emulators out there only seem to support this feature for Ch3 :?:

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Sun Aug 26, 2007 9:04 am

Eke wrote:Shiru, as you seem to know YMxxx chips pretty well, do you know if CH3 special mode (where each four operator can have a separate frequencie), also apply to CH6 (DAC disabled) when setting bit6 in register 27h ?

Sega's devellopper manual tell so and this seems logic as "Part II" is only a duplication of 30H - B4H, where channels 1-3 are replaced by 4-6 but emulators out there only seem to support this feature for Ch3 :?:
I don't know, but if somebody with real hardware can help (run 1-2 test programs), it's easy to test.

However, I think, Ch6 has special mode too. We already know that MAME emulation of OPN chips is not perfect.

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sun Aug 26, 2007 10:43 am

Yes, even if this seem correct enough for most games. But there are also some game musics that sound completely wrong, something like high-frequency blip sounds covering the original music. Try for example Flashback bgm3 in sound test, actually only Kega with HQ mode activated could handle this correctly... even Gens with FM Interpolation ON sound weird on this one.

Do you know what might cause such harsh blips ? bad frequency calculations, unacurrate sampling ... ?


I also wonder about bit7 in the same register (27h), undocumented in sega's doc but refered as CSM Key control in MAME. This switch all operators in Channel 3 to Key OFF when TimerA expires (i wonder why) but this behaviour is documented as being "wrong at the moment" in the sourcecode.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Sun Aug 26, 2007 11:45 am

Eke wrote:Try for example Flashback bgm3 in sound test, actually only Kega with HQ mode activated could handle this correctly... even Gens with FM Interpolation ON sound weird on this one.

Do you know what might cause such harsh blips ? bad frequency calculations, unacurrate sampling ... ?
I don't know exactly. Something strange, seems this instrument does not use anything special, just usual melodic instrument. So possibly it because unaccuracy sampling, and combination of parameters of this instrument with given frequency can produce such distorted sound.

Interesting thing, according to GensKMod, Flashback sometimes uses separate keyons for operators.
Eke wrote:I also wonder about bit7 in the same register (27h), undocumented in sega's doc but refered as CSM Key control in MAME. This switch all operators in Channel 3 to Key OFF when TimerA expires (i wonder why) but this behaviour is documented as being "wrong at the moment" in the sourcecode.
I think, that is because lack of real documentation, and coders assume that all chips in OPNx family has mostly same features. 'CSM' feature is present in YM2151, but as far as I know, it must key ON for all operators by timer A overflow. There is also some mess with name of feature, on YM3812 (OPL2) soundchip CSM is a something like 'Composite Sinusoidal Modeling' or 'Composite Sine-wave Speech Synthesis Mode' (enabled by bit 7 in register 08h).

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

Post by Stef » Sun Aug 26, 2007 12:01 pm

Shiru wrote:
Eke wrote:Try for example Flashback bgm3 in sound test, actually only Kega with HQ mode activated could handle this correctly... even Gens with FM Interpolation ON sound weird on this one.

Do you know what might cause such harsh blips ? bad frequency calculations, unacurrate sampling ... ?
I don't know exactly. Something strange, seems this instrument does not use anything special, just usual melodic instrument. So possibly it because unaccuracy sampling, and combination of parameters of this instrument with given frequency can produce such distorted sound.

Interesting thing, according to GensKMod, Flashback sometimes uses separate keyons for operators.
I searched a long time to understand what was wrong with my YM2612 core about this instrument. I tested it with Shaq Fu as this game uses in intensively. I still don't know how to fix the problem but i'm pretty sure it's a sort of "bug" from the real YM2612 with certains settings...

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Tue Aug 28, 2007 1:57 pm

Stef wrote:I still don't know how to fix the problem but i'm pretty sure it's a sort of "bug" from the real YM2612 with certains settings...
well, I owned Flashback when I had my MegaDrive and the incriminated soundtrack (BGM3 in soundtest) never sounded like that. :wink:

The fact is that if listening this track in Kega, turning "YM2612 HQ" option ON definitively makes all these noisy "blips" disappear, where as they are still present when this option is disactivated.

I don't know what "YM2612 HQ" does exactly but it maybe something similar to what you did in Gens (emulating the soundchip at the original rate, i.e VCLK/144, approx. 53270Hz) except that it also applies some kind of additional resampling (using appropriate FIR interpolation + decimation filters) to output at the given soundrate (44100 hz) ?

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

Post by Stef » Tue Aug 28, 2007 4:32 pm

Eke wrote:
Stef wrote:I still don't know how to fix the problem but i'm pretty sure it's a sort of "bug" from the real YM2612 with certains settings...
well, I owned Flashback when I had my MegaDrive and the incriminated soundtrack (BGM3 in soundtest) never sounded like that. :wink:

The fact is that if listening this track in Kega, turning "YM2612 HQ" option ON definitively makes all these noisy "blips" disappear, where as they are still present when this option is disactivated.

I don't know what "YM2612 HQ" does exactly but it maybe something similar to what you did in Gens (emulating the soundchip at the original rate, i.e VCLK/144, approx. 53270Hz) except that it also applies some kind of additional resampling (using appropriate FIR interpolation + decimation filters) to output at the given soundrate (44100 hz) ?
Yes, HQ does calculation at the YM2612 rate then extrapolate to the output rate (44100 Hz).
But there is something more needed to reproduce correctly this sound...

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Tue Oct 09, 2007 4:44 pm

I recently made some testing about this YM2612 "bug" and discovered the following (I'm probably not the first one discovering this but I hope we could finally managed to understand how the "bug" really work):

1/ every game producing this noisy sound on emulators seem to use the same sound engine: GEMS . I suppose they all use the same preprogrammed instrument (don't found anything in GEMS documenation about these). So, this instrument probably use some kind of particular configuration which make use of a bug in real YM2612 to sound correctly on real hardware only.

2/ to my surprise, on real Hardware (megadrive 2 PAL), the same "blip" sound is present, the only difference being it is a lot more attenuated, compared with emulators. I tested both Shaq Fu (quite every music use this instrument) and Flashback (BGM #3 in sound test) and could hear it if I set the TV volume high enough.

This makes me think that the "bug" has something to do with TL values not being handled properly in certain condition (emulators handle this as the chip should normally do, which make this "blip" sounds a lot too loud)

I wonder what else could affect the output amplitude ? according to GensKMod, LFO AM seems not to be activated .

3/ then , I tested the Flashback VGM's track with in_vgm plugin to isolate the incriminated channel (hehe, that could be a nice addition to GensKMod) and found that the noisy blip sound was comming from Channel 3.

4/ Finally I run the above games under KgensMod and Genesis Plus, looking into Channel 3 configuration for some similarities when hearing the infamous "blip sound". Here are the most noticable coincidences between games:

- there are no LFO effects used (AMS nor FMS)
- Channel 3 is always configured to "special" mode
- Channel 3 algorithm is always algorithm #4 (feedback value = 4)
- Channel 3 operator 2 (which is used as output in this algorithm) has TL value always set to 0, which is the max amplitude.

I also noticed that the soundtracks that don't produce this bad sound never use a "zero" value in the operator 2 TL register so maybe the bug has something to do when using this value in this special channel ?

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

Post by TmEE co.(TM) » Wed Oct 10, 2007 5:21 am

My MD2 doesn't do this "blip" sound...
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

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Wed Oct 10, 2007 8:08 am

TmEE co.(TM) wrote:My MD2 doesn't do this "blip" sound...
as I said, it's only present in some specific games and at a very low level, making it sound a lot more "normal"
To hear it on real hardware, I guess you will need to set the volume high enough and to know exactly what you are looking for since it's covered by the other channels a lot
maybe I was so used to hear it on emulators that I immediately recognized it :wink:

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

Post by TmEE co.(TM) » Wed Oct 10, 2007 8:32 am

You know, I listen music so that ground shakes (I have VERY powerful HiFi in my home 8) ), and that applies to games aswell... I'll do a recording for some deeper examination...
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

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

Post by Stef » Wed Oct 10, 2007 8:54 pm

Eke wrote:I recently made some testing about this YM2612 "bug" and discovered the following (I'm probably not the first one discovering this but I hope we could finally managed to understand how the "bug" really work):

1/ every game producing this noisy sound on emulators seem to use the same sound engine: GEMS . I suppose they all use the same preprogrammed instrument (don't found anything in GEMS documenation about these). So, this instrument probably use some kind of particular configuration which make use of a bug in real YM2612 to sound correctly on real hardware only.

2/ to my surprise, on real Hardware (megadrive 2 PAL), the same "blip" sound is present, the only difference being it is a lot more attenuated, compared with emulators. I tested both Shaq Fu (quite every music use this instrument) and Flashback (BGM #3 in sound test) and could hear it if I set the TV volume high enough.

This makes me think that the "bug" has something to do with TL values not being handled properly in certain condition (emulators handle this as the chip should normally do, which make this "blip" sounds a lot too loud)

I wonder what else could affect the output amplitude ? according to GensKMod, LFO AM seems not to be activated .

3/ then , I tested the Flashback VGM's track with in_vgm plugin to isolate the incriminated channel (hehe, that could be a nice addition to GensKMod) and found that the noisy blip sound was comming from Channel 3.

4/ Finally I run the above games under KgensMod and Genesis Plus, looking into Channel 3 configuration for some similarities when hearing the infamous "blip sound". Here are the most noticable coincidences between games:

- there are no LFO effects used (AMS nor FMS)
- Channel 3 is always configured to "special" mode
- Channel 3 algorithm is always algorithm #4 (feedback value = 4)
- Channel 3 operator 2 (which is used as output in this algorithm) has TL value always set to 0, which is the max amplitude.

I also noticed that the soundtracks that don't produce this bad sound never use a "zero" value in the operator 2 TL register so maybe the bug has something to do when using this value in this special channel ?
I already did these examinations except about the TL 0 level.
I'm almost sure it's a bug or a strange pupose of the channel 3's special mode... maybe TL stuff, maybe not :-/

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Oct 11, 2007 8:09 am

It's too bad Steve Snake never shared with you his finding about this one :?
He probably made thousand of test program to finally get it

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

Post by TmEE co.(TM) » Sun Oct 14, 2007 11:10 am

http://www.hot.ee/tmeeco3/FLASHBCK.OGG

Recording of FlashBack BGM3 that does this blip sound... recorded from my MD2 with Crystal Clear Audio Mod.
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

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sun Oct 14, 2007 12:06 pm

it is very difficult to hear it but the blip sound (it's more something like cymbals, tingtingtingtingting, very fast) is there, in background (which means, very very low)

try the same bgm in an emulator (not kega off course) to get an idea about this sound then listen to your OGG again, it's mostly noticeable (but still hardly hearable) at the beginning, during the short periods where the main melody is lowered in loop... setting the volume at a very high level might help too


I'm convinced that this is a bug with the output amplitude on this particular channel with this particular configuration

here is a snapshot of the configuration used in Flashback BGM3: the only parameters that change in between games producing this sound (I checked Ariel, Shaq Fu, Berenstain's Bear, Spiderman Animated Series) are the TL values of operators 3 & 4 and the eventual use of timers or LFO.

Otherwise, all other settings are the same, especialy the '0' value for operator 2's TL, first and second decay.

Image

Post Reply