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

38
LINES

< > BotCompany Repo | #1018575 // FFT on audio Spike (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 12012K of libraries. Click here for Pure Java version (10673L/79K).

1  
!7
2  
3  
lib 1400132 // spectro edit compiled for Java 8
4  
5  
import net.bluecow.spectro.Clip;
6  
7  
p-exp {
8  
  File mp3 = william_silent("hello");
9  
  File wav = programFile("hello.wav");
10  
  if (!wav.exists())
11  
    mp3ToWAV_jave(mp3, wav);
12  
    
13  
  Clip clip = Clip.newInstance(wav);
14  
  
15  
  int w = clip.getFrameCount(), h = clip.getFrameFreqSamples();
16  
  int h2 = min(h, 250);
17  
  BWImage img = new(w, h2);
18  
  
19  
  Rectangle region = new(0, 0, w, h);
20  
  toClipCoords(region, clip);
21  
        
22  
  int endCol = region.x + region.width;
23  
  int endRow = min(region.y + region.height, h2);
24  
  
25  
  print("y=" + region.y + " to " + endRow);
26  
        
27  
  for (int col = region.x; col < endCol; col++) {
28  
    net.bluecow.spectro.Frame f = clip.getFrame(col);
29  
    for (int row = region.y; row < endRow; row++)
30  
      img.setPixel(col, h2-1-row, (float) f.getReal(row));
31  
  }
32  
  
33  
  showBWImage(img);
34  
}
35  
36  
svoid toClipCoords(Rectangle r, Clip clip) {
37  
  r.y = clip.getFrameFreqSamples() - (r.y + r.height);
38  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018575
Snippet name: FFT on audio Spike (OK)
Eternal ID of this version: #1018575/15
Text MD5: 14af9ed50cbcfa5a435354019144d677
Transpilation MD5: 64b501b8ed8ac7de51cef4c023641963
Author: stefan
Category: javax / audio analysis
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-06 19:23:19
Source code size: 992 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 441 / 1091
Version history: 14 change(s)
Referenced in: [show references]