save_wav: Save wav file

View source: R/wave.R

save_wavR Documentation

Save wav file

Description

Saves object to a wav file by converting to the wave representation and then writing to a wav file.

Usage

save_wav(
  x,
  file,
  amplitude = 0.1,
  bit_depth = 16L,
  length_sec = 1,
  fade_length = 0.1,
  rise_length = 0.1,
  end_pad = 0.05,
  ...
)

Arguments

x

Object to save; currently only individual chords are supported. Chords are coerced to a wave representation.

file

(Character scalar) Output file.

amplitude

(Numeric scalar) The wave is multiplied by this number before exporting. The resulting wave should fall completely within the range [-1, 1].

bit_depth

(Integer scalar) The bit depth of the exported audio.

length_sec

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

fade_length

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

rise_length

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

end_pad

(Numeric scalar) Duration of silence (seconds) appended to the end of the audio file, used to avoid clicks and other artifacts.

...

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.

See Also

save_wav_sox


pmcharrison/hrep documentation built on Feb. 18, 2024, 2:33 a.m.