Skip to content

Feature Request: Expose libsoxr's Variable-Rate Resampling (soxr_set_io_ratio) #33

@vrunk11

Description

@vrunk11

Summary

Request to expose libsoxr's variable-rate resampling functionality through the Python API, specifically the soxr_set_io_ratio() function that allows dynamic rate changes during streaming.

Motivation

Variable-rate resampling is useful for several applications:

  • Time-base correction (TBC) for video processing with wow/flutter correction
  • Real-time audio processing with dynamic pitch/speed changes
  • Audio synchronization where the rate needs to change during playback
  • Digital signal processing applications requiring non-uniform resampling

Current Limitation

The current ResampleStream API only supports fixed-rate resampling. While libsoxr has excellent variable-rate support (see example #5), this functionality isn't exposed in the Python wrapper.

Proposed API

Add support for variable-rate resampling to ResampleStream:

# Enable variable-rate mode
rs = soxr.ResampleStream(44100, 16000, 1, variable_rate=True)

# Process chunks normally
output1 = rs.resample_chunk(chunk1)

# Change the resampling ratio dynamically
rs.set_io_ratio(48000/44100, slew_len=1024)

# Continue processing with new ratio
output2 = rs.resample_chunk(chunk2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions