music.reverb¶
- music.reverb(duration=1.9, first_phase_duration=0.15, decay=-50, noise_type='brown', sonic_vector=0, sample_rate=44100)[source]¶
Apply an artificial reverberation or return the impulse response.
- Parameters:
- durationscalar
The total duration of the reverberation in seconds.
- first_phase_durationscalar
The duration of the first phase of the reverberation in seconds.
- decayscalar
The total decay of the last incidence in decibels.
- noise_type
stror scalar A string or scalar specifying the noise. Passed to noises(ntype=scalar).
- sonic_vectorarray_like
An optional one dimensional array for the reverberation to be applied.
- sample_ratescalar
The sampling frequency.
- Returns:
- result
numpy.ndarray An array with the impulse response of the reverberation. If sonic_vector is specified, the reverberation applied to sonic_vector.
- result
- Raises:
ValueErrorIf
first_phase_durationis longer thanduration, ordurationis shorter than one sample: the response begins with the direct sound, so it has at least that.
- Parameters:
- Return type:
NDArray[float64]
Notes
This is a simple artificial reverberation with a progressive loudness decay of the reincidences of the sound and with two periods: the first consists of scattered reincidences, the second period reincidences is modeled by a noise.
Comparing with the description in [1], the frequency bands are ignored.
One might want to run this function twice to obtain a stereo reverberation.
Cite the following article whenever you use this function.
References
[1]Fabbri, Renato, et al. “Musical elements in the discrete-time representation of sound.” arXiv preprint arXiv:abs/1412.6853 (2017)
Examples
>>> impulse = reverb(duration=1.9, first_phase_duration=0.15, decay=-50) >>> round(float(impulse[0]), 3) # the direct sound 1.0 >>> wet = reverb(sonic_vector=note(440, 1), duration=0.5) >>> len(wet) > 44100 # longer than the note by its tail True