Skip to content

fix: treat wave-resampler as pure cjs module #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/av-cliper/src/av-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 能同时在 worker 和主线程中运行的工具函数

import { workerTimer } from '@webav/internal-utils';
import { resample } from 'wave-resampler';
import * as waveResampler from 'wave-resampler';

/**
* 合并(串联)多个 Float32Array,通常用于合并 PCM 数据
Expand Down Expand Up @@ -252,7 +252,10 @@ export async function audioResample(
return pcmData.map(
(p) =>
new Float32Array(
resample(p, curRate, target.rate, { method: 'sinc', LPF: false }),
waveResampler.resample(p, curRate, target.rate, {
method: 'sinc',
LPF: false,
}),
),
);
}
Expand Down
Loading