Nord Modular Tempo Format

When the Nord Modular Editor writes patch files, the sequencer tempo is stored in an odd format, which packs the entire tempo range into a 7bit value. In beats per minute, the tempo ranges from 24 to 214. For values toward the ends of the spectrum, it skips by two.

  • 24bpm to 88bpm = by 2
  • 89bpm to 151bpm = by 1
  • 152bpm to 214bpm = by 2

The following C snippet should translate from BPM to nord-patch-file format and reverse.

unsigned char bpmToNordTempo(int b)
{
    if(b<24)
        return 0;
    else if(b<88)
        return (b-24)/2;
    else if(b<152)
        return b-88+32;
    else if(b<214)
        return (b-152)/2+96;
    else
        return 127;
}
 
int nordTempoToBpm(unsigned char t)
{
    if(t<32)
        return t*2+24;
    else if(t<96)
        return t-32+88;
    else if(t<128)
        return (t-96)*2+152;
    else
        return 214;
}

The Sentinel

Today in Barton’s compsci class we went over simple user-controlled looping.  This allows us to collect variable amounts of input from user, without asking them explicitly for the number of fields in advance.

We used Barton’s Constant (-999) as a sentinel value to trigger the end of the data set.  In many ways this is a lame solution, since -999 may be a valid data point for some data sets, and it also requires additional instructions at each prompt to let the user know how to exit the loop.  In the future, we’ll hopefully learn how to trap Ctrl-C or Ctrl-D to make this simpler, or maybe we can simply detect a null input to indicate list completion.

Of course, all of the above is moot once we get into Graphical User Interfaces.  But for command-line stuff, I guess there aren’t really any better solutions…