Ok, maybe I should document this a bit now since I'm feeling like it...
also maybe it would be a good idea to eventually incorporate this to the
wiki.

So, the pitch sweeps in ch1 & 2. They work the same way as NES pitch
sweeps. I love old audio chips, they had all these weird illogical
quirks and sometimes downright bugs, which later turned out people could
use to their advantage to create more creative and interesting sounds.

Thing with the NES pitch sweeps is, that they don't keep track of the
sweep position in any way. If you write to the pitch register, then the
pitch is set to that pitch, and the pitch sweep just keeps on going from
whatever pitch you set it to, even if it's lower than the previous pitch
and you were going up. The pitch sweep basically just increments or
decrements the pitch at an interval, no matter what the current pitch is.

I've preserved this functionality in the NES instrument, which means
that you can combine a pitch automation/ note detuning with the emulated
pitch sweep for interesting effects. You can get the sounds very much
like the ones used in Zelda 2 when you walk in to the random encounters,
or the punch sounds from Punch Out... this weird jagged pitch sweep
sound where the pitch curve gets modulated by the hardware's own pitch
sweep... sounds very nostalgic and awesome.

Another thing to note is the noise channel (channel 4). Early consoles
like the NES used a very simple form of pseudo-random noise generation,
which is called a LFSR, or a Linear Feedback Shift Register. It's
basically just a very simple piece of binary logic that generates
repeating bitstreams by a couple of very simple binary operations (XOR
and SHL mostly). The repetition length of the bitstream it generates is
dependent on the implementation details of the LFSR: which bits are
xor:ed with which other bits, how many bits are in the register, etc.

The NES LFSR had 15 bits, and 2 operation modes. Mode 0 produces a
bitstream that is 32768 bits long, whereas mode 1 produces a much
shorter repeating bitsream, only 93 bits. Thus, since the repeating
pattern in Mode 1 is shorter, it sounds much more melodic (and kind of
metallic).

There are some funny quirks here too: if you switch from Mode 0 to Mode
1 in mid-note, the LFSR will not be re-seeded with the default value,
but instead continues from the value it left in, which makes the 93-bit
Mode 1 behave differently and produce a slightly different sound. This
is consistent with NES behaviour, in a way...

I feel I should also note, that some of the functionality in the NES
instrument is a bit like "cheating" and not present in the original NES,
but included for convenience: in the original NES, you couldn't adjust
both the envelope and the volume of a channel at the same time. So if
you have an envelope active, the vol knob should always be at 15, if you
strive for authenticity.

Also, the triangle channel (ch 3) had no volume control - but, there was
a certain hardware glitch that could be abused to gain some amount of
volume control for it, which involved using the (absent from this
instrument) 5th channel, which was the sample-playback channel (yes, NES
had primitive sampling capabilities!) I didn't include the 5th channel
because it's a bit redundant and you can get basically the same thing by
running a sample through a bitcrusher... Anyway, to make things simpler,
I just included a volume knob for it regardless. It probably isn't
accurate to how the ch3 volume adjustment worked in the NES, though.

That's all for now - I'll write more when I finish the synth...

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
LMMS-devel mailing list
LMMS-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lmms-devel

Reply via email to