Simulating 75% and 87.5% pulse wave in MIDI

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Simulating 75% and 87.5% pulse wave in MIDI

Post by Bregalad »

General MIDI sounds contains few means to generate basic waves :
  • Square wave instrument #80
  • Saw wave instrument #81
  • Ocarina instrument #79 is de-facto close to sine wave on most synths
Unfortunately, the square and saw waves of those set is usually played with some chorous effect and some filtering, in a way that makes them unable to replicate NES/GB/GBC/GBA sounds.

However the largely supported Roland GS or Yamaha XG extensions allow for the following
  • "Square wave 2" instrument #80 bank #1
  • "Sine wave" instrument #80 bank #8
  • "Saw wave 2" instrument #81 bank #1
Those basic waves are usually played back without any effect, making them appropriates to simulate chip tunes. Unfortunately only the square wave with 50% duty cycle is available.

I figured out that for some reason relative to the fourrier spectrum, it is easy to simulate a 75% duty cycle pulse wave, by adding two square waves : One for the fundamental and the second one one octave upper at 70% of the volume.

I wonder whether it's possible to use a similar trick to simulate a 87.5% duty cycle pulse wave in extended GS/YM MIDI. At the absolute worst that should be possible by stacking up enough sine wave harmonics, but I wonder whether there's something better.
Useless, lumbering half-wits don't scare us.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Simulating 75% and 87.5% pulse wave in MIDI

Post by Dwedit »

It's also useful for chiptunes on a sound chip with only 50% square waves, like a Master System.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Simulating 75% and 87.5% pulse wave in MIDI

Post by Quietust »

When I've done NES MIDI, I've typically used the sawtooth instrument in order to approximate the 75% duty cycle pulse wave - it doesn't sound exactly right, but it's reasonably close (at least in the soundfont I use, it has the same "ah" sound as the 75% pulse, compared to the 50% pulse's "ooh" sound).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Simulating 75% and 87.5% pulse wave in MIDI

Post by Bregalad »

Dwedit wrote: Fri Jan 21, 2022 6:30 pm It's also useful for chiptunes on a sound chip with only 50% square waves, like a Master System.
Indeed, but there needs to be a precise volume control.
When I've done NES MIDI, I've typically used the sawtooth instrument in order to approximate the 75% duty cycle pulse wave - it doesn't sound exactly right, but it's reasonably close (at least in the soundfont I use, it has the same "ah" sound as the 75% pulse, compared to the 50% pulse's "ooh" sound).
My personal opinion is that a pulse wave of any duty cycle does not sound close to a saw wave. Anyway, I was looking how to simulate a 87.5% pulse wave, I already got the 75% pulse wave working.
Useless, lumbering half-wits don't scare us.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Simulating 75% and 87.5% pulse wave in MIDI

Post by lidnariq »

Saw wave should have all harmonics, amplitudes of 1/n. Square waves are the only rectangular waves that have the same 1/n decay, but they only have odd components.

So, Square at note N (1, 1/3, 1/5, &c) plus square at one octave up at half linear volume (1/2, 1/6, 1/10, &c) plus and square at two octaves up at one-quarter volume (1/4, 1/12, 1/20, &c) should be passably close...
_Zaphod77_
Posts: 1
Joined: Thu Nov 30, 2023 1:35 pm

Re: Simulating 75% and 87.5% pulse wave in MIDI

Post by _Zaphod77_ »

Generally either Charang or Clavinet will do a pretty convincing 12.5 duty cycle imitation. Even on windows 95 OPL3, clavinet gets you close enough to be recognisable.

My gotos for nes midi that i used back when i had ines are

50%: 80 1 (sc55mkii pure square wave, also works on yamaha in GS mode)
12.5%: Clavinet or Charang. If the notes aren't too long, clavinet works beautifully. Great for SHadowgate Death theme. Sometime overdrive or distorted guitar works well.
25%: this one is difficult to get. harmonica gets close sometimes, or maybe contrabass.
triangle: Ocarina works pretty well. other choices include clarinet at a lower volume (for when ocarina isn't buzzy enough), or maybe pan flute. sine wave is always an option as well, though it doesn't have quite enough harmonics to realy make a decent bass like the nes triangle did.
Post Reply