Rogten

download Rogten

of 29

Transcript of Rogten

  • 8/11/2019 Rogten

    1/29

    Package playitbyr

    July 2, 2014

    Type Package

    Title Representing and exploring data through sound

    Version 0.2-1

    Date 2012-05-01

    Author Ethan Brown

    Maintainer Ethan Brown

    Depends R (>= 2.12.0), csound

    Description playitbyr is a flexible toolkit for data sonification,with syntax modeled after the gg-

    plot2 package. The functions

    allow the user to map data onto sonic parameters like pitch,tempo, and rhythm, and out-

    put sound and sound files.

    URL http://playitbyr.org/

    License GPL (>= 2)

    SystemRequirements playitbyr creates sound using the csound package,which re-

    quires the free and open source software synthesizer

    Csound, available at . See

    for more guidance on setting up Csound.

    LazyLoad yes

    Collate 'aaa.R' 'checkSonify.R' 'getShapeDef.R' 'internaldf.R'

    'internalsonify.R' 'linearscale.R' 'octToFreq.R' 'render.R'

    'sonaes.R' 'sonify.R' 'sonlayer.R' 'sonscaling.R' 'getSoundParams.R' 'getDefaultMappings.R'

    'scorePreprocessor.dotplot.R' 'scorePreprocessor.csound.R'

    'render.csound.R' 'sonopts.R' 'expscale.R' 'scorePreprocessor.scatter.R' 'sonsave.R'

    'shape-descriptions.R' 'scale-attkp-continuous.R'

    'scale-decayp-continuous.R' 'scale-dur-continuous.R' 'scale-identity.R' 'scale-indx-continuous.R'

    'scale-mod-continuous.R' 'scale-pan-continuous.R'

    'scale-pitch-continuous.R' 'scale-tempo-continuous.R'

    'scale-time-continuous.R' 'scale-vol-continuous.R'

    1

    http://playitbyr.org/http://playitbyr.org/
  • 8/11/2019 Rogten

    2/29

    2 +.sonify

    'shape-csound.R' 'shape-dotplot.R' 'shape-scatter.R'

    'add-sonify.R' 'print.sonify.R' 'summary.sonify.R' 'sonfacet.R'

    'shape-histogram.R' 'scorePreprocessor.histogram.R'

    'scorePreprocessor.boxplot.R' 'shape-boxplot.R'

    Repository CRAN

    Date/Publication 2012-05-03 12:52:01

    NeedsCompilation no

    R topics documented:

    +.sonify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    print.sonify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    s c a l e _ a t t k p _ c o n t i n u o u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    s c a l e _ d e c a y p _ e x p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    s c a l e _ d u r _ c o n t i n u o u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6scale_indx_continuous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    scale_mod_continuous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    s c a l e _ p a n _ c o n t i n u o u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    s c a l e _ p i t c h _ c o n t i n u o u s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    scale_tempo_exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    scale_time_continuous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    s c a l e _ t i m e _ i d e n t i t y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    s c a l e _ v o l _ e x p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    shape_boxplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    s h a p e _ c s o u n d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    s h a p e _ d o t p l o t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    shape_histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18shape_scatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    sonaes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    sonfacet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    sonify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    sonopts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    sonsave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    summary.sonify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Index 29

    +.sonify Add additional layers or options onto sonify objects

    Description

    sonifyobjects can be incrementally added onto to form a complete sonification, much like ggplot

    objects.

  • 8/11/2019 Rogten

    3/29

    print.sonify 3

    Usage

    ## S3 method for class sonify

    x + y

    Arguments

    x Asonifyobject

    y An object to be added into the sonify object (see Details).

    Details

    Adding mappings, layers, facets, and other parameters onto a sonifyobject is the easiest method

    of creating a sonification. The following kinds of objects can be added:

    sonaes Mappings of data columns to sound parameters

    sonlayer Layers, such as shape_scatter

    sonscaling Scalings, such asscale_time_continuous

    sonfacet Instructions for faceting the sonification

    sonopts Additional options

    Value

    A sonify object with the relevant y value added into the object.

    See Also

    sonifyfor the creation of these objects

    print.sonify Print method forsonifyobjects

    Description

    Printing a sonify object renders it to sound (analogously to how printing ggplot objects renders

    them to screen in theggplot2package).

    Usage

    ## S3 method for class sonify

    print(x, ...)

    http://had.co.nz/ggplot2http://had.co.nz/ggplot2
  • 8/11/2019 Rogten

    4/29

    4 scale_attkp_continuous

    Arguments

    x Asonifyobject

    ... Additional optional arguments:

    render_real_time Render the sonification in real time? IfTRUE, the sonifica-

    tion is rendered in real time (which is faster but may not work as well on

    slower computers); ifFALSEthe sonification is rendered to a file on disk be-

    fore playing. The default behavior is given by the option render_real_time.

    file The file to render to (ifrender_real_time = FALSE). The default is a

    temporary file.

    play If rendering to a file, should the file then be played? Default is TRUE.

    playout If playing from a file, what channel should be used for output? This

    string is passed to the Csound -ooption. Default is"dac", the default audio

    out.

    Details

    In interactive use, you can simply type the name of the sonifyobject to sonify it. In loops, func-

    tions, andsource-ing use, however, you need to explicitly call print by using print(x)to print the

    objectx.

    Value

    print.sonify is called for its side-effect, which is to actually render the object to a sound. It

    invisibly returns the length of the resulting sonification.

    Note

    By default, a rendering is saved to a file and then immediately played for compatibility with slower

    systems. If you have a faster computer and want to play the sonification as you render it, you can

    setoptions("render_real_time" = TRUE). (It is FALSEby default.)

    See Also

    sonifyfor the creation of these objects,sonsavefor a convenience function that saves a sound file,

    sonoptsfor advanced and low-level rendering options

    scale_attkp_continuous

    Continuous scales for note attacks

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here, "attkp", the sharpness of a notes

    initial attack).

  • 8/11/2019 Rogten

    5/29

    scale_decayp_exp 5

    Usage

    scale_attkp_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    scale_attkp_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    Inshape_scatter,there are 3 phases of a note: the attack (the initial fade-in of the note), sustain

    (where the note is held), and the decay (the final fade-out of the note. attkp is the percentage of

    the note devoted to the attack; so a note with attkp = 0.01would have a very quick start of the

    note, whereas a note with attkp = 0.5would gradually fade in.

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

    scale_decayp_exp Continuous note decay scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonify object to specify how [data parameter] from the data

    (a column of the data) is to be mapped to sonic parameters (here, "decayp", the percentage of the

    note devoted to the decay/fade out).

  • 8/11/2019 Rogten

    6/29

    6 scale_dur_continuous

    Usage

    scale_decayp_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    scale_decayp_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    Inshape_scatter,there are 3 phases of a note: the attack (the initial fade-in of the note), sustain

    (where the note is held), and the decay (the final fade-out of the note. decaypis the percentage of

    the note devoted to the decay; so a note with decaypwould have a very abrupt ending, whereas a

    note withdecayp = 0.5would gradually fade out.

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

    scale_dur_continuous Continuous note duration scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here, "dur", the length of the resulting

    note).

    Usage

    scale_dur_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    scale_dur_exp(soundlimits, limits = NULL, by = NULL, ...)

  • 8/11/2019 Rogten

    7/29

    scale_indx_continuous 7

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data valuesoutside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

    scale_indx_continuous Continuous modulation index scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonify object to specify how [data parameter] from the data

    (a column of the data) is to be mapped to sonic parameters (here, "indx", the index of frequencymodulation).

    Usage

    scale_indx_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    scale_indx_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

  • 8/11/2019 Rogten

    8/29

    8 scale_mod_continuous

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

    scale_mod_continuous Continuous modulation multiplier scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here, "mod", the modulation frequency as

    a multiple of the carrier frequency).

    Usage

    scale_mod_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    scale_mod_exp(soundlimits, limits = NULL, by = NULL, ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

  • 8/11/2019 Rogten

    9/29

    scale_pan_continuous 9

    scale_pan_continuous Continuous pan scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here, "pan", the left-right balance of the

    note as a number between 0 and 1).

    Usage

    scale_pan_continuous(soundlimits, limits = NULL,by = NULL, ...)

    scale_pan_exp(soundlimits, limits = NULL, by = NULL, ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

  • 8/11/2019 Rogten

    10/29

    10 scale_pitch_continuous

    scale_pitch_continuous

    Continuous pitch scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonify object to specify how [data parameter] from the data

    (a column of the data) is to be mapped to sonic parameters (here, "pitch", where middle C is

    represented as 8 and each octave as 1).

    Usage

    scale_pitch_continuous(soundlimits, limits = NULL,by = NULL, ...)

    scale_pitch_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takesthe minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

  • 8/11/2019 Rogten

    11/29

    scale_tempo_exp 11

    scale_tempo_exp Continuous tempo scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here, "tempo"in beats per minute).

    Usage

    scale_tempo_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    scale_tempo_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

  • 8/11/2019 Rogten

    12/29

    12 scale_time_continuous

    scale_time_continuous Continuous scales for note starting times

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonifyobject to specify how [data parameter]from the data (a

    column of the data) is to be mapped to sonic parameters (here "time", the starting time of the note

    in seconds).

    Usage

    scale_time_continuous(soundlimits, limits = NULL,

    by = NULL, ...)

    scale_time_exp(soundlimits, limits = NULL, by = NULL,

    ...)

    Arguments

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    soundlimits The limits of the sound parameter.

    by The unit to round the sound parameter to.

    ... Other parameters (currently ignored)

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

  • 8/11/2019 Rogten

    13/29

    scale_time_identity 13

    scale_time_identity Use values without scaling

    Description

    These functions can be added onto a sonifyobject to indicate that a given parameter is not to be

    scaled; the values given in the input data should be take as the given sound values.

    Usage

    scale_time_identity(...)

    scale_pitch_identity(...)

    scale_dur_identity(...)

    scale_vol_identity(...)

    scale_pan_identity(...)

    scale_tempo_identity(...)

    scale_attkp_identity(...)

    scale_decayp_identity(...)

    scale_mod_identity(...)

    scale_indx_identity(...)

    Arguments

    ... Ignored.

    scale_vol_exp Continuous note volume scales

    Description

    These shortcut functions (with the notation scale_[sound parameter]_[scaling function])

    are intended to be added onto a sonify object to specify how [data parameter] from the data

    (a column of the data) is to be mapped to sonic parameters (here, "vol", the proportion of the

    maximum volume of the note, as a number between 0 and 1).

  • 8/11/2019 Rogten

    14/29

    14 shape_boxplot

    Usage

    scale_vol_exp(soundlimits, limits = NULL, by = NULL, ...)

    scale_vol_continuous(soundlimits, limits = NULL,by = NULL, ...)

    Arguments

    ... Other parameters (currently ignored)

    soundlimits The limits of the sound parameter.

    limits The limits of the data to train, a numeric vector of length 2. All data values

    outside these limits are returned as NA. IfNULL, the default, the function takes

    the minimum and maximum of the data

    by The unit to round the sound parameter to.

    Details

    _continuousscales are a linear scaling, whereas_expis an exponential scale.

    Value

    Asonscalingobject, to be used in sonifyor added onto a sonifyobject.

    See Also

    shape_scatter,which has more information about this parameter

    shape_boxplot Create a boxplot layer

    Description

    Gives a sense of the distribution of values by sampling at increasingly narrow percentiles around

    the median.

    Usage

    shape_boxplot(length = 5, tempo = 240, pause = 0.1, ...,

    data = NULL, mapping = NULL)

  • 8/11/2019 Rogten

    15/29

    shape_boxplot 15

    Arguments

    length The overall length, in seconds, of each segment of the boxplot.

    tempo The tempo, in beats per minute; i.e. the rapidity with which to represent values

    from the dataset.pause The pause between each segment of the boxplot, in seconds.

    ... settings to pass tosonlayer(see Details)

    data Thedata.frameto be sonified for this layer. If blank, the data from the parent

    sonifyobject is used.

    mapping Asonaesobject.

    Details

    The audio boxplot is implemented by a simple frequency-modulation synthesis (through csound),

    representing a univariate view of the data by rapidly playing pitches in the 5th to 95th percentile,

    then the interquartile range (25th to 75th), then the median, all sampled from the dataset. (It is

    essentiallyshape_histogramevaluated separately on each of these subsets of the data.)Onlypitchis intended to be used for mapping but the remainder of the same parameters available

    inshape_scatterare available for setting to suit the analysts ear:

    time The starting time of the note (in seconds).

    pitch The pitch of the note, in the Csound oct notationnotation for pitches, where 8 is middle C

    and 1 represents an octave, to the corresponding frequency in Hertz. By default this is scaled

    to the nearest musical (chromatic) pitch. (See scale_pitch_continuous.)

    dur The duration of the note (relative to the total time ifrelative = TRUE, in seconds otherwise).

    amp The volume of the note, as a proportion between 0 and 1, where 1 is the maximum volume.

    Note that a multiple notes that happen at the same time could add up to more than one, causing

    distortion and clipping.

    attkp The proportion of the notes length devoted to the initial (linear) attack.

    decayp The proportion of the notes length devoted to the (linear) decay.

    indx The index of modulation. This affects the distortion of the tone; indx = 0is a sine wave,

    whereas higher indices of modulation give increasingly complex tones.

    mod The modulating frequency, given as a multiple of the primary frequency (i.e. given bypitch).

    Toseta sound parameter to a value, you simply include it as an extra argument in shape_scatter;

    to map a parameter, you set the mapping for the layer or the sonify object using sonaes (see

    examples inshape_scatter).

    Value

    Asonlayerobject that can be added onto a sonifyobject.

    References

    S. Ferguson, W. Martens and D. Cabrera, Statistical Sonification for Exploratory Data Analysis,

    inThe Sonification Handbook, ed. Hermann, Hunt, Neuhoff. Available:http://sonification.

    de/handbook/

    http://%22http//www.csounds.com/manual/html/cpsoct.html%22http://sonification.de/handbook/http://sonification.de/handbook/http://sonification.de/handbook/http://sonification.de/handbook/http://%22http//www.csounds.com/manual/html/cpsoct.html%22
  • 8/11/2019 Rogten

    16/29

    16 shape_csound

    Examples

    x1

  • 8/11/2019 Rogten

    17/29

    shape_dotplot 17

    shape_dotplot Create a dotplot layer

    Description

    Creates a dotplot layer using the sound of a snare drum.

    Usage

    shape_dotplot(jitter = 0, ..., data = NULL,

    mapping = NULL)

    Arguments

    jitter The maximum size, in seconds, of how much to jitter time by when there are

    multiple notes at the same pitch and time (the sonic equivalent of overplotting).

    The default, 0, means no jitter occurs.

    ... data, settings, and mappings to pass tosonlayer(see Details)

    data Thedata.frameto be sonified for this layer. If blank, the data from the parent

    sonifyobject is used.

    mapping Asonaesobject.

    Details

    The audio dotplot creates a sense of how the distribution is spread out in time. Users are only

    expected to really use the timeparameter for mapping, but they may want to fiddle with the other

    aspects of the sound for aesthetic reasons.When more than one value appears at a given time, this shape automatically adds noise to "jitter"

    the values so they can be heard distinctly.

    These parameters are available for setting or mapping:

    time The starting time of the snare sound (in seconds).

    pitch The pitch of the note, in the Csound oct notationnotation for pitches, where 8 is middle C

    and 1 represents an octave, to the corresponding frequency in Hertz. By default this is scaled

    to the nearest musical (chromatic) pitch. (See scale_pitch_continuous.)

    dur The duration of the note (relative to the total time ifrelative = TRUE, in seconds otherwise).

    Toseta sound parameter to a value, you simply include it as an extra argument in shape_scatter;

    to map a parameter, you set the mapping for the layer or the sonify object using sonaes (see

    examples inshape_scatter).

    Value

    Asonlayerobject that can be added onto a sonifyobject.

    http://%22http//www.csounds.com/manual/html/cpsoct.html%22http://%22http//www.csounds.com/manual/html/cpsoct.html%22
  • 8/11/2019 Rogten

    18/29

    18 shape_histogram

    Author(s)

    Originally contributed bySam Ferguson.Csound instrument created byHans Mikelson.

    References

    S. Ferguson, W. Martens and D. Cabrera, Statistical Sonification for Exploratory Data Analysis,

    inThe Sonification Handbook, ed. Hermann, Hunt, Neuhoff. Available:http://sonification.

    de/handbook/

    Examples

    x

  • 8/11/2019 Rogten

    19/29

    shape_histogram 19

    time The starting time of the note (in seconds).

    pitch The pitch of the note, in the Csound oct notationnotation for pitches, where 8 is middle C

    and 1 represents an octave, to the corresponding frequency in Hertz. By default this is scaled

    to the nearest musical (chromatic) pitch. (See scale_pitch_continuous.)

    dur The duration of the note (relative to the total time ifrelative = TRUE, in seconds otherwise).

    amp The volume of the note, as a proportion between 0 and 1, where 1 is the maximum volume.

    Note that a multiple notes that happen at the same time could add up to more than one, causing

    distortion and clipping.

    attkp The proportion of the notes length devoted to the initial (linear) attack.

    decayp The proportion of the notes length devoted to the (linear) decay.

    indx The index of modulation. This affects the distortion of the tone; indx = 0is a sine wave,

    whereas higher indices of modulation give increasingly complex tones.

    mod The modulating frequency, given as a multiple of the primary frequency (i.e. given bypitch).

    Toseta sound parameter to a value, you simply include it as an extra argument in shape_scatter;

    to map a parameter, you set the mapping for the layer or the sonify object using sonaes (see

    examples inshape_scatter).

    Value

    Asonlayerobject that can be added onto a sonifyobject.

    References

    S. Ferguson, W. Martens and D. Cabrera, Statistical Sonification for Exploratory Data Analysis,

    inThe Sonification Handbook, ed. Hermann, Hunt, Neuhoff. Available:http://sonification.

    de/handbook/

    Examples

    x1

  • 8/11/2019 Rogten

    20/29

    20 shape_scatter

    shape_scatter Create a scatterplot layer

    Description

    Creates a scatterplot layer; the audio analogue ofggplot2sgeom_point.

    Usage

    shape_scatter(jitter = 0, relative = TRUE, ...,

    data = NULL, mapping = NULL)

    Arguments

    jitter The maximum size, in seconds, of how much to jitter time by when there are

    multiple notes at the same pitch and time (the sonic equivalent of overplotting).The default, 0, means no jitter occurs.

    relative Make the duration relative to the overall length of the sonification? The default,

    TRUE, means that the sonification will scale durations relative to the length of the

    overall sonification (it estimates how long a beat is and then rescales duration

    in relation to that). Otherwise, durations remain constant even if the sonification

    is much longer or shorter (which may mean that note durations must be fiddled

    with so they dont overlap).

    ... settings to pass tosonlayer(see Details)

    data Thedata.frameto be sonified for this layer. If blank, the data from the parent

    sonifyobject is used.

    mapping Asonaesobject.

    Details

    The audio scatterplot is implemented by a simple frequency-modulation synthesis (through Csound).

    The following parameters are available for setting or mapping:

    time The starting time of the note (in seconds).

    pitch The pitch of the note, in the Csound oct notationnotation for pitches, where 8 is middle C

    and 1 represents an octave, to the corresponding frequency in Hertz. By default this is scaled

    to the nearest musical (chromatic) pitch. (See scale_pitch_continuous.)

    dur The duration of the note (relative to the total time ifrelative = TRUE, in seconds otherwise).

    amp The volume of the note, as a proportion between 0 and 1, where 1 is the maximum volume.

    Note that a multiple notes that happen at the same time could add up to more than one, causingdistortion and clipping.

    attkp The proportion of the notes length devoted to the initial (linear) attack.

    decayp The proportion of the notes length devoted to the (linear) decay.

    indx The index of modulation. This affects the distortion of the tone; indx = 0is a sine wave,

    whereas higher indices of modulation give increasingly complex tones.

    http://%22http//www.csounds.com/manual/html/cpsoct.html%22http://%22http//www.csounds.com/manual/html/cpsoct.html%22
  • 8/11/2019 Rogten

    21/29

    shape_scatter 21

    mod The modulating frequency, given as a multiple of the primary frequency (i.e. given bypitch).

    Toseta sound parameter to a value, you simply include it as an extra argument in shape_scatter;

    to map a parameter, you set the mapping for the layer or the sonify object using sonaes (see

    examples).

    Value

    Asonlayerobject that can be added onto a sonifyobject.

    Examples

    x1

  • 8/11/2019 Rogten

    22/29

    22 sonaes

    sonaes Create mappings and parameters for sonification objects

    Description

    Creates a sonaesobject, which is a list containing the desired mappings of data columns or con-

    stants onto each sound parameter. This is intended be added to a sonifyobject (or included in its

    construction).

    Usage

    sonaes(...)

    Arguments

    ... Sonic parameter mappings, specific to the shape being rendered. All argumentsmust be named, with the argument names sonic parameters and the values ei-

    ther numeric values (to set the sonic parameter to that value as a constant) or a

    column of the data.frame that is to be sonified (with or without quotes).

    Details

    Setting sonic parameters todata.framecolumns is the heart of making the sonification. The sound

    parameters that can be the arguments ofsonaesdepend on the kinds of layers present; seesonify

    for a list of the possible kinds of layers.

    Value

    Asonaesobject, used in or added to a sonifyobject orsonlayer.

    See Also

    sonify.Also, seeaesfrom theggplot2package, which inspired this function.

    Examples

    ## Maps Petal.Width onto tempo,

    ## Sepal.Width onto pitch,

    ## and sets scalings

    ## (not terribly informative, since the order is

    ## arbitrary)

    x

  • 8/11/2019 Rogten

    23/29

    sonfacet 23

    ## Map Petal.Width onto time instead

    y

  • 8/11/2019 Rogten

    24/29

    24 sonify

    sonify Create sonification objects

    Description

    Creates a sonify object, the fundamental workhorse ofplayitbyr; this is a list containing the

    data.frameto be sonified, the mappings of data to sound parameters, the scaling of parameters,

    and additional options.

    Usage

    sonify(data = NULL, mapping = sonaes(),

    scales = sonscaling(), sonlayers = NULL,

    opts = sonopts(), sonfacet = NULL)

    Arguments

    data adata.framewith the data to be sonified

    mapping This specifies the mappings of the data paramters (i.e. columns of data) to

    sound parameters (such as start time, duration, et cetera). Its a sonaesobject,

    best created bysonaes.

    The available sound parameters for mapping depend on what kind of sonifica-

    tion youre doing. This is specified by the shape_ convenience function, and

    the available sound parameters are documented on those help pages (see e.g.

    shape_scatter).

    scales What range of the sound parameter should the data be scaled to, and how should

    the scaling be done? Practically, the best way to deal with tweaking scales is

    to add on the scale_convenience function for whichever sound parameter you

    want to change, likescale_time_continuous.

    If specifying manually (not recommended), this is a sonscalingobject which

    gives the scaling function and desired parameter range from the data to each

    sound.

    sonlayers Layers allow you to specify the type of audio display, and multiple layers allow

    you to display different aspects of the data to play simultaneously. The best way

    ofdoingthis isto add onthe shape_ function that you want. Current possibilities

    are:

    shape_scatter A scatterplot of notes with many aspects of the sound available

    for setting and mapping, generated by FM synthesis

    shape_dotplot Creates a sense of the distribution of a variable, represented by

    start time, using a snare drum sound

    shape_histogram Gives a sense of the distribution of values (represented by

    pitch) by sampling the dataset (this can be used along with faceting to fa-

    cilitate comparisons of groups).

    shape_boxplot Gives a sense of the distribution of values (represented by

    pitch) by sampling the dataset in increasingly narrow percentiles around

    the median

  • 8/11/2019 Rogten

    25/29

    sonify 25

    shape_csound A layer that can use an arbitrary csound file as its orchestra (not

    for beginners!)

    If specifying manually (not recommended), this is a single sonlayerobject, or

    a list ofsonlayerobjects, that gives each layer to be rendered.

    opts Advanced rendering options; this is easiest to use by adding on the function

    sonopts

    sonfacet playitbyrsupports facetingthis splits databy the values in one of its columns

    and creates separate sonifications for each group, played on after another. See

    sonfacetfor more information on how to do this.

    If specifying manually (not recommended), this is asonfacetobject that gives

    what variables to split by.

    Details

    The easiest way of building up a sonification is to create a sonifyobject with this function, specify-

    ing thedata.frameyou want sonified as the dataparameter and possibly the mappings. Then, you

    can add on (with +) additional mappings, layers, scalings and facets later. See Arguments section

    for more explanation of each of these pieces, and the Examples for how you can add the pieces

    together to form a complete sonification.

    Value

    A sonify object, which contains what is needed to render the object. If the object is completely

    specified, it can by rendered simply by calling the print method for the object (i.e. simply typing

    the name of the object at the R prompt).

    Note

    When used in a loop, function, or other non-interactive use, a sonifyobject needs to be printed in

    order to actually be turned into sound. So, assign the output of this function to an object and then

    useprint(foo)to hear the sonification.

    References

    The syntax ofsonifyobjects is heavily based on that ofggplot objects in the ggplot2package.

    See theggplot2 web sitefor more information.

    See Also

    summary.sonify

    Examples

    ## A bare-bones sonify object, but one that cannot render

    x

  • 8/11/2019 Rogten

    26/29

    26 sonopts

    ## and with the "scale_" convenience functions

    x

  • 8/11/2019 Rogten

    27/29

    sonsave 27

    realTime Indicates whether the performance is to be rendered in real time. If you are rendering to

    a file, you probably want this as FALSE, since it can render a whole lot faster than real-time to

    file.

    finishPerformance Should the performance be closed after completing the score? If TRUE, the

    default, cleans up and closes Csound. IfFALSE, returns a pointer to a Csound instance that can

    be used to continue the performance or eventually close it.

    suppressDisplays Csound by default pops up with annoying graphical widgets. This alloys you to

    suppress them (the default).

    moreflags A character vector of extra command-line flags to pass to Csound upon compilation of

    the orchestra. SeeThe Csound Manuals page on the Csound command-line options.

    csInstance An instance of Csound that can be used to continue or close the current performance.

    Note

    By default, a rendering is saved to a file and then immediately played for compatibility with slower

    systems. If you have a faster computer and want to play the sonification as you render it, you cansetoptions("render_real_time" = TRUE). (It is FALSEby default.)

    sonsave Save sonifications to an audio file

    Description

    Convenience function to save a sonifyobject to an audio (.wav) file

    Usage

    sonsave(what, where, play = FALSE, out = "dac", ...)

    Arguments

    what A sonify object

    where The path to the desired.wavoutput.

    play Play the resulting file after saving?

    out If playing, this gives the output channel. Usually users will want to leave this as

    "dac", the default (which plays to the default audio out).

    ... other arguments to be passed onto the rendering.

    Value

    Returns the filename of the saved file.

    http://www.csounds.com/manual/html/CommandFlagsCategory.htmlhttp://www.csounds.com/manual/html/CommandFlagsCategory.htmlhttp://www.csounds.com/manual/html/CommandFlagsCategory.html
  • 8/11/2019 Rogten

    28/29

    28 summary.sonify

    summary.sonify Summary method for sonify objects

    Description

    Summarizes the structure of a sonify object in ways useful for seeing what the output will be.

    Usage

    ## S3 method for class sonify

    summary(object, ...)

    Arguments

    object Asonifyobject

    ... Ignored.

    Value

    summary.sonifyprints a brief summary, including info about the dataset to be sonified, and the

    specified mappings and scalings of sonic values to data parameters.

    Author(s)

    Closely based onsummary.ggplotby Hadley Wickham

    See Also

    sonifyfor the creation of these objects

    Examples

    summary(sonify(iris, sonaes(time = Sepal.Length, pitch = Sepal.Width)) +

    shape_scatter() + shape_dotplot())

  • 8/11/2019 Rogten

    29/29

    Index

    +.sonify,2

    aes,22

    createPerformance,26

    facet_wrap,23

    print.sonify,3

    scale_attkp_continuous,4

    scale_attkp_exp

    (scale_attkp_continuous),4

    scale_attkp_identity

    (scale_time_identity),13

    scale_decayp_continuous

    (scale_decayp_exp),5

    scale_decayp_exp,5

    scale_decayp_identity

    (scale_time_identity),13

    scale_dur_continuous,6

    scale_dur_exp(scale_dur_continuous),6scale_dur_identity

    (scale_time_identity),13

    scale_indx_continuous,7

    scale_indx_exp(scale_indx_continuous),

    7

    scale_indx_identity

    (scale_time_identity),13

    scale_mod_continuous,8

    scale_mod_exp(scale_mod_continuous),8

    scale_mod_identity

    (scale_time_identity),13

    scale_pan_continuous,9

    scale_pan_exp(scale_pan_continuous),9

    scale_pan_identity

    (scale_time_identity),13

    scale_pitch_continuous,10,15,17,19,20

    scale_pitch_exp

    (scale_pitch_continuous),10

    scale_pitch_identity

    (scale_time_identity),13

    scale_tempo_continuous

    (scale_tempo_exp),11

    scale_tempo_exp,11

    scale_tempo_identity

    (scale_time_identity),13

    scale_time_continuous,3,12,24

    scale_time_exp(scale_time_continuous),12

    scale_time_identity,13

    scale_vol_continuous(scale_vol_exp),13

    scale_vol_exp,13

    scale_vol_identity

    (scale_time_identity),13

    scoreMatrices,26

    shape_boxplot,14,24

    shape_csound,16,25

    shape_dotplot,17,24

    shape_histogram,15,18,24

    shape_scatter,3,512,14,15,1719,20,24

    sonaes,3,15,1721,22,24

    sonfacet,3,18,23,25

    sonify,24,1517,19,21,22,24,27,28

    sonlayer,3,15,17,18,20

    sonopts,3,4,16,25,26

    sonsave,4,27

    sonscaling,3,24

    source,4

    summary.sonify,25,28

    29