Class Pitch

  • All Implemented Interfaces:
    Serializable, OptionDataListener, org.zkoss.json.JSONAware

    public class Pitch
    extends Optionable
    Musical pitch refers to how high or low notes are played.

    By default it is mapped to y so low y values are played with a lower pitch, and high values are played with a higher pitch.

    Pitch mapping has a few extra features compared to other audio parameters.

    Firstly, it accepts not only number values, but also string values denoting note names. These are given in the form , for example "c6" or "F#2".

    Secondly, it is possible to map pitch to an array of notes. In this case, the [gapBetweenNotes](#sonification.defaultInstrumentOptions.mapping.gapBetweenNotes) mapping determines the delay between these notes.

    Thirdly, it is possible to define a musical scale to follow when mapping.

    Can be set to a fixed value, an array, a prop to map to, a function, or a mapping object.

    Since:
    11.2.0.0
    Author:
    Jamson Chan
    See Also:
    Serialized Form
    • Constructor Detail

      • Pitch

        public Pitch()
    • Method Detail

      • getMapFunction

        public String getMapFunction()
        Returns how to perform the mapping. ("linear", "logarithmic")

        Default: null

      • setMapFunction

        public void setMapFunction​(String mapFunction)
        Sets how to perform the mapping. ("linear", "logarithmic")
      • getMapTo

        public String getMapTo()
        Returns a point property to map the mapping parameter to.

        A negative sign - can be placed before the property name to make mapping inverted.

        Default: "y"

      • setMapTo

        public void setMapTo​(String mapTo)
        Sets a point property to map the mapping parameter to.

        A negative sign - can be placed before the property name to make mapping inverted.

      • getMax

        public String getMax()
        Returns the maximum value for the audio parameter. This is the highest value the audio parameter will be mapped to.

        Default: "c6"

      • setMax

        public void setMax​(String max)
        Sets the maximum value for the audio parameter. This is the highest value the audio parameter will be mapped to.
      • getMin

        public String getMin()
        Returns the minimum value for the audio parameter. This is the lowest value the audio parameter will be mapped to.

        Default: "c2"

      • setMin

        public void setMin​(String min)
        Sets the minimum value for the audio parameter. This is the lowest value the audio parameter will be mapped to.
      • getScale

        public List<Number> getScale()
        Returns the scale array.

        Map pitches to a musical scale. The scale is defined as an array of semitone offsets from the root note.

        Default: null

      • setScale

        public void setScale​(List<Number> scale)
        Sets the scale array.

        Map pitches to a musical scale. The scale is defined as an array of semitone offsets from the root note.

      • setScale

        public void setScale​(Number... scale)
        Sets the scale array.

        Map pitches to a musical scale. The scale is defined as an array of semitone offsets from the root note.

      • getValue

        public Number getValue()
        Returns a fixed value to use for the prop when mapping.

        For example, if mapping to y, setting value to 4 will map as if all points had a y value of 4.

        Default: null

      • setValue

        public void setValue​(Number value)
        Sets a fixed value to use for the prop when mapping.

        For example, if mapping to y, setting value to 4 will map as if all points had a y value of 4.

      • getWithin

        public String getWithin()
        Returns what data values to map the parameter within.

        Mapping within "series" will make the lowest value point in the series map to the min audio parameter value, and the highest value will map to the max audio parameter.

        Mapping within "chart" will make the lowest value point in the whole chart map to the min audio parameter value, and the highest value in the whole chart will map to the max audio parameter.

        You can also map within the X or Y axis of each series.

        Default: null

      • setWithin

        public void setWithin​(String within)
        Sets what data values to map the parameter within.

        Mapping within "series" will make the lowest value point in the series map to the min audio parameter value, and the highest value will map to the max audio parameter.

        Mapping within "chart" will make the lowest value point in the whole chart map to the min audio parameter value, and the highest value in the whole chart will map to the max audio parameter.

        You can also map within the X or Y axis of each series.