1 | import javax.sound.sampled.AudioFileFormat; |
2 | import javax.sound.sampled.AudioFormat; |
3 | import javax.sound.sampled.AudioInputStream; |
4 | import javax.sound.sampled.AudioSystem; |
5 | import javax.sound.sampled.UnsupportedAudioFileException; |
6 | |
7 | // format is for both the PCM and the output file |
8 | static void pcmToWAVE(byte[] pcm, AudioFormat format, File outputFile) ctex { |
9 | AudioInputStream sourceStream = new AudioInputStream(new ByteArrayInputStream(pcm), format, l(pcm)); // TODO: last parameter should be length in frames? |
10 | AudioInputStream stream = AudioSystem.getAudioInputStream(format, sourceStream); |
11 | AudioSystem.write(stream, AudioFileFormat.Type.WAVE, outputFile); |
12 | sourceStream.close(); |
13 | stream.close(); |
14 | } |
Began life as a copy of #1004799
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: | #1007036 |
Snippet name: | pcmToWAVE |
Eternal ID of this version: | #1007036/3 |
Text MD5: | 3929a8d73b1db2933a8cd04bd2c49935 |
Author: | stefan |
Category: | javax / speech |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-07 16:19:22 |
Source code size: | 720 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 583 / 600 |
Version history: | 2 change(s) |
Referenced in: | [show references] |