This function represents an object as class "wave". Under the hood, "wave" objects are numeric vectors describing displacement as a function of time. The sample rate can be accessed using the sample_rate accessor.

wave(x, ...)

# S3 method for default
wave(
  x,
  length_sec = 1,
  sample_rate = 44100,
  rise_length = 0,
  fade_length = 0,
  ...
)

# S3 method for sparse_fr_spectrum
wave(
  x,
  length_sec = 1,
  sample_rate = 44100,
  rise_length = 0,
  fade_length = 0,
  phase = 0,
  ...
)

Arguments

x

Input object.

...

Arguments passed on to expand_harmonics

num_harmonics

(Integerish scalar) Number of harmonics (including the fundamental) to which each tone should be expanded.

roll_off

(Numeric scalar) Parametrises the amount of amplitude roll-off in the harmonics, with greater values corresponding to higher roll-off.

digits

Number of digits to which each partial's MIDI pitch should be rounded.

label_harmonics

If TRUE, then the harmonics in the resulting spectrum are labelled with their harmonic numbers.

coherent

Whether the amplitudes from different spectral components should be combined assuming coherent summation, where the amplitudes simply add together (default is FALSE). Otherwise incoherent summation is used, where the amplitudes are squared, added, then square rooted.

length_sec

(Numeric scalar) Length of the output wave, in seconds.

sample_rate

(Integerish scalar) The desired sample rate.

rise_length

(Numeric scalar) Chord fade-in time (seconds).

fade_length

(Numeric scalar) Chord fade-out time (seconds).

phase

(Numeric scalar) Single number specifying the phase of the underlying sine waves to be used.