If you use my VST in your project, give me a shout on Twitter @matthewmontag. I'd love to hear what you come up with.
- Fixed issues from version 1.1...
- Pitch range -12 to +12
- Fixed problem where C was playing F#
- Tuning is back to A440
- More reasonable volume level
- Cleaned up the default patch set
- Portamento (try it with the noise generator)
- Master volume control
- Pitch bend (fixed range of 2 semitones)
- Velocity sensitivity
- Legato mode (doesn't retrigger step sequencers)
- More colors
Super Mario Brothers
Project Notes and Documentation
The NES VST is designed to emulate the 8-bit sounds of the Nintendo, remaining faithful to the specifications of the 2A03 chip. The plugin was built in Outsim SynthMaker to allow for an advanced user interface, and sounds were evaluated against the output of FamiTracker, which uses the Blip Buffer library to generate "perfect" alias-free primitive waveforms. In our project, aliasing is minimized with conventional techniques available in SynthMaker.
The following is a discussion of each 2A03 chip sound channel (Square, Triangle, Noise, and DPCM) and their implementation in SynthMaker.
Our square wave was initially constructed by summing two saw waves limited at half bandwidth, which really means 1/4 of the sample rate or 11,025 hz. This was unsatisfactory and we switched to a construction from saw waves limited at nyquist. The test signal was a square wave with pulse width modulation cycling across 25%, 50%, 75%, and 12.5% pulse width. The results are compared here:
Linear sonogram of PWM square wave. The first tone is produced by SynthMaker before correction. The second and fourth tones are produced by FamiTracker. The third tone is the corrected full-bandwidth square wave produced by SynthMaker. Notice the first tone produces undesirable full bandwidth clicks when the pulse width changes. The corrected tone masks this effect.
The Nintendo triangle wave has a distinct sound. It is produced by quantizing a triangle waveform to 16 discrete amplitudes. It also has an asymmetrical rise and fall. The falling segment of the waveform is slightly curved and the rise is linear. The triangle wave normally contains only odd harmonics, but this irregularity causes the signal to gain even harmonics, characteristic of the saw wave.
Nintendo triangle wave (produced by FamiTracker) vs. aliased triangle from SynthMaker.
Wavetable triangle vs. Nintendo triangle wave (produced by FamiTracker) This first attempt at band-limited wavetable synthesis used only 32 sample points as input. The resulting waveform does not have the high quantization harmonics.
Nintendo triangle wave (produced by FamiTracker) vs. band-limited wavetable triangle from SynthMaker. This time, the wavetable used 512 sample points. The sample points were also tweaked to create an asymmetric wave shape.
Triangle Oscillator Block Diagram
The noise channel in the Nintendo is not noise in the usual sense, where amplitude or frequency would be modulated randomly. Instead, the NES sends a random sequence of bits directly to audio out. This is analagous to a square wave with a continuously-varying random pulse width. The NES produces noise in repeating sequences of 32767 or 93 bits. The pitch or color of the noise is variable at 16 modes. These modes are mapped to MIDI notes in our VST plugin.
The noise sequence produced by code is heavily aliased with a great deal of harmonic content above 22,050 hz. To solve this problem we subdivide time and create 8 unique output samples at every tick. These samples are merged and lowpass filtered to produce an 8x oversampled anti-aliased output.
Noise Oscillator Block Diagram
Delta pulse code modulation is achieved by either increasing or decreasing the amplitude of the signal by a fixed interval at every sample. The signal never maintains a steady amplitude, and the amplitude climbs at a limited rate. The NES uses DPCM to play sampled audio, and does so with an amplitude resolution of 6 bits or 64 levels. We achieve realtime DPCM in code. We allow the user to select 4 custom WAV file samples and attach the samples to MIDI notes C4, D4, E4, and F4.
DPCM Oscillator Block Diagram
The output is filtered by custom highpass- and lowpass-shelf filters. The filters attenuate unwanted ultra low frequency and high frequency content that may be produced by the DPCM.