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).

!7

lib 1400132 // spectro edit compiled for Java 8

import net.bluecow.spectro.Clip;

p-exp {
  File mp3 = william_silent("hello");
  File wav = programFile("hello.wav");
  if (!wav.exists())
    mp3ToWAV_jave(mp3, wav);
    
  Clip clip = Clip.newInstance(wav);
  
  int w = clip.getFrameCount(), h = clip.getFrameFreqSamples();
  int h2 = min(h, 250);
  BWImage img = new(w, h2);
  
  Rectangle region = new(0, 0, w, h);
  toClipCoords(region, clip);
        
  int endCol = region.x + region.width;
  int endRow = min(region.y + region.height, h2);
  
  print("y=" + region.y + " to " + endRow);
        
  for (int col = region.x; col < endCol; col++) {
    net.bluecow.spectro.Frame f = clip.getFrame(col);
    for (int row = region.y; row < endRow; row++)
      img.setPixel(col, h2-1-row, (float) f.getReal(row));
  }
  
  showBWImage(img);
}

svoid toClipCoords(Rectangle r, Clip clip) {
  r.y = clip.getFrameFreqSamples() - (r.y + r.height);
}

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: 440 / 1088
Version history: 14 change(s)
Referenced in: [show references]