Some MOD formats implement linear pitch (logarithmic frequencies) as discrete steps, I think commonly 64 per semitone? You could implement something similar with a table of 12 note frequencies * 20 divisions of the semitone, and apply octaves through bit-shift operations. This would make linear pitch slides very simple, though granular, but I wouldn't expect the granularity to be a significant problem.
If you're talking about tool/UI notation as well, most musical editors I've seen generally treat a pitch slide as an effect applied to a note that otherwise appears "flat". MIDI piano roll editors will often just show a note as a straight horizontal bar, and a pitch bend would be an effect applied to the channel (visible on a separate control track below the note field, sometimes). With MOD trackers similarly you just play a note and then apply pitch changes in the effect column. I mentioned with lilypond how you just write \glissando between two notes for that, etc, which seems fine for text-based input.
PXTone does a piano roll, but I think it actually notates pitch bends with a bent note bar to show where it ends, which is pretty cool. (I don't have it installed or I'd take a picture.)
How are pitch bends notated?
Moderator: Moderators
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: How are pitch bends notated?
With formats such as MOD/IT/XM/S3M, there are two common kind of portamento which can be "Amiga portamento" (meaning working with period values) or "linear portamento" (meaning working with a logarithmic scale). There are then commands which apply portamento up or down by a specified speed. AmigaMML (which compiles into MOD/XM) supports two methods of specifying portamento, which are command envelopes (which are almost direct MOD/XM commands), and auto-portamento (only for XM with linear slides) which are indicated with a slash between notes (but I don't know if any other program does something similar to the way AmigaMML does it).
(Free Hero Mesh - FOSS puzzle game engine)
Re: How are pitch bends notated?
Who cares ? Multiplication is still possible on a 6502. If, after having designed the sound engine, it really turns out to be too slow, you can always optimize it using tables later. You can also do the (a+b)^2 - a^2 - b^2 trick, which makes some types of multiplication very fast on the 6502.That's what I'd do on an SPC700, which can multiply Y by A. But multiplication is quite a bit slower on a 6502.
Also for the pitch table granularity trick, I think 21 pitches values per semitones could be a useful values as it prevents the octave table to be more than 255 entries. It is not as intuitive as using a power of 2 though.
Re: How are pitch bends notated?
Developers of games that aren't turn-based care.Bregalad wrote:Who cares ?That's what I'd do on an SPC700, which can multiply Y by A. But multiplication is quite a bit slower on a 6502.
So is floating-point math; see Applesoft BASIC. But not everything that's possible is wise, especially in an application with a real-time constraint.Multiplication is still possible on a 6502.
I have done the math, and two 8-bit-by-8-bit multiplications without tables for each of the three pitched channels (pulse 1, pulse 2, and triangle) would add over 10 scanlines' worth of cycles to the cycle budget. In an engine targeted at NSFs and stand-alone music ROMs, such as FamiTracker's own engine, I could get away with fairly complex arithmetic. But Pently is targeted at real-time games. If I were to make a rule "portamento is permitted in menus and in turn-based games, just not in-game during real-time games", that would just turn into "Could you make portamento faster? The game for which I requested the feature is real-time."If, after having designed the sound engine, it really turns out to be too slow
When a music engine is on the order of 1.5K, and you're trying to squeeze it into your NROM or CNROM project or into the fixed bank of your UNROM, MMC1, or MMC3 project (so that you can put the songs and patterns into the switchable bank), a 1K quarter square table would nearly double it just for one effect. There's a set of flags for turning off each of several ROM-intensive effects at build time.you can always optimize it using tables later. You can also do the (a+b)^2 - a^2 - b^2 trick, which makes some types of multiplication very fast on the 6502.
Nor do I want to have to maintain three or more different portamento implementations in the long term, one for each point on the time-space tradeoff curve:
- Amiga-style period-space portamento, which is likely to sound significantly different if you transpose the music, play on NTSC vs. PAL, or reuse a piece of music on a different platform to which I plan to port Pently in the future, and is likely to break even more if you try to combine it with vibrato or arpeggio
- Space-intensive portamento
- Time-intensive portamento
Re: How are pitch bends notated?
What about linear slides (of period, I guess) from semitone to semitone, but re-indexing to the master tuning table as it crosses a threshold? (maybe one or two semitones, depending)
Re: How are pitch bends notated?
That could work.
I guess my real concern is how to express how fast the slide is.
I guess my real concern is how to express how fast the slide is.
Re: How are pitch bends notated?
In particular, the problem is the extreme dynamic range expected of a portamento effect. Some compositions using portamento want a rate of multiple semitones per frame, while others might be as slow as one semitone per second.
Pitch bend in MIDI sends the equivalent of one update per frame. Ex yy zz sets the pitch bend for channel x+1 to z*128+y, where that value ranges from 0 (minimum) through 8192 (centered) to 16383 (maximum). The range from minimum to maximum is implementation-defined, but PC-based MIDI implementations appear to default to a range of four semitones (center plus or minus two), and some synths allow changing the range using "registered parameter" control messages. But this representation is probably too data-dense for NES use, much like the rest of the MIDI and Standard MIDI File formats.
Trackers offer three models for pitch bend, all of which add or subtract a particular amount per frame as long as the effect is in operation. All support the period model; XM and IT also support a logarithmic model with 16 units per semitone.
XM also supports "glissando", which quantizes slides to semitones, controlled by effects E30 and E31.
Pitch bend in MIDI sends the equivalent of one update per frame. Ex yy zz sets the pitch bend for channel x+1 to z*128+y, where that value ranges from 0 (minimum) through 8192 (centered) to 16383 (maximum). The range from minimum to maximum is implementation-defined, but PC-based MIDI implementations appear to default to a range of four semitones (center plus or minus two), and some synths allow changing the range using "registered parameter" control messages. But this representation is probably too data-dense for NES use, much like the rest of the MIDI and Standard MIDI File formats.
Trackers offer three models for pitch bend, all of which add or subtract a particular amount per frame as long as the effect is in operation. All support the period model; XM and IT also support a logarithmic model with 16 units per semitone.
- Open-loop portamento
1xx (MOD, XM, FTM), Fxx (S3M, IT): Slide up. Add x units per frame to period.
2xx (MOD, XM, FTM), Exx (S3M, IT): Slide down. Subtract x units per frame from period.
E1x (XM), EFx (S3M, IT): One-shot slide up. Add x units per row to period.
E2x (XM), FFx (S3M, IT): One-shot slide down. Subtract x units per row from period. - Portamento to target
3xx (MOD, XM, FTM), Gxx (S3M, IT): Change period by x units per frame toward the current note.
5xy (MOD, XM), Lxy (S3M, IT): Continue previous portamento to target while adding x - y units to channel volume per frame. - Portamento by interval
Qxy (FTM): Add y semitones to current note, then do 3zz where z = 2*x+1.
Rxy (FTM): Subtract y semitones from current note, then do 3zz where z = 2*x+1.
XM also supports "glissando", which quantizes slides to semitones, controlled by effects E30 and E31.