audioScatter {audiolyzR}R Documentation

Generate an audiolyzed version of a scatterplot

Description

Transaltes a scatterplot into an audio graph where notes and chords correspond to a binned version of the plot.

Usage

audioScatter(x, y = NULL, z = NULL, data, purge.plots = FALSE, show.plots = TRUE,
             bins = 30, aspect = 1, radius = floor(sqrt(bins))-1, 
             key = "C", quality = "Major", tempo = 115,
             directory = file.path (Sys.getenv("R_LIBS_USER"), "audiolyzR"),
             output = file.path (tempdir(), "json_matrix"), write.to.home = NULL, ...)
             
panel.audiolyzR(x, y, ...)

Arguments

x

A formula specifying either 2 or 3 variables from the specified data object. For now, if 3 variables are specified, the 3rd is considered a "conditional" variable and it atop the interaction between the first 2, in the same manner as a call like xyplot (y ~ x + z, data=data, outer=FALSE)
-or-
The x-axis variable name as a text string.

y

Specifies the y-axis variable if formula not used, should also be a text string.

z

An optional "conditional" variable that is plotted atop the interaction between the first 2

data

Required data frame object.

purge.plots

Specifies whether to erase the directory containing the plots that the external audiolyzR synthesizer accesses. Default is FALSE, so plots will pile up unless you change it to TRUE.

show.plots

Specifies whether to print the binned version of the plot in R's grpahics window. Default is set to TRUE.

bins

Optional specification of bins for hex binning step. Default is 30.

aspect

Optional aspect ratio adjustment. Default is 1:1.

radius

Used to obtain the number of nearest neighbors for each bin/point. Default is square root of number of bins.

key

Optional, not yet fully implemented. The desired key for the audio matrix. This can be adjusted manually in the audiolyzR synthesizer (starting note).

quality

Optional. Quality of the specified key. Default is "Major". This is not yet fully implemented, and can be changed manually in the audiolyzR synthesizer.

tempo

Optional. Tempo for chord progressions in the audio plot. Default is 115 bpm, and it can be adjusted once the plot is generated.

directory

The path of the parent directory containing the audiolyzR synthesizer. This defaults to the "audiolyzR" folder in your "R_LIBS_USER" directory.

output

This is simply a temporary directory by default. If you wish to change it, the only sensible option is the HOME directory. Included for transparency.

write.to.home

The standalone synthesizer application will look in your HOME directory for plot files when it opens. R will request permission to write there during the current session. If you refuse, it will still work, but you will need to drag the appropriate folder to the synthesizer (a message will explain how). Adjusting this in the function call will have no effect.

...

Additional arguments to be fed to hexbin() and hexbinplot().

Details

The panel function panel.audiolyzR adds an audio plot component to xyplot(). This functions at a basic level of implementation and only currently supports outer = FALSE plots. Support for more complex lattice graphics will be incorporated into future releases.

Value

Sends a JSON file to The audiolyzR, which is then played. This requires the installation of The audiolyzR. Also plots the resulting hexbin plot(s)

External Application Instructions

The audiolyzR package requires a free standalone synthesizer application. the first time you run an audio*Plot* function, the program will download and install automatically. By default, the app installs into the file.path (Sys.getenv("R_LIBS_USER"), "audiolyzR") directory, which is where the package's functions will look for it. You are free to install it whereever you like, but you must specify its parent directory in your function calls.

If you prefer to install it yourself:

audiolyzR application for Mac:
http://s3.amazonaws.com/audiolyzR/installers/the_audiolyzR_mac_v5.zip

audiolyzR application for Windows:
http://s3.amazonaws.com/audiolyzR/installers/the_audiolyzR_win_v5.zip

Side Effects

Saves a file to the output directory in order to generate audio. Also, a plot will be produced in the graphics window.

Author(s)

Eric Stone, Jesse Garrison

References

audiolyzR: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/UseR-2012/81-Stone.pdf
Max/MSP: http://cycling74.com/whatismax/

See Also

hexbin

Examples

##Basic audioScatter example

## Not run: 
data(NHANES)
audioScatter("Weight","BMI",data=NHANES)
audioScatter(BMI ~ Weight + Transferin,data=NHANES)

## End(Not run)

[Package audiolyzR version 0.4-9 Index]