lib 1400149 // java-lame static LS _stickyLibs_javaLame_wavToMP3_mono = ll(#1400149); import net.sourceforge.lame.lowlevel.*; static void javaLame_wavToMP3_mono(File wav, File mp3) ctex { long time = sysNow(); temp WAVDecoder decoder = new(newFileInputStream(wav)); time "Decode WAV" { byte[] pcm = byteArrayFromShorts_littleEndian(decodeWAVToMonoSamples(decoder, wav)); } LameEncoder encoder = new(javaSound_pcmSignedLittleEndianMono(decoder.sampleRate)); temp FileOutputStream out = new(mp3); byte[] buffer = new byte[encoder.getPCMBufferSize()]; int bytesToTransfer = min(l(buffer), l(pcm)), bytesWritten; int currentPcmPosition = 0; while (0 < (bytesWritten = encoder.encodeBuffer(pcm, currentPcmPosition, bytesToTransfer, buffer))) { currentPcmPosition += bytesToTransfer; bytesToTransfer = min(l(buffer), l(pcm) - currentPcmPosition); out.write(buffer, 0, bytesWritten); } encoder.close(); done2_always_timeFirst(time, "Pure-Java-converted " + wav + " to " + mp3); }
download show line numbers debug dex old transpilations
Travelled to 11 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019665 |
Snippet name: | javaLame_wavToMP3_mono - uses some default bit rate |
Eternal ID of this version: | #1019665/7 |
Text MD5: | d598428e6aa3f6c3abe6d1700dbe9d84 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-16 23:36:51 |
Source code size: | 1045 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 289 / 331 |
Version history: | 6 change(s) |
Referenced in: | [show references] |