rillke / flac.js Goto Github PK
View Code? Open in Web Editor NEWJavaScript FLAC encoder, decoder
Home Page: https://blog.rillke.com/flac.js/
License: Other
JavaScript FLAC encoder, decoder
Home Page: https://blog.rillke.com/flac.js/
License: Other
I'm building from source and it seems to build okay, but whenever I run the resulting JS files to encode a .wav file, I get this error:
abort("bad ioctl syscall 21523") at Error
at jsStackTrace (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:1:18185)
at stackTrace (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:1:18368)
at abort (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:15:10936)
at ___syscall54 (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:1:103969)
at Rj (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:5:146550)
at fh (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:5:9403)
at th (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:5:29987)
at Array.sh (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:5:29642)
at Array.uf (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:6:66997)
at lf (eval at global.callEval (http://localhost:3000/flac/FlacEncoder.js:414:10), <anonymous>:6:52858)
flac.js outputs integer overflow exception for specific type of data. Here is the wav file and the code to reproduce the error.
var file = document.getElementById('file').files[0];
var reader = new FileReader();
reader.onload = function (e) {
worker = new Worker('../assets/worker/EmsWorkerProxy.js');
worker.onmessage = onWorkerMessage;
worker.onerror = onWorkerError;
var encodedName = file.name.replace(/\.[^\.]+$/, '.flac');
console.log('encoding ' + file.name + ' to ' + encodedName);
var args = [
file.name
];
var inData = {};
inData[file.name] = new Uint8Array(reader.result);
console.log(inData[file.name]);
var outData = {};
outData[encodedName] = {
// Its MIME type
'MIME': 'audio/flac'
};
worker.postMessage({
command: 'encode',
args: args,
outData: outData,
fileData: inData
});
}
reader.readAsArrayBuffer(file);
Probably the same thing happens in the sample site. In my code it gets broken when the progress is 71% complete, can't see the sample site's logs but the progress bar is stucked around 70%.
Flac CLI works perfectly fine. Tested on version 1.3.2 win64.
Hi,
first things first cool thing, thanks
I have implemented it in a Chrome Extension with some other Projects to convert Soundfiles
While i implementing i have get some problems with the files under wasm but the files under asm run nicely
For another Project i have started to work on Webassembly first time and so it would help me, if someone explains the difference and how they get created
Thanks
I'm having a hard time figuring how to decode flac files in to an array
I'm modifying the demo project
and call the worker with
worker.postMessage({
command: 'prefetch',
args: args,
outData: outData,
fileData: inData
});
Stepping through the code takes med to FlacEncoder.js#onDownloadComplete looks like a dead end
Hello,
Getting an error while trying to encode *.wav data to flac.
I try convert it with your demo. https://rawgit.com/Rillke/flac.js/master/iframe.html
Can you help me resolve it?
convert_files.zip
I tried running a large wav file (almost 600M) through flac.js, but it keeps crashing w/ the Chrome "Aw Snap" error message around 49%. Is there another solution for working with large files?
chrome debug log:
<--- Last few GCs --->
75225 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.1 / 0.0 ms (+ 0.6 ms in 32 steps since last GC) [allocation failure].
75864 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.1 / 0.0 ms (+ 0.5 ms in 31 steps since last GC) [allocation failure].
76512 ms: Scavenge 1339.1 (1349.4) -> 1337.1 (1349.4) MB, 0.2 / 0.1 ms (+ 0.5 ms in 32 steps since last GC) [allocation failure].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2b82e2d48f9 <a DedicatedWorkerGlobalScope with map 0x34aea4d0ca79>
2: expandFileStorage [0x2b82e204311 <undefined>:~1] [pc=0x389c1778f1c2](this=0x55512f7af41 <an Object with map 0x34aea4d145e1>,node=0x16792c4b5041 <JS Object>,newCapacity=104644370)
3: write [0x2b82e204311 <undefined>:~1] [pc=0x389c1778caac](this=0x55512f8d391 <an Object with map 0x1642061bfe9>,stream=0x16792c4b51a9 <JS Object>,buffer=0x55512f7b...
[email protected]$ flac "--endian=\"little\"" "--channels=\"1\"" "--bps=\"16\"" "--sample-rate=\"16000\"" "--sign=\"signed\"" "tmp.raw"
loading web worker scripts (0.7 + 2.8 MiB) ...
Worker downloaded successfully.
Loading run dependencies. Outstanding: 1
Loading run dependencies. Outstanding: 0
ERROR: argument to --endian must be "big" or "little"
ERROR: argument to --sign must be "signed" or "unsigned"`
Hello,
First I want to thank you for the wonderful work you did with this project, it works perfectly for me when I try to encode wav files.
Then my problem: when I use it to encode amr file into flac, it doesn't work. I know you don't say in the README.md that amr is a supported format. So I wonder: is there a simple way to modify the encoder so that it can support amr input files?
It seems to work nicely in the demo, but since it's been inactive for a long time and doesn't appear to have any users, I'd just like to confirm this is considered sufficient for a professional website. It's the only JS library I could find that can both encode and decode FLAC.
Thanks.
Hello,
Getting an error while trying to encode raw data which I decoded by using Web Audio Api's decodeAudioData method.
var fileName = "pcmData";
var encodedName = "encoded.flac";
var args = [
"--sample-rate=16",
"--sign=signed",
"--channels=1",
"--bps=16",
"--endian=big",
fileName
];
var inData = {};
inData[fileName] = buffer;
var outData = {};
outData[encodedName] = {
// Its MIME type
'MIME': 'audio/flac'
};
worker.postMessage({
command: 'encode',
args: args,
outData: outData,
fileData: inData
});
Worker message gives me,
e.data.reply= err
e.data.values[0]= No such file or directory
I'm looking for a way to encode buffers of WAV data to a compressed lossless format on the fly (doesn't have to be FLAC but it seems like a good option). Is it theoretically possibly to edit this library to do that? I know a good bit about WAV format but not much at all about FLAC.
In other words, the source buffer would be a single sample of WAV encoded data, and I'd want to encode that single buffer to FLAC data.
Thanks for this great tool
https://github.com/maxgronlund/flac.js
I'm trying to figure how to create a decoder example
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.