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

23
LINES

< > BotCompany Repo | #1018698 // SineSoundSource

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

Transpiled version (71L) is out of date.

1  
sclass SineSoundSource extends VF1<double[]> {
2  
  double freq;
3  
  double sampleRate = 44100;
4  
  double step;
5  
  double phase;
6  
  
7  
  *(double *freq, double *sampleRate) {
8  
    calcStep();
9  
  }
10  
  
11  
  *(double *freq) {
12  
    calcStep();
13  
  }
14  
  
15  
  void calcStep {
16  
    step = pi()*2*freq/sampleRate;
17  
  }
18  
  
19  
  public void get(double[] lr) {
20  
    fillDoubleArray(lr, Math.sin(phase)*32767);
21  
    phase += step;
22  
  }
23  
}

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: #1018698
Snippet name: SineSoundSource
Eternal ID of this version: #1018698/9
Text MD5: 71ed2f620c2543c6708dcdc96359f2b9
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-17 21:31:53
Source code size: 418 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 300 / 892
Version history: 8 change(s)
Referenced in: [show references]