Learn R Programming

soundgen (version 1.0.0)

getIntegerRandomWalk: Discrete random walk

Description

Internal soundgen function.

Usage

getIntegerRandomWalk(rw, nonlinBalance = 50, minLength = 50, plot = FALSE)

Arguments

rw

a random walk generated by getRandomWalk (expected range 0 to 100)

nonlinBalance

a number between 0 to 100: 0 = returns all zeros; 100 = returns all twos

minLength

the mimimum length of each epoch

plot

if TRUE, plots the random walk underlying nonlinear regimes

Value

Returns a vector of integers (0/1/2) of the same length as rw.

Details

Takes a continuous random walk and converts it to continuous epochs of repeated values 0/1/2, each at least minLength points long. 0/1/2 correspond to different noise regimes: 0 = no noise, 1 = subharmonics, 2 = subharmonics and jitter/shimmer.

Examples

Run this code
# NOT RUN {
rw = soundgen:::getRandomWalk(len = 100, rw_range = 100, rw_smoothing = .2)
r = soundgen:::getIntegerRandomWalk(rw, nonlinBalance = 75,
                                     minLength = 10, plot = TRUE)
r = soundgen:::getIntegerRandomWalk(rw, nonlinBalance = 15,
                                     minLength = 10, plot = TRUE)
# }

Run the code above in your browser using DataLab