Registry / ai-ml / julius

julius

JSON →
library0.2.8pypypi✓ verified 24d ago

Julius is a Python library providing fast, differentiable Digital Signal Processing (DSP) algorithms implemented with PyTorch, offering CUDA support. It specializes in functionalities like sinc resampling, FFT-based convolutions, and FIR filter banks for audio and 1D signals. The current version is 0.2.7, with releases addressing compatibility and performance improvements.

pip install julius
INSTALL
IMPORT
SIG · JULIUS
J
julius
ai-mlpythonv0.2.8
Install
65.6s avg
Import
5708ms
Disk
4710MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 76.8s
py 3.11
✕ build_error
✓ 67.4s
py 3.12
✕ build_error
✓ 61.4s
py 3.13
✕ build_error
✓ 56.7s
py 3.9
✕ build_error
✕ timeout
4710MB installed
● package 4710MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

julius
import julius
resample_frac
import julius signal = torch.randn(1000) resampled_signal = julius.resample_frac(signal, old_sr=44100, new_sr=16000)
from julius.resample import resample_frac
While 'resample_frac' exists in 'julius.resample', the top-level 'julius.resample_frac' is the commonly documented and used entry point for the functional API.
ResampleFrac
from julius.resample import ResampleFrac resampler = ResampleFrac(old_sr=44100, new_sr=16000)
Used for class-based resampling, e.g., in torch.nn.Module.
fft_conv1d
import julius x = torch.randn(1, 1, 1024) w = torch.randn(1, 1, 256) y = julius.fftconv.fft_conv1d(x, w)
Functional API for FFT-based 1D convolution.

This quickstart demonstrates the core resampling functionality using `julius.resample_frac` and a basic FFT-based convolution with `julius.fftconv.fft_conv1d`. The resampling function is designed for efficiency when sample rates form a fraction with a small numerator and denominator after GCD reduction.

import julius import torch # Create a dummy audio signal (batch_size, channels, time) signal = torch.randn(2, 1, 44100) # 2 batches, 1 channel, 44100 samples (1 second at 44.1kHz) old_sample_rate = 44100 new_sample_rate = 16000 # Resample the signal resampled_signal = julius.resample_frac(signal, old_sr=old_sample_rate, new_sr=new_sample_rate) print(f"Original signal shape: {signal.shape}") print(f"Resampled signal shape: {resampled_signal.shape}") # For FFT-based convolution: x = torch.randn(1, 1, 2048) # Input (batch, channels, time) w = torch.randn(1, 1, 512) # Kernel (out_channels, in_channels, kernel_size) y = julius.fftconv.fft_conv1d(x, w) print(f"FFT Conv output shape: {y.shape}")
Debug
Known issues
gotchaThe `resample_frac` function is highly optimized for fractional changes in sample rates where the `old_sr` and `new_sr` reduce to a small irreducible fraction (e.g., 2000 to 3000 simplifies to 2:3). Performance can degrade significantly if the sample rates do not simplify to small integers (e.g., 20001 to 30001).
fix
Be mindful of the ratio between `old_sr` and `new_sr`. For arbitrary ratios where performance is critical, consider pre-filtering or alternative resampling methods if `julius` is slow in specific cases.
affects: All versions
gotchaThe `julius.fftconv` modules (e.g., `FFTConv1d`, `fft_conv1d`) are optimized for convolutions with *large kernels* (typically >= 128) and a stride of 1. For smaller kernels or different strides, `torch.nn.Conv1d` might be faster or more memory efficient. Dilation and groups are not supported by `julius.fftconv`.
fix
Benchmark both `julius.fftconv` and `torch.nn.functional.conv1d` for your specific use case to determine the faster option. Avoid `julius.fftconv` if dilation or groups are required.
affects: All versions
deprecatedAs of January 2021, the `julius` implementation of resampling has been officially integrated into `torchaudio`. Users primarily focused on resampling may consider using `torchaudio.functional.resample` for potentially more robust or integrated solutions within the PyTorch ecosystem.
fix
Evaluate `torchaudio.functional.resample` as an alternative to `julius.resample_frac` for new projects or if migrating existing `torchaudio` pipelines.
affects: 0.2.2+
breakingVersion 0.2.2 (released January 2021) introduced changes to filter normalization in `lowpass` and `resample` and switched from zero padding to replicate padding. This could subtly alter output signals, especially at the edges or for very low frequencies, compared to previous versions.
fix
If migrating from versions prior to 0.2.2, re-evaluate output consistency, particularly for edge artifacts or filter characteristics, and adjust parameters like `rolloff` or `zeros` if necessary.
affects: Pre-0.2.2 to 0.2.2+
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'julius'
The 'julius' library is not installed in the Python environment where the code is being run, or the environment is not correctly activated.
fix
Install the library using pip: `pip install julius`
AttributeError: module 'julius' has no attribute 'resample'
The resampling functions like `resample_frac` are located within the `julius.resample` submodule, not directly under the top-level `julius` module.
fix
Import the `resample` submodule explicitly: `from julius import resample` then use `resample.resample_frac(...)` or `import julius.resample as jr` and then use `jr.resample_frac(...)`
RuntimeError: CUDA error: invalid device context
This error typically indicates an issue with the CUDA installation, GPU drivers, or PyTorch's inability to properly initialize or communicate with the GPU.
fix
Verify your CUDA toolkit and GPU driver installations, ensure PyTorch is installed with CUDA support, and check if your GPU is detected and available to PyTorch (e.g., `torch.cuda.is_available()`).
TypeError: resample_frac() missing 1 required positional argument: 'new_sr'
The `resample_frac` function was called without providing all its mandatory arguments, such as the input tensor `x`, the `old_sr` (original sample rate), and the `new_sr` (target sample rate).
fix
Ensure all required arguments are passed to the `resample_frac` function. For example: `julius.resample.resample_frac(x_tensor, old_sample_rate, new_sample_rate)`
Upgrade
Version history
0.2.8latest on PyPI · released Jun 3, 2026
Audit
Dependencies
torchrequiredJulius is built on PyTorch and requires it for all operations.
Agent activity
7 hits · last 30 days
node
6
Resources
julius — pip install julius · libregistry