Git Product home page Git Product logo

wave-resampler's People

Contributors

rochars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

wave-resampler's Issues

Sample code for Node (import might be wrong)

import { resampler } from 'wave-resampler';
let newSamples = resample(samples, 48000, 44100);

This is how it works for me:

import resampler from 'wave-resampler';
let newSamples = resampler.resample(samples, 48000, 44100);

Thanks!

Number of Channels

Hello and thanks for making this available and free to use!

Am I correct to assume that different channels should be processed using resample(...) independently, rather than resampling chunks of interleaved stereo audio? If so, it may be helpful to include specifying the correct format of input in the docs. ๐Ÿ˜„

Thanks again!

LPF destroys data on the source buffer

I have a Buffer with 48kHz audio as PCM signed 16-bit little-endian (FFmpeg format s16le). Then I'm doing this simple test to find out that the resample function is affecting the source data:

while (...) {
  const audioBuffer = Buffer.from(...);
  const resampled = WaveResampler.resample(audioBuffer, 48000, 16000, {
    LPF: true,
  });
  // `resampled` is not used. `audioBuffer` has been modified but it shouldn't.
  fs.appendFileSync("/tmp/test.raw", audioBuffer);
}

Now playing this audio with FFmpeg, the audio contents have been destroyed and everything is just noise, except that the original audio can be kind of noticed very subtle in the background:

ffplay -f s16le -ar 48k -ac 1 /tmp/test.raw

Setting LPF: false avoids the issue. The mistake seems to be in the downsample_() function, which saves data directly into the source buffer, when I believe it shouldn't:

samples[i]  = filter.filter(samples[i]);

As it is, no LPF downsampling can be done with this library with default settings, because the resulting audio is garbled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.