save_wav_sox: Save wav file (sox)

View source: R/save-wav-sox.R

save_wav_soxR Documentation

Save wav file (sox)

Description

Saves object to a wav file using sox (http://sox.sourceforge.net/).

Usage

save_wav_sox(x, file, ...)

## S3 method for class 'coded_vec'
save_wav_sox(x, file, ...)

## S3 method for class 'pi_chord'
save_wav_sox(x, file, ...)

## S3 method for class 'sparse_pi_spectrum'
save_wav_sox(x, file, ...)

## S3 method for class 'fr_chord'
save_wav_sox(x, file, timbre = "pluck", ...)

## S3 method for class 'vec'
save_wav_sox(x, file, reverb = 20, ...)

## S3 method for class 'sparse_fr_spectrum'
save_wav_sox(
  x,
  file,
  chord_length = 1,
  rise_length = 0.01,
  fade_length = 0.01,
  timbre = "sine",
  spectrum_gain = "auto",
  volume = 0.1,
  ...
)

Arguments

x

Object to save; methods exist for individual chords and for vectors of chords (see vec). Chords are coerced to a pi_chord representation.

file

(Character scalar) Output file.

...

Parameters passed to methods.

timbre

(Character scalar) Timbre to use for synthesizing tones. Only applies to representations that have not already undergone harmonic expansion. This parameter is passed to the type argument of the sox synth command. Valid values include sine, square, triangle, sawtooth, trapezium, exp, noise, tpdfnoise, pinknoise, brownnoise, pluck.

reverb

(Numeric scalar) Reverberance parameter for sox reverb, expressed as a percentage.

chord_length

(Numeric scalar) Chord length (seconds).

rise_length

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

fade_length

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

spectrum_gain

(Coerced to character scalar) If "auto", then the chord's audio output is peak-normalised to a fixed value (using "–norm=-3" in sox). Other values will be passed directly to the "gain" parameter in sox.

volume

(Numeric scalar) Amplitude multipler (higher values make the sound louder). Only relevant when spectrum_gain is not auto.

Details

This method is generally slower than save_wav but it provides more features.

Note

The command-line sound-processing program sox (http://sox.sourceforge.net/) must be installed and available on the command line under the command sox.

See Also

save_wav


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