infinity / kali Goto Github PK
View Code? Open in Web Editor NEWTime stretching and pitch shifting in Javascript
Time stretching and pitch shifting in Javascript
Currently, you can only set tempo during setup
. Ideally, you could change the tempo as you feed in more data and Kali would stretch as appropriate
To verify these artefacts you can simply replace var output = doStretch(inputData, START_RATE);
with var output = doStretch(inputData, START_RATE, 2);
in your test.js file. The effect sounds like regular clicking artefacts (more or less apparent depending on the type of audio).
My workaround was to declare a single channel of data (although I guess the algorithm will result misconfigured in this case, even if the audio quality is still good). I can provide a complete example if you need to reproduce the issue.
Thanks.
The ability to simply drop an MP3 on the demo page seems to be broken. At least, in Firefox and Chrome it simply replaced the demo with the MP3 I was trying to upload.
Hi !
I am currently trying to use your project in a realtime project. Audio should be processed and pushed to speakers without the latency of processing the whole track.
I am using the scriptPrecessorNode witch is feeding the Kali instance with the buffer given by the scriptProcessor.
Actualy it is working but the sound is very bad. You can listen the audio sample to understand a bit more what it sound like.
Here the code I use :
this.kali = new Kali(2);
this.setup(audioContext.sampleRate, 0.5);
input = audioContext.createScriptProcessor(4096, 1, 1);
that = this;
input.onaudioprocess = function (audioProcessingEvent) {
var inputBuffer = audioProcessingEvent.inputBuffer;
var outputBuffer = audioProcessingEvent.outputBuffer;
var inputData = inputBuffer.getChannelData(0);
var numInputFrames = inputData.length;
var numChannels = 1;
var stretchFactor = 1;
var completed = new Float32Array(numInputFrames * numChannels + 1);
that.kali.input(dataToInput);
that.kali.process();
that.kali.output(complete)
that.kali.flush();
outputBuffer.copyToChannel(completed, 0, 0);
};
Any ideas of what I am doing wrong ?
Pitch shifting is implemented by resampling the audio and then doing time stretching
Hi there. I've been trying to use your library from NPM by adding the following line into my package.json's 'dependencies':
"kali": "https://github.com/Infinity/Kali/archive/0.0.1.tar.gz",
However I'm having trouble importing it. I think the reason is that Kali's package.json is missing the 'main' parameter (https://docs.npmjs.com/files/package.json#main).
Should I fork the project and add it myself, or do you plan on adding Kali to the NPM registry soon?
Lastly, great library, thanks!
[edit] I got it working by using LucasThompson@b8c0f3f (thank you too, @LucasThompson)
Hi, one great feature I would love to have is to change time-stretching on the fly, without affecting the pitch. So you can speed up or slow down a song with a simple slider on a web page. Do you think it's feasable ?
There are currently issues with transforming multichannel audio
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.