s = soundgen(noise = list(time = c(-100, 400), value = -20),
formantsNoise = list(f1 = list(freq = 3000, width = 25)),
addSilence = 50, temperature = .001, plot = TRUE)
# Option 1: use part of the recording as noise profile
s1 = noiseRemoval(s, samplingRate = 16000, noise = c(0.05, 0.15),
dB = 40, plot = TRUE)
# Option 2: use a separate recording as noise profile
noise = soundgen(pitch = NA, noise = 0,
formantsNoise = list(f1 = list(freq = 3000, width = 25)))
spectrogram(noise, 16000)
s2 = noiseRemoval(s, samplingRate = 16000, noise = noise,
dB = 40, plot = TRUE)
# Option 3: provide noise spectrum as a matrix
spec_noise = spectrogram(
noise, samplingRate = 16000,
output = 'original', plot = FALSE)
s3 = noiseRemoval(s, samplingRate = 16000, noise = spec_noise,
dB = 40, plot = TRUE)
if (FALSE) {
# play with gain and sensitivity
noiseRemoval(s, samplingRate = 16000, noise = c(0.05, 0.15),
dB = 60, specificity = 2, plot = TRUE)
# remove noise only from a section of the audio
noiseRemoval(s, samplingRate = 16000, from = .3, to = .4,
noise = c(0.05, 0.15), dB = 60, plot = TRUE, play = TRUE)
}
Run the code above in your browser using DataLab