Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1013801 // wavToMP3_128k

JavaX fragment (include) [tags: use-pretranspiled]

Uses 11463K of libraries. Click here for Pure Java version (2575L/16K).

!include once #1017982 // JAVE/ffmpeg

svoid wavToMP3_128k(File wav, File mp3) ctex {
  new AudioAttributes audio;
  audio.setCodec("libmp3lame");
  audio.setBitRate(128000);
  audio.setChannels(2);
  audio.setSamplingRate(44100);
  new EncodingAttributes attrs;
  attrs.setFormat("mp3");
  attrs.setAudioAttributes(audio);
  print("Converting " + f2s(wav) + " to " + f2s(mp3));
  new Encoder().encode(wav, mp3, attrs);
  print("  [done]");
}

static File wavToMP3_128k(File wav) {
  File out = replaceExtension(wav, "wav", "mp3");
  wavToMP3_128k(wav, out);
  ret out;
}

Author comment

Began life as a copy of #1013799

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013801
Snippet name: wavToMP3_128k
Eternal ID of this version: #1013801/8
Text MD5: f5b367772732fead685b190070b75a6d
Transpilation MD5: dc27eb6848039adf64d6044e405ae043
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-27 17:31:35
Source code size: 591 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 406 / 503
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017982 - JAVE/ffmpeg [Include]
#1017983 - oggToMP3 using JAVE 2 [OK on Linux 64]
#1018574 - mp3ToWAV_jave (seems to work)