I made a discovery...

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

Moderator: BigEvilCorporation

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

I made a discovery...

Post by TmEE co.(TM) » Tue Dec 19, 2006 10:48 am

None of the emulators emulate YM2612 "wait before write bit" correctly. I was messing with my WAVPLAY programs on real HW and discovered that MD can't play samples over ~33KHz but on emulator you can go over 96KHz !!! For example, on real HW if I remove delay loops, the sound plays at ~33KHz but on emulator it goes "off the chart". source for WAVPLAY available on request.
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

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Tue Dec 19, 2006 11:41 am

Interesting note :)

Maybe you can replace your loop with other computing stuff (like mixing two samples or doing a loud/quiet filter) :D
Nice to hear that your code can go up to 96khz :)

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 1:22 pm

You certainly can !!! The method is read byte, play it, wait a little in a loop and start all over again. I you play several bytes and stay in a loop once, you'll get performance increase but the sound might get funny then. Once I had 16 to 8 bit conversion in the program too. I guess if you mix, it is better to use 16-bit files and then convert output to 8-bit to prevent quality drop. Filtering is something I have no idea how its done digitally, with couple of caps I can do "hardware" filtering.
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: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Dec 19, 2006 1:29 pm

Your information is quite usefull :)
As i never found any informations about the YM2612 busy flag and hardware latency, i never bothered with that... this absolutly don't change anything for game emulation has none trying to send 96 Khz samples X'D
I think the latency can change depending the register set...

It would be good to know if there is a sort of FIFO in the YM2612 as the 4 words FIFO in the VDP.
We can imagine doing that :
- transfert 4 DAC data "at once"
- then doing some compute
- then transfert next 4 DAC datas
- ...

Then we will be sure of the 33 Khz rate (because of the YM2612 limitation) and the FIFO acts as a very small buffer but still usefull to do minors tasks aside :)

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 1:34 pm

There are no FIFOs as far as I know, from all the Yamaha FM synths datasheets that I've read, I haven't seen any FIFO stuff.
By sending 4 samples I meant:
wait before write, send sample (do last two 4 times), wait in a delay loop, go all over again.
This increases performance as 3 sittings in a delay loop are not done, however, 33KHz is the limit on real HW. I guess, if you feed higher clock into YM2612 you can go over 33KHz but it involves handling soldering iron and such stuff and many people here aren't hardware people AND I can't do it as my pirate MD1 fried (it contained discrete chips with identical pinouts with original MD1 ones) and I guess there is no external clock input line on MD2's big chip where most of the stuff is integrated in. What a long sentence... :D
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: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Dec 19, 2006 1:48 pm

TmEE co.(TM) wrote:There are no FIFOs as far as I know, from all the Yamaha FM synths datasheets that I've read, I haven't seen any FIFO stuff.
By sending 4 samples I meant:
wait before write, send sample (do last two 4 times), wait in a delay loop, go all over again.
This increases performance as 3 sittings in a delay loop are not done, however, 33KHz is the limit on real HW. I guess, if you feed higher clock into YM2612 you can go over 33KHz but it involves handling soldering iron and such stuff and many people here aren't hardware people AND I can't do it as my pirate MD1 fried (it contained discrete chips with identical pinouts with original MD1 ones) and I guess there is no external clock input line on MD2's big chip where most of the stuff is integrated in. What a long sentence... :D
Ok, well that is a bit disapointing, a FIFO, even a small one would have been really helpfull here. The very bad point of the genesis sound hardware is the lack of sound buffer for PCM sound. At least a timer wired on interrupt or something like that... unfortunatly YM2612's timers are just not connected :-/

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 1:54 pm

Lack of FIFO sucks, but no one has complained about it and why to complain now ? For a while I was thinking of adding DACs to Glass Breaker MD cartridge, but then again, DACs with Enable signal were quite expensive and all the chips I would have have to use wouldn't fit into the cartridge AND none of the emus would have made any 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

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

Post by Stef » Tue Dec 19, 2006 2:01 pm

It's just a small complain because that really doesn't help us and because imo having good sound is more important than good graphic :)
Anyway that just make coding more fun :p

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 2:03 pm

You're right !!! Good sound matters a lot, too bad that many todays games have not so good sound (read: music, sfx are quite OK).
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: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Dec 19, 2006 2:09 pm

Yep, but it's also why i've to admit the SNES sound chip was very nice, it sounds a lot better the genesis one. Anyway the genesis is really suited to create some awesome techno/electronic tunes. I do love the Street Of Rage 1/2 and Batman And Robin ones ;)

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 2:11 pm

I don't listen techno much, but I do listen metal, and if developers really want, they can produce quite metal guitar sounds, just listen Thunder Force 4 or Contra Hard Corps !!! RR series doesn't have so good guitars.
MCD has something SNES audio chip like thing inside.
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

stalepie
Very interested
Posts: 101
Joined: Sun Dec 10, 2006 1:18 pm

Post by stalepie » Tue Dec 19, 2006 2:13 pm

On the Project 2612 forum, I've said before that in Gens the music generally sounds better at the 22050 Hz setting, over 44100 or 11025. Not sure if that is what this thread is about, but they tell me it shouldn't make a difference and that there's no reason to update the .vgm player to offer 22050. So I prefer to listen to Genesis music played through Gens. Games like Space Harrier II definitely sound better at that setting, as it must be closer to how the composers expected the music to reach the ears.

Also, I just want to add my opinion that I definitely prefer Yamaha's chip to the Sony one used in the SNES. :)
Last edited by stalepie on Tue Dec 19, 2006 2:19 pm, edited 3 times in total.

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

Post by Stef » Tue Dec 19, 2006 2:14 pm

TmEE co.(TM) wrote:I don't listen techno much, but I do listen metal, and if developers really want, they can produce quite metal guitar sounds, just listen Thunder Force 4 or Contra Hard Corps !!! RR series doesn't have so good guitars.
MCD has something SNES audio chip like thing inside.
Yeah i do know very well TF4 tunes, i tested them a lot to affine my YM2612 emulation (i think i heard the boss 7 music something like 200 times :p)
The electrical guitar sound is just amazing for a MIDI like chip !

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

Post by TmEE co.(TM) » Tue Dec 19, 2006 2:16 pm

FM sound are analogue and therefore cannot be measured in Samples/Sec. But if it could it would be a lot for sure. FM synthesis is something I like, especially from MD !!!
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: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Dec 19, 2006 3:07 pm

stalepie wrote:On the Project 2612 forum, I've said before that in Gens the music generally sounds better at the 22050 Hz setting, over 44100 or 11025. Not sure if that is what this thread is about, but they tell me it shouldn't make a difference and that there's no reason to update the .vgm player to offer 22050. So I prefer to listen to Genesis music played through Gens. Games like Space Harrier II definitely sound better at that setting, as it must be closer to how the composers expected the music to reach the ears.

Also, I just want to add my opinion that I definitely prefer Yamaha's chip to the Sony one used in the SNES. :)
That's really surprising you prefer listen music at 22 Khz than 44 Khz.
Except if you enable the YM2612 High Quality flag (which force high frenquency generation).
The internal YM2612 isn't real analog, in fact it's all digital, high digital rate actually. The exact sample is 68k frequency / 144. I can't affirm that's 100% exact but i found this value by deduction and it seems accurate (and Kega uses it as well know). This value is required for some extrem high modulated sound as the spinning panel sound in the end of sonic level.
Just do a try with and without the high quality YM2612 flag in Gens or Kega.

Post Reply