## YM2612 - Square & Triangle Waves

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

Moderator: BigEvilCorporation

walker7
Interested
Posts: 45
Joined: Tue Jul 24, 2012 6:27 am

### YM2612 - Square & Triangle Waves

Does anyone know what is the best approximation on the YM2612 for NES-style square and triangle waves?

For square waves, you could set the multiples for the operators to 1, 3, 5, and 7, since those are the odd harmonics used there. The fundamental frequency has full amplitude, the 3rd harmonic has 1/3 amplitude, the 5th harmonic has 1/5 amplitude, and and the 7th harmonic has 1/7 amplitude. You could set the total levels (TLs) accordingly. Rate Scaling (RS) should probably be 0, then the Attack Rate (AR) should be as steep as possible. The decay rate and release rate should be 0. And since it's just a sum of four harmonics, the algorithm should probably be #7 (assuming you number algorithms from 0-7; this is the one that just adds all 4 operators together).

What would be the best approximation for triangle waves?

Very interested
Posts: 594
Joined: Thu Nov 30, 2006 6:30 am
Any particular reason you wouldn't just use the PSG for square waves? Obviously doesn't solve your triangle wave problem though.

walker7
Interested
Posts: 45
Joined: Tue Jul 24, 2012 6:27 am
Mask of Destiny wrote:Any particular reason you wouldn't just use the PSG for square waves? Obviously doesn't solve your triangle wave problem though.
The NES has four different types of square waves, each with a different duty cycle. These duty cycles are 12.5%, 25%, 50%, and 25% negated.

Someone on YouTube commented that you could mix two PSG channels, one at the base note, and another an octave higher at a slightly lower volume, and it would sound like the 25% square. This was on a video of a Sega Genesis version of Super Mario Bros.

But, as I said, that uses up two channels. Since the PSG already has a 50% square, I want to figure out what is the closest approximation to the other types of square waves using the YM2612, so they would each use only one channel. Or, you could come up with a PSG approximation using 2 channels, like I mentioned above.

TmEE co.(TM)
Very interested
Posts: 2403
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:
Sawtooth and 50% squares are veeery easy on the YM, but triangle will not be so easy to make nor are duty cycle approximations.

You need 2 operators to make square and sawtooth, Op1 with maximum FB and second op with right TL and MUL.
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
I got a sawtooth with one operator: operator 1, SR max, TL max, FB 4, algo 7, everything else at their silent (default for an empty voice in TFM Maker/VGM Maker; I "discovered" this a while ago =P )

Code: Select all

``````@:0 sawtooth
LFO: 0 0 0 0 0
CH: 64 4 7 0 0 120 0
M1: 31 31 0 15 0 0 0 0 3 0 0
C1: 31 31 31 15 0 127 0 0 3 0 0
M2: 31 31 31 15 0 127 0 0 3 0 0
C2: 31 31 31 15 0 127 0 0 3 0 0``````
It does appear to have rounded corners but eh :/ (Thanks to Sik for helping me confirm this was indeed the voice I had in memory.)