A Velvet-Noise Decorrelator for audio
Project description
VNDecorrelate
A Velvet-Noise Decorrelator for audio.
Decorrelation refers to the process of transforming an audio source signal into multiple output signals with different waveforms from each other, but with the same sound as the source signal [1].
In music production, decorrelation is typically applied to the left and right audio channels, creating the perception of stereo width and space. This, however, may come at the cost of potential coloration or transient smearing artifacts.
Velvet-Noise Decorrelation (VND) attempts to minimize these artifacts as well as computation cost while reducing the correlation of the outputs as much as possible [2].
Velvet Noise
Velvet Noise is a sparse noise sequence generated from randomly time-shifted impulses with a random value of either -1 or 1 [2]:
To reduce transient smearing and frequency coloration you can apply a segmented decay envelope [2]:
As well as logarithmically distributing the impulses towards the start of the sequence [2]:
Quick Start
First install the package into your environment:
pip install vndecorrelate
Then load an audio file.
import scipy.io.wavfile as wavfile
from vndecorrelate.decorrelation import *
fs, input_signal = wavfile.read("audio/viola.wav")
Then you can simply use the VelvetNoise class:
velvet_noise = VelvetNoise(
duration_seconds=0.03,
num_impulses=30,
)
output_signal = velvet_noise.decorrelate(input_signal)
Or:
# manually generate the velvet noise as numpy NDArrays
velvet_noise = generate_velvet_noise(
duration_seconds=0.03,
num_impulses=30,
)
# numerically equivalent to VelvetNoise.convolve
output_signal = convolve_velvet_noise(input_signal, velvet_noise)
Or you can create a chain of signal processors:
chain = (
SignalChain(sample_rate_hz=fs)
.velvet_noise(
duration_seconds=0.03,
num_impulses=30,
log_distribution_strength=1.0,
seed=1,
)
.haas_effect(
delay_time_seconds=0.02,
delayed_channel=1, # Right Channel
mode='LR',
)
)
# SignalChain is lazy, so instatiation of its signal processors happens here
output_signal = chain(input_signal)
To listen back to the processed audio, simply save to a wav file locally.
wavfile.write('audio/viola_out.wav', fs, output_signal)
Optimization
optimization.py contains functions for optimizing VelvetNoise or HaasEffect for maximizing stereo seperation while maintaining polar sample symmetry and mono compatiblilty.
optimize_velvet_noise optimizes the concentration of impulses towards the start of the filter referred to as log_distribution_strength:
optimize_haas_delay optimizes the delay_time_seconds parameter:
symmetry_aware_objective takes the input signal and converts it to polar samples to compute the scalar objective function defined by:
where α is the input scalar to optimize, each
Sample runs of VelvetNoise.decorrelate with unoptimized and optimized filters can be compared by their polar sample plots generated from plot_polar_sample:
Visualization
To provide further visualization of the effects decorrelation plot_correlogram is provided. Short windows of typically ~20ms are taken from two signals to calculate normalized cross-correlation values at various lag distances. sine_sweep can be used to generate a test signal that can be compared before and after applying a velvet noise decorrelation.
We can use the auto correlogram as a baseline:
Plot the cross correlogram after filtering each channel with velvet noise:
And compare to the behavior of filtering with white noise:
References
[1] “What is ‘Decorrelation’? | Sweetwater”. https://www.sweetwater.com/insync/decorrelation/ (accessed Aug. 10, 2020).
[2] “Velvet-Noise Decorrelator”. http://www.dafx17.eca.ed.ac.uk/papers/DAFx17_paper_96.pdf (accessed Aug. 04, 2020).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vndecorrelate-1.0.2.tar.gz.
File metadata
- Download URL: vndecorrelate-1.0.2.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f9fff45b4a615aad10fe8ab9fe62fca964070d212666a9f4f650c7541c9b317
|
|
| MD5 |
a0a67a15249102134fe5390619ba04b7
|
|
| BLAKE2b-256 |
2a18b165aaf6ca50622934670f65a71df53b6424bfea82ceaab7d5882241031f
|
Provenance
The following attestation bundles were made for vndecorrelate-1.0.2.tar.gz:
Publisher:
release.yaml on ckonst/VNDecorrelate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vndecorrelate-1.0.2.tar.gz -
Subject digest:
1f9fff45b4a615aad10fe8ab9fe62fca964070d212666a9f4f650c7541c9b317 - Sigstore transparency entry: 1513886144
- Sigstore integration time:
-
Permalink:
ckonst/VNDecorrelate@791919f85a3911487af82b5575e2cc5bb6f97f34 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/ckonst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@791919f85a3911487af82b5575e2cc5bb6f97f34 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vndecorrelate-1.0.2-py3-none-any.whl.
File metadata
- Download URL: vndecorrelate-1.0.2-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5909f4dd6a768622c6e5db13f722f13c4e5cde5a5da155c8f1b54f73e7b0617
|
|
| MD5 |
fe8cfd1318adc40a74d72b3ad955c067
|
|
| BLAKE2b-256 |
2c3e7d727d3678ab8f6621b8f9241b9574d8bcd8ef4c15057735952bb0670ea4
|
Provenance
The following attestation bundles were made for vndecorrelate-1.0.2-py3-none-any.whl:
Publisher:
release.yaml on ckonst/VNDecorrelate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vndecorrelate-1.0.2-py3-none-any.whl -
Subject digest:
e5909f4dd6a768622c6e5db13f722f13c4e5cde5a5da155c8f1b54f73e7b0617 - Sigstore transparency entry: 1513886225
- Sigstore integration time:
-
Permalink:
ckonst/VNDecorrelate@791919f85a3911487af82b5575e2cc5bb6f97f34 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/ckonst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@791919f85a3911487af82b5575e2cc5bb6f97f34 -
Trigger Event:
workflow_dispatch
-
Statement type: