VST using Gens ym2612 emulation

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

Moderator: BigEvilCorporation

superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

Post by superjoebob »

Charles MacDonald wrote: What problems are you having with the YM2612 emulation?

Would you need some kind of example to help getting started, such as a program that set up the emulation and wrote to a few registers, then logged the output to a WAV so you could see how to get things going?

Or is it the FM programming in general, like what values you have to write to which registers to get useful sounds?

VGM is more of a format for logged audio and less for say music playback in a Genesis game, but it's certainly possible to have a tracker that would write VGM output.
Well, I think I have the general idea of how to write to the registers, I'm just not completely sure how to get information back from the "chip". I'm using Stephane's Gens ym2612 emulation code, and this is what I have so far http://www.wonthelp.info/superjoebob/YM2612_Testbed.zip.

An example on how to get output from that would be great, since I'm at a serious wall here :).

As for the tracker, I would probably end up hooking in a sound system I understand, or even just making it use MIDI and allow number input for instruments, since I can just put numbers into other Ym2612 emulators to get the idea of what sound I want. Of course, If you can show me how to use the ym2612 source properly I can just use that :P.
Shiru wrote: Crackly output is probably because you use TL=0 for slots, you should use lower values, like 10, for max volume. Stuttering could be caused by VGM export bug, which corrupts the data sometimes, so you should check the VGM file with a plug-in/player to see if it sounds correctly.
I actually ended up running into that problem with the first song I exported, and I've been using a lower volume since then. The crackling isn't very apparent, it's just some distortion and clicks in the audio every now and then, I think it has something to do with the audio jack on my genesis. The stuttering also happens on music from Genesis games, so who knows, it could be my imagination.
TmEE co.(TM) wrote: That sounds horrible like a typical MD2 does. But I created a fix for it, though its on the complex side : http://nfggames.com/forum2/index.php?topic=3719
if you cannot build it yourself I can make one for you for 21EUR, and I can alos install it myself and do few other mods to the MD for a reasonable fee aswell... ^^
I'd gladly pay you to install some mod's for my Genesis, although I have a Genesis model 1 (MK-1611). Hopefully that's not a problem?

If you can do it, I would be thrilled if you would email me at superjoebob@hotmail.com and let me know what you can do and what it would cost.

EDIT: After reading more into you're post about the crystal clear audio mod, I take it you can't do the mod on an MD1. If that's true, let me know if I should get onto E-Bay and have an MD2 shipped to you :lol:.
TmEE co.(TM) wrote: (I more asked for a recording from the Genesis Plus GX emulator though :P)
Actually realized that after recording the song, figured I'd post it up anyway as an example of the terrible quality of my output :D
On a never ending quest to compose for the Genesis/Megadrive
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

Seems that MD1 you got is a MD1 VA7, which is MD2 in MD1 shell. No "real" MD1 sounds that bad, only muffled a bit, but not distorted. I'll send you a mail as soon as I get a bit of extra time (at work here :lol: )
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
andlabs
Very interested
Posts: 62
Joined: Sat Aug 08, 2009 4:44 pm

Post by andlabs »

I didn't want to mention it here until I wrote my own sound driver (I've just started writing it...) but I have been developing a more advanced tracker for the Genesis for my needs. I'll write a more appropriate thread here when I make my sound driver =P
superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

Post by superjoebob »

Look's cool but unfortunately I don't have a Mac :?. Guess I won't stop working on mine just yet.
On a never ending quest to compose for the Genesis/Megadrive
andlabs
Very interested
Posts: 62
Joined: Sat Aug 08, 2009 4:44 pm

Post by andlabs »

superjoebob wrote:Look's cool but unfortunately I don't have a Mac :?. Guess I won't stop working on mine just yet.
It's crossplatform; there are links to other binaries in the thread =P But do as you will; it doesn't hurt to have something that suits your needs.
superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

Post by superjoebob »

Oh haha, didn't even see that! Guess I'll have to try this sucker out :wink:.

Actually, I take it back, I haven't got the Gens ym2612.h/c working completely yet. I can get perfect wave information if I send a single large buffer into the YM2612_Update event, but if I try to break up the information into multiple buffers the chip's state seems to get damaged somewhere.

It also works if I capture the samples one by one using a single int buffer:

Code: Select all

for( int i = 0; i < 1024; i++ )
	{
		TinyBuffers[0][0] = 0;
		TinyBuffers[1][0] = 0;
		YM2612_Update(mym2612, TinyBuffers, 1);
		YM2612_DacAndTimers_Update(mym2612, TinyBuffers,1);
		BufA[i] = TBufA;
	}
But if I go into another for loop to capture another number of samples one by one, the sound is suddenly dropped as if the note had a quick decay rate. This is accompanied by a good deal of crackling.

With the system I have going right now, I write an instrument into the register, write a note on, then update the information sample by sample and copy each int into a 1024 sized buffer using a for loop. After that, I use XAudio to create a sound object and I pop the buffer into it. While the sound plays, another buffer is filled in the same way as above, and that sample buffer is added to the audio objects buffer queue. When the callback is hit to signal the end of the current buffer, the next buffer is automatically played, and the program fills the first buffer again and pushes it into the sounds buffer queue. This continues indefinitely until I stop the program.

This method works if I use 1 large buffer instead of constantly changing out buffers, and I also know it's not XAudio causing the problem, since it also works if I just fill both buffers with the initial audio data and swap out like above.

Does Gens ym2612.h/c have any internal clock or automatic reset that I may be missing?

EDIT:
Ok, the clicks are totally due to the buffers not syncing seamlessly for some odd reason, but the note muting problem still exists. Every time a new buffer is filled, a bit of note velocity is lost. The smaller the buffer, the more buffers I fill, the more velocity is lost. The velocity change is much less noticable with larger buffers, but it is still present.

EDIT:
Updating this damn post like a blog now :lol:. I changed some things with the way my system operates, and I switched from XAudio to PortAudio, now the main problem is gone. The problem now, seems to be the latency I'm getting from the system. Hopefully I'll be able to work it out.

Interestingly enough though, If I take more than 1 sample at a time from the ym2612 it returns the same samples every time I call update. Any ideas?
On a never ending quest to compose for the Genesis/Megadrive
Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke »

TmEE co.(TM) wrote:I've not looked very hard, but all I have ever found is the Wii stuff...

EDIT: found PC version, but it seems it needs something better than a Tualatin PIII I currently only have access to...
I've released a new version and took some time to update the SDL port as well, this time compiling with gcc -i686 more compatible flag. Let's hope this works better for you. Please keep in mind that this is a VERY basic port as I have very limited knowledge with SDL and Windows programming: sound seems to crash if you move the window and options are not yet changeable (btw, low-pass filtering is disabled in this version)

http://code.google.com/p/genplus-gx/downloads/list
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

It runs and PCM is good too, but TMSE seems to go crazy and play notes etc. that should come much later in the songs, the Z80 part seems to be completely wild :shock:
...and low pass filters are first things I want disabled :P
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: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke »

What is TMSE ? Do you mean your sound engine used in the ROM you posted or something else ? Does it affect any song or is there one I should listen to in particular ?

As i said above, the SDL port is very basic and sound playback indeed goes crazy if you move the program window :-/
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

TMSE is my sound engine, and I used that same ROM I gave link to earlier here...

I did not move the window or touch anything on it, but the music playback was really off, like the Z80 RAM was corrupt or something as there was very funny things going on in the 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: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke »

Strange, I don't notice anything wrong myself when playing/switching tracks. I compared "One Last Step" with your HW recording and it seems the same to me :?:

Can you post a recording ? i'm not really sure to understand what kind of issue you are having
Post Reply