quiet-js icon indicating copy to clipboard operation
quiet-js copied to clipboard

Saving the generated audio for WAV or MP3

Open carlosguedes opened this issue 6 years ago • 5 comments

Dear Brian, it's me again, needing your assistance. I would like to generate the sound and be able to export it to wav or any other format with the JS version.

Can you give me directions on how to do it?

Thank you very much as always!

carlosguedes avatar May 07 '18 14:05 carlosguedes

Hi @carlosguedes,

The JS lib doesn't have that functionality. I didn't think it'd be particularly useful.

You could fork it to get the raw samples relatively easily, but then you would still need to put them in the WAV container. The C library uses libsndfile to do that, which won't be present here.

If you want to try, the first step would be to add a new function that wrap quiet_encoder_emit. It's already called by the webaudio callbacks in JS, so you could just find those and copy/paste into a new function that returns the samples. You'd also have to add some way to disable the webaudio bits so that you could invoke consume directly.

Let me know if you have more questions.

brian-armstrong avatar May 07 '18 17:05 brian-armstrong

Dear Brain, first of all thanks for great api. can you please share the code for generating audio ?

trghauri avatar May 17 '19 04:05 trghauri

Hi @brian-armstrong,

I'm trying to get raw samples, could you please tell me if this function returns them?

var written = Module.ccall('quiet_encoder_emit', 'number', ['pointer', 'pointer', 'number'], [encoder, samples, sampleBufferSize]);

yaroslav-perec avatar Mar 05 '21 14:03 yaroslav-perec

Hi @carlosguedes,

Have you managed to set it up somehow?

yaroslav-perec avatar Mar 05 '21 15:03 yaroslav-perec

@brian-armstrong, may I ask your attention here, I've created a PR for this issue that allows downloading transmissions in ".wav" format: https://github.com/quiet/quiet-js/pull/41

@carlosguedes, @trghauri, @yaroslav-perec FYI.

otanim avatar Jul 01 '21 18:07 otanim