Skip to content

fix(client): pick the channel before resampling stereo files - #4001

Merged
LauraGPT merged 1 commit into
modelscope:mainfrom
imeerkhurram:fix/nano-client-stereo-resample
Dec 1, 2026
Merged

LauraGPT merged 1 commit into
modelscope:mainfrom
imeerkhurram:fix/nano-client-stereo-resample

Conversation

@imeerkhurram

Copy link
Copy Markdown
Contributor

Summary

Port of QwenAudio/Fun-ASR#181, as discussed there. client_python.py and client_test.py of Fun-ASR-Nano resample before they drop to one channel. soundfile.read returns (frames, channels) and librosa.resample works on the last axis, so a stereo file that isn't 16 kHz is resampled across its two channels and sent at its original rate, labelled as 16 kHz. The channel is now picked first. Which channel is sent does not change.

The workflow now installs librosa and also runs when client_python.py changes, and the new test has no skip, so the cases run on 3.10 and 3.12.

Type of change

  • Bug fix
  • Documentation
  • Example or demo
  • Runtime or deployment
  • Benchmark or evaluation
  • Model/training change

Validation

The new test runs both clients against a local websocket server with one second of stereo, 440 Hz on the left and a louder 880 Hz on the right, at 8, 16, 44.1 and 48 kHz. It checks the number of samples, the pitch and the level. Without the client changes 6 of the 8 cases fail:

assert 8000 == 16000
assert 44100 == 16000
assert 48000 == 16000

The pytest command of test-example-collection.yml, on Linux with Python 3.10 and 3.12: 37 passed on both.

  • python -m compileall funasr examples tests
  • Docs or links checked
  • Runtime/deployment command tested

User impact

Anyone who streams a stereo recording that isn't 16 kHz with the file client.

Notes for reviewers

No model or real server was used.

soundfile returns (frames, channels) and librosa resamples the last
axis, so the Fun-ASR-Nano file clients resampled a stereo file that was
not 16 kHz across its two channels and sent it at its original rate.
@LauraGPT
LauraGPT merged commit 4cb697c into modelscope:main Dec 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants