Fx-Encoder++
Convert audio effects from your music into encoded representations suitable for audio effects processing and analysis tasks.
About Fx-Encoder++
We adopt the codebase of CLAP for this project.
An audio effects representation learning based on SimCLR.
Architecture
Usage
Installation
pip install fxencoder_plusplus
Usage
Notice: The input to Fx-Encoder++ should be stereo
Initialize Models
from fxencoder_plusplus import load_model
# Load default base model (auto-downloads if needed)
DEVICE = 'cuda'
model = load_model(
'default',
device=DEVICE,
)
Extract audio effects representations from mixture tracks or stem tracks, where a single representation encodes the overall audio effects style of the entire input.
import torch
import librosa
audio_path = librosa.example('trumpet')
wav, sr = librosa.load(audio_path, sr=44100, mono=False)
wav = torch.from_numpy(wav).unsqueeze(0).unsqueeze(0).repeat(1, 2, 1).to(DEVICE) # [1, 2, seq_len]
fx_emb = model.get_fx_embedding(wav)
print(fx_emb.shape) # [1, embed_dim], [1, 128]
## if you want to get the embedding before projection, then
fx_emb = model.get_fx_embedding(wav, normalized=False)
print(fx_emb.shape) # [1, embed_dim], [1, 2048]
Extract instrument-specific audio effects representations from mixture tracks. For example, extract the audio effects representation of just the vocals within a full mix.
- Audio Reference:
import torchaudio
import julius
mixture_path = "/path/to/mixture.wav"
mixture, sr = torchaudio.load(mixture_path, num_frames=441000)
mixture = mixture.unsqueeze(0).to(DEVICE) # [1, channel, seq_len]
query_path = "/path/to/inst.wav"
query, sr = torchaudio.load(query_path, frame_offset=441000, num_frames=441000)
query = query.unsqueeze(0).to(DEVICE) # [1, channel, seq_len]
query = julius.resample_frac(query, int(44100), int(48000))
_, fx_emb = model.get_fx_embedding_by_audio_query(mixture, query)
print(fx_emb.shape) # [1, embed_dim], [1, 128]
- Text Reference:
import torchaudio
mixture_path = "/path/to/mixture.wav"
mixture, sr = torchaudio.load(mixture_path, num_frames=441000)
mixture = mixture.unsqueeze(0).to(DEVICE) # [1, channel, seq_len]
query = "the sound of vocals"
_, fx_emb = model.get_fx_embedding_by_text_query(mixture, query)
print(fx_emb.shape) # [1, embed_dim], [1, 128]
Training
Env
- Create environment with conda
conda create --name fxenc python=3.10.14
- Install
pip install -r requirements.txt
Prepare Fx-Normalized Dataset
Because the dataset has copyright restriction, unfortunatly we cannot directly share preprocessed datasets.
- Download MUSDB, MoisesDB
- Please check FxNorm-automix for preparing audio effects normalized dataset
Run
bash scripts/train_proposed.sh
Evaluation
We develop a retrieval-based evaluation pipeline (Using MUSDB dataset as the example)
- Check FxNorm-automix for preparing audio effects normalized dataset
- Synthesize evaluation dataset: check build_musdb.py
- Run retrieval-based evaluation: check eval_retrieval.py
LICENSE
This library is released under the CC BY-NC 4.0 license. Please refer to the LICENSE file for more details.
Metadata
Release files for fxencoder-plusplus 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fxencoder_plusplus-0.1.5.tar.gz | 16.2 kB | Without provenance | Details for fxencoder_plusplus-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fxencoder_plusplus-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for fxencoder_plusplus-0.1.5-py3-none-any.whl |
Total release size: 31.2 kB
Release files / fxencoder_plusplus-0.1.5.tar.gz
| Download URL | fxencoder_plusplus-0.1.5.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bbd6d703e28f17e554f2f5768b732915b941e95813d8896d70324ebce38afc1
|
|
BLAKE2b-256 checksum How to use checksums |
8106d7ab66141e90643bd2f84a0cc6a06b1707a525e1641c38a8d89277963494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Release files / fxencoder_plusplus-0.1.5-py3-none-any.whl
| Download URL | fxencoder_plusplus-0.1.5-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
850bfb05dae7f88e0ac4d649266f5ec748df8fef911c64b3f2584a5784b37187
|
|
BLAKE2b-256 checksum How to use checksums |
3ea51c73a6643eca9dbc54e93e0a26129db876406a44cde5e6599c408bc344b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Security for fxencoder-plusplus 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.