Skip to content
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

Decoding example #2

Open
maxgronlund opened this issue Jul 23, 2016 · 2 comments
Open

Decoding example #2

maxgronlund opened this issue Jul 23, 2016 · 2 comments

Comments

@maxgronlund
Copy link

maxgronlund commented Jul 23, 2016

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

@Rillke
Copy link
Owner

Rillke commented Jul 24, 2016

Decoding: On https://blog.rillke.com/flac.js/ type -d into the console and click the first example file. If you need the example file for offline-testing, here it is: Christoph_Nolte_-_Follow_me_up_to_Carlow.flac

It's worth to switch to the gh-pages branch to see the sample.js file. The following is sent to the worker when trying the sample on the project page:

worker.postMessage( {
    command: 'encode',
    args: ["-d", "Christoph_Nolte_-_Follow_me_up_to_Carlow.flac"],
    outData: {"Christoph_Nolte_-_Follow_me_up_to_Carlow.wav":{"MIME":"audio/wav"}},
    fileData: { Christoph_Nolte_-_Follow_me_up_to_Carlow.flac: <Uint8Array> }
} );

In L.542 of sample.js I extract the file from the worker results.

@Rillke
Copy link
Owner

Rillke commented Jul 24, 2016

Use the encode command for actual en/de-coding. (Decoding with "-d" unshifted to args)

prefetch will only fetch flac's program code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants