Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Variables

Const reservedKeys

reservedKeys: { clips: boolean; d: boolean; dLibrary: boolean; duration: boolean; eLibrary: boolean; eventMappers: boolean; key: boolean; meta: boolean; nLibrary: boolean; name: boolean; noteLibrary: boolean; originalValue: boolean; parent: boolean; plugins: boolean; r: boolean; regions: boolean; startTime: boolean; tLibrary: boolean; tracks: boolean; v: boolean; vLibrary: boolean } = ...

These keys cannot be used for patterns in tabs and scores.

Type declaration

  • clips: boolean
  • d: boolean
  • dLibrary: boolean
  • duration: boolean
  • eLibrary: boolean
  • eventMappers: boolean
  • key: boolean
  • meta: boolean
  • nLibrary: boolean
  • name: boolean
  • noteLibrary: boolean
  • originalValue: boolean
  • parent: boolean
  • plugins: boolean
  • r: boolean
  • regions: boolean
  • startTime: boolean
  • tLibrary: boolean
  • tracks: boolean
  • v: boolean
  • vLibrary: boolean

Functions

advanceArrayToSegments

  • advanceArrayToSegments(advances: number[]): number[][]
  • Create sub groups for advances.

    This helper class is only exported for testing purposes. in - [1,0,0,0,2,0] out - [[1,0,0,0], [2,0]]

    Parameters

    • advances: number[]

    Returns number[][]

createDynamicGetter

  • createDynamicGetter(rhythm: string | Rhythm, dPattern: string, dLibrary: dLibrary): (time: any) => Technique
  • createDynamicGetter is part of an experiment with dynamics that work even when applied to clips that were derived from a different rhythm string. For this to work, we need to be able to get the dynamic at an arbitrary point in time (and not just at a discrete point in the rhythm string).

    Parameters

    • rhythm: string | Rhythm
    • dPattern: string

      dynamic pattern string

    • dLibrary: dLibrary

    Returns (time: any) => Technique

parseRhythm

  • parseRhythm(rhythm: string): Rhythm
  • Convert rhythm string to a cumulative array of durations.

    Parameters

    • rhythm: string

      String representing of a rhythm

    Returns Rhythm

    a javascript object representing timing. The object will have two properties, both of which are arrays: - .totals is a measure of elapsed times - .deltas is the duration of each character

parseTab

  • parseTab(rhythm: string | Rhythm, nPattern: string, tLibrary: tLibrary): Clip
  • Convert a rhythm, pattern, and note library to a Clip.

    Parameters

    • rhythm: string | Rhythm
    • nPattern: string
    • tLibrary: tLibrary

      an indexable object containing notes or arrays of notes. Can be an object or an array. If it is an array, the pattern may only contain single digit numbers (i.e. 0-9).

         All symbols in the pattern should reference values in the noteLibrary.
      
         To create 'c' and 'd' quarter notes on beats 1 and 3 respectively:
         rhythm  = '1234'
         pattern = '0.1.'
         noteLibrary = [60, 62]
         noteLibrary = {'0': 60, '1': 62 }
      

    Returns Clip

    A clip with .startTime == 0 (startTime is set by score.parse).

patternToSymbolsAndCounts

  • patternToSymbolsAndCounts(pattern: string): [string, number][]
  • This helper method converts a pattern into an intermediary format that is helpful for parsing a tab. Its easiest to understand with an example:

    const input = 'a-1-bb...';
    const output = [['a',2], ['1',2], ['b',1], ['b', 1], ['.', 3]];
    

    For every new symbol, the out output lists that symbol, and the number of positions that that symbols is active for.

    Parameters

    • pattern: string

    Returns [string, number][]

rhythmToAdvanceArray

  • rhythmToAdvanceArray(rhythm: string | string[]): number[]
  • Convert each character in an string to an duration. In the following examples, q=1/4 and e=1/8 and h=1/2 Quarter notes: rhythm - '1+2+' result - [e,e,e,e] Spaces leave a 0 in the array. rhythm - '1 + ' result - [e,0,e,0] Eighth and quarter notes: rhythm - '1234+' result - [q,q,q,e,e] Whole notes always 1. Half notes always get 0.5 rhythm - 'h34' result - [h,q,q] See tests for more examples.

    Parameters

    • rhythm: string | string[]

      String representing of a rhythm

    Returns number[]

    An array of durations for each character