pinobatch / pently

Scalable music engine for NES games
zlib License
72 stars 4 forks source link

Portamento #18

Closed pinobatch closed 7 years ago

pinobatch commented 7 years ago

Pently has met these objections, in the order of their being solved:

Portamento was previously held up by two things. The first was whether to represent pitch change rate as period, frequency, or log frequency. I want to keep a pattern sounding reasonable when transposed and keep my options open for porting Pently to environments that use frequency instead of period, such as the Super NES S-DSP. But with a recent refactor of vibrato to represent the pitch change as an explicit fraction of a semitone, log frequency has become the clear way forward.

The other was how to handle the dynamic range of portamento. I've seen tracker compositions with pitch slides of multiple semitones per frame, and I've seen others that take 30 frames to move one semitone. I also want to throw in behavior similar to that of the Roland TB-303 bass sequencer, whose portamento uses a low-pass filter in the log frequency domain to make arrival time independent of distance to the target note as well. I guess I can make three kinds of portamento rate, some logarithmic.

  1. Constant whole semitone rate: 0-15 whole semitones per frame
  2. Constant fractional rate: Fractional rates of 1/256 semitone per frame times 4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, or 384
  3. TB-303 style proportional rate: Speed in each frame is distance to target pitch divided by 2, 4, 8, 16, 32, 64, 128, or 256

This will require at least three new variables for each channel: note current pitch whole number, note current pitch fraction, and portamento rate setting.