sonify: Create sonification objects

Description Usage Arguments Value References See Also Examples

Description

Creates a sonify object, which is a list containing the data.frame to be sonified, the mappings of data to sound parameters, the scaling of parameters, and additional options.

Usage

1
2
3
  sonify(data = NULL, mapping = sonaes(), scales =
  sonscaling(), sonlayers = NULL, rendering = "audio",
  render_options = NULL)

Arguments

data

a data.frame with the data to be sonified

mapping

a sonaes object (created by sonaes()) that maps data to sound parameters

scales

a sonifyScale object (created by scaling()) that gives the scaling function and desired parameter range from the data to each sound

sonlayers

A single sonlayer object, or a list of sonlayer objects, that gives each layer to be rendered.

rendering

character string containing the method of rendering. Currently only the default, "audio", is supported.

render_options

A named list of rendering options to pass to the individual rendering type.

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).

References

The syntax of sonify objects is heavily based on that of ggplot objects in the ggplot2 package. See the ggplot2 web site for more information.

See Also

+.sonify for interacting with sonify objects; sonaes for setting the mappings; sonscaling and scaleShortcuts for creating the scalings.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## A bare-bones sonify object, but one that cannot render
x <- sonify()
summary(x)
## Not run: x # Throws an error message

## A more complete specification
## for a sonify object that uses iris
## with Petal.Length mapped onto times
## between 0 and 10 seconds.
## and Petal.Width mapped onto pitches
## between pitch values 6 (110 Hz) and 8 (440 Hz),
x <- sonify(data=iris,
sonaes(time=Petal.Length, pitch=Petal.Width),
sonscaling(pitch=list(6, 8, linear.scale),
time=list(0, 10, linear.scale)),
sonlayers=shape_notes())
summary(x)
## Not run: x # outputs sound

## You can hear there is a cluster of low values at the beginning
## when both Petal.Width and Petal.Length are small, followed
## by a higher cluster.

## The same, created incrementally
## and with the "scale_" convenience functions
x <- sonify(iris)
x <- x + sonaes(time=Petal.Length, pitch=Petal.Width)
x <- x + shape_notes()
x <- x + scale_pitch_linear(6, 8) + scale_time_linear(0, 10)
summary(x)
## Not run: x # outputs sound

playitbyr documentation built on May 2, 2019, 6:08 p.m.

Related to sonify in playitbyr...