Code Monkey home page Code Monkey logo

flac.js's People

Contributors

legoktm avatar mertakdut avatar rillke 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

flac.js's Issues

bad ioctl syscall when building

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)

Integer Overflow

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.

Can someone explain the difference between asm and wasm files

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

Decoding example

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

Crashing on large file size

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...

Demo: dash dash args illegal

[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"`

flac js-arg-error

Encoding .amr files

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?

Is this library production-ready?

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.

Encoding Raw Data to Flac

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

question: is it possible to stream encode/decode?

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

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.