The VG Resource

Full Version: Working with Bleeps (NSF) Study Time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Last night I took it upon myself to waste my night googling and researching sound synthesis. Spent most of the time on one site:
Sound On Sound

The articles discuss in detail some of the factors that go into simulating real instruments on synthesizers. This doesn't pertain to sampled instruments, like I have a feeling many synthesizers use nowadays, but rather the fine-tunable synthesizers like Moog or Korg. Since FamiTracker doesn't use samples, this is a useful read, even if it doesn't tell you what you may want to know. There's no math, but lots of theory and simplified physics, and fortunately some diagrams. Of particular interest for me were the topics of envelopes (how volume varies from instrument to instrument), what waveforms are ideal for some types of instruments (figured this out on my own last night, though), and a refresher on the concept of attacks (blowing hard or softly into a trumpet, for example).

Another site I read, which was pretty simple but still insightful for me:
DrPetter's Basic Sound Theory and Synthesis

This article deals more with generating sounds for use in games. He talks a bit about waveforms and his thoughts on the psychology behind popular styles of sound effects, such as the coin from Mario, player deaths, lasers, and such. Again, it's pretty basic, but offers some decent insight.

Anyway, I started this topic so we could share links to sound synthesis guides, insight or summaries on what we've learned or discovered about sound synthesis, or any creations we've come up with ourselves. If you share instrument creations in FamiTracker, you can just copy/paste the MML data for Volume (V), Arpeggio (A), Pitch (P), Hi-Pitch (H), and Duty (D).


Some things I've learned last night:

Brass instruments tend to be plosive, that is, they have an attack at the beginning and then taper off to their sustained volume. In other words, a trumpet or trombone will not have a sustained V15. However in a slower song, maybe such as in a game over scene's music, the bugle (let's say) would have a gentler approach to the sustain. In order to make the plosives stand out in your song, you should keep all the sustains near the same level. But to make the plosive stand out, you need to drop below the sustain level (down to V8 or so) and then gradually crescendo up to the sustain.

Do not cut off your notes. In FamiTracker's instrument editor are two options, loop and release. When you record your notes, pressing \ adds a Release command. This will tell the note to then play whatever is in the release section. What you should do is have an instrument loop the vibrato (volume fluctuation) or tremolo (pitch fluctuation) and then gradually fade to V0 on the release. Of course, you wouldn't need to do this when notes are in rapid succession, but if there is a rest after a note, you should make use of releases for a richer effect.

Many games used DPCM timpanis/kettle drums and bass drums. The reason for this is because timpanis and bass drums are harmonic drums, as opposed to snare drums and cymbals, which are enharmonic. The enharmonic drums can just use the Noise channel. Toms are routinely employed on the Triangle channel because they behave like tiny bass drums hit with drumsticks. However, a tom's notes will be succinct, making a Triangle tom somewhat logical, but a timpani or bass drum will reverberate longer, so a Square channel would be best. A Triangle tom suffers from cleanness not present in a real tom. This can be compensated for by synching the Triangle tom with a noise hit, but another alternative is a Square tom. I feel a Square wave is ideal for harmonic percussion because the percussive noise at the time of impact for a harmonic drum can be simulated roughly by alternating duty cycles. Alternating between D1 and D3 then ending on D2 creates a percussive tom sound quite nicely. Repeating this flux works well for a bass drum. With any drum, D0 seems to be a poor choice at any point, but if you find a use for it, go for it.

On the topic of duty cycles...

D1 and D3 in the Square wave sound very much alike, but there is indeed a difference. Using a steady note, they sound alike, but with a pitch bend/tremolo or even vibrato, the difference becomes much clearer. With a tremolo, D1 sounds flatter and D3 sounds richer. We're talking the difference between a trumpet and a trombone, or viola and contra bass. The difference is very noticeable during a crescendo. D1 is better for slow attacks, while D3 is better for faster sweeps. In other words, D1 gives the sound more of a draw. Use D1 at the start of a viola's (for example) phrase and D3 whenever the notes are connected. With woodwinds and brass, D3 is useful for plosives or breaths, while D1 is hardly noticeable.

D2 is good for melodic percussion, like xylophones. However, as I say farther down this post, the Triangle wave is somewhat better for xylophones, in my opinion. Starting a duty cycle phrase with D2 will create a "ploink" every time a note is played. Alternating from D2 to D1 or D3 creates a low pop, possibly better suited for bass drums, timpani, or guitar slaps.

I've compiled this list of which waveform best suits which instrument (neglecting the VRC6's sawtooth, which is ideal for many of these) based on my poor hearing. I played a C3 or C4 or F3 or F4 in FamiTracker with no modulation for each duty cycle (except in the Triangle wave, which doesn't use duty cycles). These associations might not match other people's preferences, but again, these are based on what I heard on my Yamaha keyboard. And again, I have bad hearing, so...

Square Wave
Duty 0
Violin
Cello (C3 equals a cello at C5)
Smoke Alarm Big Grin
Alto Sax
Duty 1
Viola
Contra bass (C3 equals a contra bass at C5)
Harpsichord
Organs and Accordions
Brass instruments
Harmonica
Bagpipes
Reed woodwinds (except Alto Sax)*
Piano sustain (remember, pianos are percussion)
Guitar sustain (haven't decided what to use for pluck/strum)
Duty 2
Pong sound Big Grin
Simple woodwinds (for when vibrato is needed)
Square lead
Hawaiian Guitar
Harp
Pizzicato strings fade (use D0/D1 for the pluck)
Piano lead
Duty 3
See comments above
Triangle Wave
Organ (alternative)
Choral 'Ooh'
Simple woodwinds (no vibrato, requires high octaves)
Pan Flute (the only woodwind with the same octave)
Melodic Percussion sustain**

*Soprano sax is played at the same octave. Tenor sax is played one octave lower (i.e., C2 in FamiTracker is equivalent to C3 on the sax). Bari sax is played two octaves lower (i.e., C2 in FamiTracker is equivalent to C4 on the sax). Alto sax is closer to D0, although playing the same phrase on D0 and D1 using both Square channels may simulate an alto sax much better.

**Xylophones, marimbas and celestas can be simulated by playing phrases over all the channels with some timing differentials. Use the Triangle waveform for the middle of the note. Use Square and Noise for the percussive and fading parts. I know most people don't like taking up multiple channels for one instrument, but the great composers can do so without compromising their music. :p
I read a little of the text above due to being at work (I can't read it all, sadly), but the topic is so interesting I think I could add a little.

I make NSF chiptunes since 3~4 years ago, so in this time, I figured some techniques that can be useful to anyone interested in making NES chiptune.

First of all, I'll be talking about square waves since they're the principal sound channels. Basically, the two square channels have four 'duty cycles' which changes the way the note sounds. They're as follows:

0- an 'open' sound. See Metroid's Brinstar for this type of sound.
1- a more suave sound, reminescent of a piano. Later Konami games used this duty cycle regularly. See Gradius II/Contra music for this type of sound.
2- the classic square wave sound. This one was extensively used in older games. See Metroid's 'Kraid's Lair', SMB's 'Overworld' or Kid Icarus' 'Underworld' for this type of wave.
3- it's virtually the same as 1.

The composers (principally the late ones) varied a lot between those sounds to make the song richer in detail. Usually, they used the duties as TheouAegis said, but in addition to that, they also:

*made echoes in the lead instrument, by writing the lead in the channel 1 and rewriting the same notes, although delayed some seconds, and with lower volume. The effect is greater if the lead is set at duty 1/3 and the echo, at 2, and even more if the echo is slighty detuned with fine-pitching.
*didn't use note cut, favouring sudden volume drops instead (e.g playing a note at volume 100, then suddenly dropping it to 5). This way, they emulated echoes with only one channel, leaving the channel 2 free.
*made more convincing instruments by using more than one duty at a time. For example, you can make good overdrive guitars by making an instrument that plays duty 1 for a split second then goes to duty 0.
*Nothing says that you can't use square waves as bass. You might get some nice swing if you use squares for bassline, as they're more versatile and flexible than the triangle wave. The main melody will suffer a little, though. See Kirby's Adventure music.

*Better bass can be obtained with triangle wave if you set it to play one octave higher for a split second. It gives it more 'punch' to it.
*latin-style music claves can be obtained with triangles if you play a very high note in a split second.
*It can be used as lead and harmony to duty 2 square leads. See Kirby's Adventure music for examples.
*Triangle, despite having fixed volume, can have volume changes if DPCM is played. Using this right, you could even make nice echo-y effects with it (although with some audible pops).

*noise snares will sound better if you set it a certain pitch slide to it. Konami did this in its games. In Famitracker strings, that would be 0 8 6 4 2 -1 1 0.
*better snares are achieved by playing a DPCM sample and noise snare together.
*You can also get nice crash cymbals if you use the same pitch described above, with an even longer volume fadeout. If you insert a small fadein before the down slope, it'll sound even more convincing.

*DPCM is hard to use because its 16kb limit and low-quality sampling kills triangle and noise's volume. It's necessary to reduce it and tilt the wave nearer to 0 to avoid pops.
*DPCM is capable of producing bass sounds. See Sunsoft's Batman or Gremlin. Though, it sacrifices sampled percussion.
*Orchestra hits are also possible (see Recca/Super C), though a square wave with arpeggio set to 12 0 and fade out volume in famitracker produces satisfatory results.
*Voice is also prefectly possible in NSF. Check The Adventures of Bayou Billy or S.C.A.T.
*make sure the samples are audible. They tend to get lost when a lot of instruments play.
*theorically, you could get past the 16kb limit of the NSF by 'converting all the space inside the cartridge into sample space'. Famitracker allows this in a bug, and homebrew people already inserted high-quality samples in a real unmodified NES cartridge, though the sample was so big there was not enough space for actual gaming.
Ooh thanks for the feedback. Especially on the bass. I never thought about that split-second octave.