It is currently Tue Mar 28, 2017 4:24 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Oct 08, 2016 8:50 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 4914
Location: Canada
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.)


Top
 Profile  
 
PostPosted: Sat Oct 08, 2016 9:44 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 880
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).

_________________
.


Top
 Profile  
 
PostPosted: Sun Oct 09, 2016 2:40 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 6954
Location: Jongny, VD, Switzerland
Quote:
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.

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.

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.


Top
 Profile  
 
PostPosted: Sun Oct 09, 2016 9:09 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17997
Location: NE Indiana, USA (NTSC)
Bregalad wrote:
Quote:
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.

Who cares ?

Developers of games that aren't turn-based care.

Quote:
Multiplication is still possible 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.

Quote:
If, after having designed the sound engine, it really turns out to be too slow

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."

Quote:
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.

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.

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:

  1. 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
  2. Space-intensive portamento
  3. Time-intensive portamento


Top
 Profile  
 
PostPosted: Sun Oct 09, 2016 12:11 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 5429
Location: Seattle
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)


Top
 Profile  
 
PostPosted: Sun Oct 09, 2016 12:35 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17997
Location: NE Indiana, USA (NTSC)
That could work.

I guess my real concern is how to express how fast the slide is.


Top
 Profile  
 
PostPosted: Tue Nov 15, 2016 4:34 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17997
Location: NE Indiana, USA (NTSC)
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.

  1. 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.
  2. 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.
  3. 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.

I had planned to support only the portamento to target model, with the portamento by interval simulated by using a grace note followed by the target note, and the open-loop model as portamento by an arbitrary large interval.

XM also supports "glissando", which quantizes slides to semitones, controlled by effects E30 and E31.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group