cordova - How to convert base64 wav to base64 mp3 in JavaScript -


i have trouble in app.

i want record sound , store in ios using cordova. have base64/wav file, it's heavy want convert base64/mp3.

which algorithm allows me that?

example:

b64wavtob64mp3("base64/..."); // return mp3 base64 

thanks in advance!

i forgot base64 because looking audio compressed

solved!

i did wav2m4a plugin.

https://github.com/xu-li/phonegap-wav2m4a

but wanted go further modified cdvsound.m @ ios. followed these instructions:

https://gist.github.com/jlsuarezs/d48094d431307a466496

  1. add startrecordingaudio method on cdvsound.m this:

    nsdictionary *recordsettings = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithint: kaudioformatmpeg4aac], avformatidkey, [nsnumber numberwithfloat:16000.0], avsampleratekey, [nsnumber numberwithint: 1], avnumberofchannelskey, nil];

  2. replace:

    audiofile.recorder = [[cdvaudiorecorder alloc] initwithurl:audiofile.resourceurl settings:nil error:&error]; // default pcm recording

    with:

    audiofile.recorder = [[cdvaudiorecorder alloc] initwithurl:audiofile.resourceurl settings:recordsettings error:&error];

    1. changing lines: cdvsound.m checks make sure you're using wav file. changing @ top of file should prevent that.

    define recording_wav @"wav"

i changed to:

#define recording_wav @"m4a" 

or

#define recording_m4a @"m4a"  

and change in file instances contains recording_wav variable.


Comments