Uses 455K of libraries. Click here for Pure Java version (2390L/16K/53K).
1 | !7 |
2 | |
3 | lib 1001094 // JavaLayer 1.0.1 |
4 | lib 1003620 // mp3spi1.9.4.jar |
5 | lib 1003621 // tritonus_share.jar |
6 | |
7 | import javax.sound.sampled.*; |
8 | |
9 | p { |
10 | File file = william_silent("hello"); |
11 | print("MP3 size: " + file.length()); |
12 | fixContextClassLoader(); |
13 | |
14 | AudioInputStream in = AudioSystem.getAudioInputStream(file); |
15 | |
16 | AudioFormat baseFormat = in.getFormat(); |
17 | AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, |
18 | baseFormat.getSampleRate(), |
19 | 16, |
20 | baseFormat.getChannels(), |
21 | baseFormat.getChannels() * 2, |
22 | baseFormat.getSampleRate(), |
23 | false); |
24 | |
25 | AudioInputStream din = AudioSystem.getAudioInputStream(decodedFormat, in); |
26 | int numBytes = din.available(); |
27 | System.out.println("numbytes: "+numBytes); |
28 | byte[] buffer = new byte[numBytes]; |
29 | int count=0, n; |
30 | while ((n = din.read(buffer, count, numBytes-count)) > 0) { |
31 | count += n; |
32 | print("Read " + count + " bytes"); |
33 | } |
34 | } |
Began life as a copy of #1006984
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006989 |
Snippet name: | Test AudioInputStream on speech .mp3 [dev.] |
Eternal ID of this version: | #1006989/7 |
Text MD5: | 6ef54ad141c8bb95837264894a029336 |
Transpilation MD5: | ec1169e7a16b3ee25f334ee7d4efcf8d |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-24 13:51:15 |
Source code size: | 989 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 442 / 524 |
Version history: | 6 change(s) |
Referenced in: | [show references] |