NovaSquirrel / ft2pently

Famitracker to Pently music converter
GNU General Public License v2.0
14 stars 1 forks source link

Turn Qxy and Rxy into portamento #24

Open pinobatch opened 6 years ago

pinobatch commented 6 years ago

FamiTracker measures pitch slides in "units". In FamiTracker 0.4.6 and 0CC-FamiTracker by default, units are raw period register units: smaller at low pitches and larger at high pitches. But the 0CC-FamiTracker fork has an option to instead use "linear pitch", which redefines a "unit" as 1/32 semitone (about 3 cents) no matter whether the pitch is high or low. (See 0CC-readme section "Linear Pitch Mode".)

Vibrato and portamento in Pently also use linear pitch, with 256 internal units per semitone. But for the purpose of this feature request, I will convert everything to 0CC-FT linear pitch units (1/32 semitone).

Pently supports an effect EPxx, which behaves much like FT's 3xx, but the rate ranges are different, with EP0x going at x semitones per frame and EP1x using an exponential scale.

EP code Units/frame 0CC-FT effects
EP10 0.5
EP11 1 Q0x, R0x
EP12 1.5
EP13 2
EP14 3 Q1y, R1y
EP15 4 Q2y, R2y
EP16 6 Q3y, R3y
EP17 8 Q4y ,R4y
EP18 12 Q5y, Q6y, R5y, R6y
EP19 16 Q7y-Q9y, R7y-R9y
EP1A 24 QAy-QDy, RAy-RDy
EP01 32 QEy, REy
EP1B 48
EP02 64
EP03 96
EP04 128
EP05 160
EP06 192
EP07 224
EP08 256
EP00 Instant QFy, RFy

I will limit this particular feature request to the Qxy and Rxy effects, as they are probably the most musically useful when not simulating percussion.

It's easiest to explain if the Qxy or Rxy is not on the same row:

F-3 .. . ...
... .. . R45
... .. . ...
... .. . ...

This means "Play a C-3 for one row, then on the next row, slide up to F-3 (which is 5 notes up) at 9 units per frame (which is 4 * 2 + 1)." It might become this:

f'16( EP17 c'8.) EP00

This means "Play an f' sixteenth note, turn on legato, set pitch slide to 8 units per frame, play a c' dotted eighth note, turn off legato, and disable pitch slide." Because 9 units per frame does not exist in Pently, the converter would round it to 8, whose code is EP17.

Qxy and Rxy on the same row as a note are slightly tricker. There appears to be currently a quirk in Pently that causes portamento to miss a new note pitch unless a note has been active for at least 2 frames. So this pattern fragment:

C-3 .. . Q45
... .. . ...
... .. . ...
... .. . ...

It means "Play a C-3, and on the same row, slide up to F-3 at 9 units per frame that continues until the start of the following note." A plausible translation:

c'2g( EP17 f'4) EP00

This means "Play a c' that lasts 2 frames, turn on legato, set pitch slide to 8 units per frame, play an f' quarter note, turn off legato, and disable pitch slide."

I choose to map QFy and RFy to instant pitch change (EP00) because a member of the FT users' Discord server recommended it as a replacement for the legato effect.

I have uploaded a 0CC-FamiTracker module and a plausible hand-translation into a Pently score.

Qxx_Rxx.0cc.zip Qxx_Rxx.pently.txt

pinobatch commented 4 years ago

Another test case, with explanation included, if it matters Qxx_test.zip