transplantEnv | R Documentation |

Extracts a smoothed amplitude envelope of the `donor`

sound and applies
it to the `recipient`

sound. Both sounds are provided as numeric
vectors; they can differ in length and sampling rate. Note that the result
depends on the amount of smoothing (controlled by `windowLength`

) and
the chosen method of calculating the envelope. Very similar to
`setenv`

, but with a different smoothing algorithm and
with a choice of several types of envelope: hil, rms, or peak.

transplantEnv( donor, samplingRateD = NULL, recipient, samplingRateR = samplingRateD, windowLength = 50, method = c("hil", "rms", "peak")[3], killDC = FALSE, dynamicRange = 80, plot = FALSE )

`donor` |
the sound that "donates" the amplitude envelope |

`samplingRateD, samplingRateR` |
sampling rate of the donor and recipient, respectively (only needed for vectors, not files) |

`recipient` |
the sound that needs to have its amplitude envelope adjusted |

`windowLength` |
the length of smoothing window, ms |

`method` |
hil = Hilbert envelope, rms = root mean square amplitude, peak = peak amplitude per window |

`killDC` |
if TRUE, dynamically removes DC offset or similar deviations of average waveform from zero (see examples) |

`dynamicRange` |
parts of sound quieter than |

`plot` |
if TRUE, plots the original sound, the smoothed envelope, and the compressed sound |

Returns the recipient sound with the donor's amplitude envelope - a numeric vector with the same sampling rate as the recipient

`flatEnv`

`setenv`

donor = rnorm(500) * seq(1, 0, length.out = 500) recipient = soundgen(sylLen = 600, addSilence = 50) transplantEnv(donor, samplingRateD = 200, recipient, samplingRateR = 16000, windowLength = 50, method = 'hil', plot = TRUE) transplantEnv(donor, samplingRateD = 200, recipient, samplingRateR = 16000, windowLength = 10, method = 'peak', plot = TRUE)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.