Page 2 of 3

Posted: Thu May 16, 2013 10:11 pm
by Eke
TmEE co.(TM) wrote:

Code: Select all

CASE 1                             'YM3438 mode
 OPNbuf(i%, 0) = Lft AND &HFF80
 OPNbuf(i%, 1) = Rit AND &HFF80
CASE 2                             'YM2612 mode
 IF (Lft > 0) AND (Lft < 256) THEN
  OPNbuf(i%, 0) = Lft AND &HFF00
  OPNbuf(i%, 0) = Lft AND &HFF80
 IF (Rit > 0) AND (Rit < 256) THEN
  OPNbuf(i%, 1) = Rit AND &HFF00
  OPNbuf(i%, 1) = Rit AND &HFF80
CASE ELSE                          'Silky smooth mode
 OPNbuf(i%, 0) = Lft
 OPNbuf(i%, 1) = Rit
I do this in my core and it produces spectrally correct output compared to real chips, to the last details. I have not came up with any cleaner way to do this, maybe a bigass array to do translation so there's no compares and jumps...
EDIT: now looking at it, I need to do this crushing before panning stuff, will save cycles :P
i think it would be more correct to apply a bitmask on each channel output, considering they are sequentially input to DAC, then sum up the channels, don't you think ? ( not sure why but i just noticed that i was even applying it at operator output, which seems wrong and might be a result of poor optimization attempt

also, not sure if i am missing something in your code but when sample value is within [0-255], having it masked with FF00h always result to zero so AND operation is uneeded ;-)

Posted: Thu May 16, 2013 10:50 pm
by TmEE co.(TM)
EDIT: More corrections...

YM2612 output ramp sequence is -256 .... -2, -2, 0, 1, 2, 3 .... 255
YM3438 output ramp sequence is -256 .... -2, -1, 0, 1, 2, 3 .... 255

Rest removed here, too much false info :P

Posted: Fri May 17, 2013 2:00 am
by Aly James
EDIT :Information added to the YM2612 sticky doc...
Maybe you might also have to take in account the internal noise witch IIRC output some frequencies around 50 and 100hz when played an A 220hz for example, that might cross modulate something too.., even when no operator are keyed on.


Posted: Fri May 17, 2013 11:07 am
by TmEE co.(TM)
The 50 and 100Hz is ripple from power supply (it will be 60 and 120Hz in NTSC land). There's gonna be higher harmonics too but a lot more faint.

Posted: Fri May 17, 2013 8:48 pm
by Eke
TmEE co.(TM) wrote: The output never has the value of "1" on 2612, so I see no point in doing it on channel per channel basis.
If you sum up 4 channel output that are all $007C ("0") , you end up with a "Lft" / "Rft" value equal to $01F0 ("+3") while it should have remain "0". In fact, Gmaniac even confirmed that carrier operators output (14-bit) was shifted by 5 before being added in the accumulator so the mask should actually be applied before even generating the channel output since you lose some precision in case of algos 4-7 (the mistake in my code is that the mask ended up being applied on modulator inputs as well, which I believe is wrong since the accumulator is not used for slot connections)

Also what you say about "+1" level being the same as "0" seems to ontradict what Gmaniac observed and mentionned in the YM2612 thread: he wrotes that "-2" was the same "-1" but "+1" was different om "0".This makes me wonder what is the real behavior and if it can accurately be observed.

From what we now know of the YM2612 DAC, it only use 8 lowest bits of 9-bit accumulator, which allow 256 different analog levels, then the sign bit being used to set the analog outputs voltage reference to either GND or VCC, so 0 relates to -256 ("100h"), ..., +255 to -1 ("1FFh") and therefore if something is wrong in the DAC array with +1, it should also be wrong with -255, etc...

Posted: Fri May 17, 2013 9:58 pm
by TmEE co.(TM)
I have remembered bunch of this stuff wrong/incomplete. -1 and -2 are the flattened values among other things.

*Discard first 5 bits.
*Sum the operators and clamp to 9 bits.
*Output to DAC while eating up couple of values due to a bug.
*Do next channel.

It makes sense as you no longer need 14bit adder, only 9bit one, especially since output is not 14bits.
I'll definitely add that to my core on 2612 and 3438 modes.

About the DAC bug, it will need closer looks. I'll do those looks in not so fan future.

Posted: Sun May 19, 2013 11:12 am
by Aly James
Something interesting I forgot to tell (but might not be new for you ^^) is when I set the output of a channel to "mute", B4H LEFT&RIGHT bit==0;
Playing some notes here do not play silence but the same line as normal except (center) already distorted from the start and at a lower volume.
The very last ms ends with quantize effect on top of that.
TL as almost no effect on the slot until near max attenuation.

So when I said that the sine shape (assuming we have a pure sine in this example) is slowly changing into an almost square wave is not exactly what is happening.
I think that the distorted line and the clean line simply adds together from the start.
The fact that we only ear the last portion is obviously because, as the clean line reaches low volume, the frequency richer distorted part underneath become prominent and that is also why some sounds seems to have a longer tail on the hardware then on clean emulation.
The positive portion of the sine also seems to be slightly shifted to the right the more the attenuation goes.
So there might be something in here just before MOL and MOR...
Here is a wave recording of the effect.
1// B4 D7 and D6 are set (center)
2// (mute)


Nothing related @TIIDO: do you have some links with interesting musical examples of the use of PCM custom waveforms, drums samples custom operator wf with the YMF292 aka SCSP, I have a hard time finding some.. ?

Posted: Sun May 19, 2013 1:09 pm
by TmEE co.(TM)
I had so much fun working around that problem in my MD sound engine that Pier Solar eventually used, in the end I did not get a perfect workaround. This is fixed in YM3438 and MD2 implementation.
I never really thought it may be an analog problem, it can explain why it is so immune to workarounds. I basically ended up using dummy instruments with really short (but in theory inaudible sound) to get internals to silence state on the channel. It was effective but fairly ugly to implement.

As for SCSP, no... I don't know anyone doing interesting stuff on Saturn with it and I won't be doing any for a while either. But you can get a taste by looking at SY-77 and SY-99 keyboards which use essentially same system.

Posted: Mon May 20, 2013 11:35 am
by Aly James
On a personal point of view, I prefer the sound with the "bug" it gives a very personal sound to the YM2612 and it can be use creatively :)

I have just checked the F1SR..the formant thing kind of remind me the CSM mode, without the need to program formants... ^^

Today I have made a tribute to Yuzo koshiro in my spare time
Here it is:
NINJA STEP from Revenge of Shinobi soundtrack
PAL version

FMDrive in HD mode. and a little mixed and arranged. ... mdrive-vst

Posted: Tue May 21, 2013 5:31 am
by Aly James
Eke wrote: and how did you implemented the characteristic DAC "distorsion" ?
Some more infos :)
This basically what gives me the best results, thinking about what could happen between MOL and MOR and the sign bit thing..and the same behavior his observed on the hardware. Here is a digital emulation.
The pulse line is masked by the clean signal when there is no attenuation (as the clean line is noticeably higher) and is almost unaffected by TL or EG attenuation. see post above.
hope that helps :)
EDIT: I Forgot to mention that I also offset the negative pulse as the attenuation increase...resulting in a change of the pulse wave duty cycle from 50/50 to almost 90/10. This reflect in the tone in the end.


Posted: Wed May 22, 2013 4:08 pm
by Aly James
YM2612 HARDWARE (non standard creative usage)
Setup in these videos is:
FMDrive VST sends MIDI data to the GENMDM MIDI interface that sends register writes to the YM2612 chip in REALTIME.

REAL HARDWARE USE: Using SSG as a "fake" CSM vocal type effect.
(fast SSG envelope can sort of emulate the auto key on / off behavior of CSM mode)

REAL HARDWARE USE: Using FMDrive random bytes generator (LFSR) to write a custom 14bytes waveform on the DAC.
(changing the LFSR clock speed will increase the randomness)

Posted: Fri May 31, 2013 8:08 pm
by Aly James
Regarding the ladder effect, I will post my latest implementation on the YM2612 sticky doc :)
I finally find a way to implement this at no cpu cost..

Posted: Tue Oct 01, 2013 9:05 am
by Aly James
Just to let you know that FMDrive vst got updated to 1.23!
-added extra features and corrections.
-accuracy improved again.
-GenMDM midi mapping already done on startup for those who have one.

Free for all registered user :)


what I usually do is making the song with FMDrive (and lately Super PSG beta), clean up the live recorded poly notes, if there is some, to be sure everything sent to GenMDM channel is mono, record automation etc...If I want the hardware output, I then hook up GenMDM and route the MIDI content to it and voila!

for now on it is damn close :)


Posted: Sat Oct 12, 2013 12:51 am
by Aly James
Wireless YM2612 hand control test!...using leapmotion controller >> FMdrive VSTi and GenMDM

Posted: Tue Dec 17, 2013 9:38 pm
by Aly James
Super PSG VST (SN76489 SMS version with extended features...) is now available :)