Class Mapping

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

    public class Mapping
    extends Optionable
    Mapping options for the audio parameters.

    All parameters can be either:

    • A string, referencing a point property to map to.
    • A number, setting the value of the audio parameter directly.
    • A callback function, returning the value programmatically.
    • An object defining detailed configuration of the mapping.
    If a function is used, it should return the desired value for the audio parameter. The function is called for each audio event to be played, and receives a context object parameter with time, and potentially point and value depending on the track. point is available if the audio event is related to a data point, and value is available if the track is used for a context track using valueInterval.
    Since:
    11.2.0.0
    Author:
    Jamson Chan
    See Also:
    Serialized Form
    • Constructor Detail

      • Mapping

        public Mapping()
    • Method Detail

      • getFrequency

        public Object getFrequency()
        Returns the Frequency or Number or String object of frequency, depend on what was set.

        Map to filter frequency in Hertz from 1 to 20,000Hz.

        Frequency in Hertz of notes. Overrides pitch mapping if set.

      • setFrequency

        public void setFrequency​(Frequency frequency)
        Sets the Frequency object of frequency.

        Map to filter frequency in Hertz from 1 to 20,000Hz.

        Frequency in Hertz of notes. Overrides pitch mapping if set.

      • setFrequency

        public void setFrequency​(Number frequency)
        Sets the Number object of frequency.

        Map to filter frequency in Hertz from 1 to 20,000Hz.

        Frequency in Hertz of notes. Overrides pitch mapping if set.

      • setFrequency

        public void setFrequency​(String frequency)
        Sets the String object of frequency.

        Map to filter frequency in Hertz from 1 to 20,000Hz.

        Frequency in Hertz of notes. Overrides pitch mapping if set.

      • getGapBetweenNotes

        public Object getGapBetweenNotes()
        Returns the GapBetweenNotes or Number or String object of gapBetweenNotes, depend on what was set.

        Gap in milliseconds between notes if pitch is mapped to an array of notes.

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

      • setGapBetweenNotes

        public void setGapBetweenNotes​(GapBetweenNotes gapBetweenNotes)
        Sets the GapBetweenNotes object of gapBetweenNotes.

        Gap in milliseconds between notes if pitch is mapped to an array of notes.

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

      • setGapBetweenNotes

        public void setGapBetweenNotes​(Number gapBetweenNotes)
        Sets the Number object of gapBetweenNotes.

        Gap in milliseconds between notes if pitch is mapped to an array of notes.

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

      • setGapBetweenNotes

        public void setGapBetweenNotes​(String gapBetweenNotes)
        Sets the String object of gapBetweenNotes.

        Gap in milliseconds between notes if pitch is mapped to an array of notes.

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

      • getHighpass

        public Highpass getHighpass()
        Returns the Highpass object.

        Mapping options for the highpass filter.

        A highpass filter lets high frequencies through, but stops low frequencies, making the sound thinner.

      • setHighpass

        public void setHighpass​(Highpass highpass)
        Sets the Highpass object.

        Mapping options for the highpass filter.

        A highpass filter lets high frequencies through, but stops low frequencies, making the sound thinner.

      • getLowpass

        public Lowpass getLowpass()
        Returns the Lowpass object.

        Mapping options for the lowpass filter.

        lowpass filter lets low frequencies through, but stops high frequencies, making the sound more dull.

      • setLowpass

        public void setLowpass​(Lowpass lowpass)
        Sets the Lowpass object.

        Mapping options for the lowpass filter.

        lowpass filter lets low frequencies through, but stops high frequencies, making the sound more dull.

      • getNoteDuration

        public Object getNoteDuration()
        Returns the NoteDuration or Number or String object of note duration, depend on what was set.

        Note duration determines for how long a note plays, in milliseconds.

        It only affects instruments that are able to play continuous sustained notes. Examples of these instruments from the presets include flute, saxophone, trumpet, sawsynth, wobble, basic1, basic2, sine, sineGlide, triangle, square, sawtooth, noise, filteredNoise, and wind.

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

      • setNoteDuration

        public void setNoteDuration​(NoteDuration noteDuration)
        Sets the NoteDuration object of note duration.

        Note duration determines for how long a note plays, in milliseconds.

        It only affects instruments that are able to play continuous sustained notes. Examples of these instruments from the presets include flute, saxophone, trumpet, sawsynth, wobble, basic1, basic2, sine, sineGlide, triangle, square, sawtooth, noise, filteredNoise, and wind.

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

      • setNoteDuration

        public void setNoteDuration​(Number noteDuration)
        Sets the Number object of note duration.

        Note duration determines for how long a note plays, in milliseconds.

        It only affects instruments that are able to play continuous sustained notes. Examples of these instruments from the presets include flute, saxophone, trumpet, sawsynth, wobble, basic1, basic2, sine, sineGlide, triangle, square, sawtooth, noise, filteredNoise, and wind.

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

      • setNoteDuration

        public void setNoteDuration​(String noteDuration)
        Sets the String object of note duration.

        Note duration determines for how long a note plays, in milliseconds.

        It only affects instruments that are able to play continuous sustained notes. Examples of these instruments from the presets include flute, saxophone, trumpet, sawsynth, wobble, basic1, basic2, sine, sineGlide, triangle, square, sawtooth, noise, filteredNoise, and wind.

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

      • getPan

        public Object getPan()
        Returns the Pan or Number or String object of pan, depend on what was set.

        Pan refers to the stereo panning position of the sound. It is defined from -1 (left) to 1 (right).

        By default it is mapped to x, making the sound move from left to right as the chart plays.

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

      • setPan

        public void setPan​(Pan pan)
        Sets the Pan object of pan.

        Pan refers to the stereo panning position of the sound. It is defined from -1 (left) to 1 (right).

        By default it is mapped to x, making the sound move from left to right as the chart plays.

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

      • setPan

        public void setPan​(Number pan)
        Sets the Number object of pan.

        Pan refers to the stereo panning position of the sound. It is defined from -1 (left) to 1 (right).

        By default it is mapped to x, making the sound move from left to right as the chart plays.

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

      • setPan

        public void setPan​(String pan)
        Sets the String object of pan.

        Pan refers to the stereo panning position of the sound. It is defined from -1 (left) to 1 (right).

        By default it is mapped to x, making the sound move from left to right as the chart plays.

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

      • getPitch

        public Object getPitch()
        Returns the Pitch or Number or String object of pitch, depend on what was set.

        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.

      • setPitch

        public void setPitch​(Pitch pitch)
        Sets the Pitch object of pitch.

        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.

      • setPitch

        public void setPitch​(Number pitch)
        Sets the Number object of pitch.

        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.

      • setPitch

        public void setPitch​(String pitch)
        Sets the String object of pitch.

        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.

      • setPitch

        public void setPitch​(org.zkoss.json.JavaScriptValue pitch)
        Sets the JavaScriptValue object of pitch.

        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.

      • getPlayDelay

        public Object getPlayDelay()
        Returns the PlayDelay or Number or String object of play delay, depend on what was set.

        Milliseconds to wait before playing, comes in addition to the time determined by the time mapping.

        Can also be negative to play before the mapped time.

      • setPlayDelay

        public void setPlayDelay​(PlayDelay playDelay)
        Sets the PlayDelay object of play delay.

        Milliseconds to wait before playing, comes in addition to the time determined by the time mapping.

        Can also be negative to play before the mapped time.

      • setPlayDelay

        public void setPlayDelay​(Number playDelay)
        Sets the Number object of play delay.

        Milliseconds to wait before playing, comes in addition to the time determined by the time mapping.

        Can also be negative to play before the mapped time.

      • setPlayDelay

        public void setPlayDelay​(String playDelay)
        Sets the String object of play delay.

        Milliseconds to wait before playing, comes in addition to the time determined by the time mapping.

        Can also be negative to play before the mapped time.

      • getRate

        public Object getRate()
        Returns the Rate or Number or String object of rate, depend on what was set.

        Rate mapping for speech tracks.

      • setRate

        public void setRate​(Rate rate)
        Sets the Rate object of rate.

        Rate mapping for speech tracks.

      • setRate

        public void setRate​(Number rate)
        Sets the Number object of rate.

        Rate mapping for speech tracks.

      • setRate

        public void setRate​(String rate)
        Sets the String object of rate.

        Rate mapping for speech tracks.

      • getText

        public String getText()
        Returns the text mapping for speech tracks.

        Default: null

      • setText

        public void setText​(String text)
        Sets the text mapping for speech tracks.
      • getTime

        public Object getTime()
        Returns the Time or Number or String object of time, depend on what was set.

        Time mapping determines what time each point plays. It is defined as an offset in milliseconds, where 0 means it plays immediately when the chart is sonified.

        By default time is mapped to x, meaning points with the lowest x value plays first, and points with the highest x value plays last.

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

      • setTime

        public void setTime​(Time time)
        Sets the Time object of time.

        Time mapping determines what time each point plays. It is defined as an offset in milliseconds, where 0 means it plays immediately when the chart is sonified.

        By default time is mapped to x, meaning points with the lowest x value plays first, and points with the highest x value plays last.

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

      • setTime

        public void setTime​(Number time)
        Sets the Number object of time.

        Time mapping determines what time each point plays. It is defined as an offset in milliseconds, where 0 means it plays immediately when the chart is sonified.

        By default time is mapped to x, meaning points with the lowest x value plays first, and points with the highest x value plays last.

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

      • setTime

        public void setTime​(String time)
        Sets the String object of time.

        Time mapping determines what time each point plays. It is defined as an offset in milliseconds, where 0 means it plays immediately when the chart is sonified.

        By default time is mapped to x, meaning points with the lowest x value plays first, and points with the highest x value plays last.

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

      • getTremolo

        public Tremolo getTremolo()
        Returns the Tremolo object of tremolo.

        Mapping options for tremolo effects.

        Tremolo is repeated changes of volume over time.

      • setTremolo

        public void setTremolo​(Tremolo tremolo)
        Sets the Tremolo object of tremolo.

        Mapping options for tremolo effects.

        Tremolo is repeated changes of volume over time.

      • getVolume

        public Object getVolume()
        Returns the Volume or Number or String object of volume, depend on what was set.

        The volume of notes, from 0 to 1.

      • setVolume

        public void setVolume​(Volume volume)
        Sets the Volume object of volume.

        The volume of notes, from 0 to 1.

      • setVolume

        public void setVolume​(Number volume)
        Sets the Number object of volume.

        The volume of notes, from 0 to 1.

      • setVolume

        public void setVolume​(String volume)
        Sets the String object of volume.

        The volume of notes, from 0 to 1.