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

20
LINES

< > BotCompany Repo | #1033266 // test_RenderFrequencySample_SquareWave

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

Libraryless. Click here for Pure Java version (8611L/51K).

1  
svoid test_RenderFrequencySample_SquareWave() {
2  
  var c = complex(0, 1);
3  
  print(angle := c.angle()/twoPi());
4  
  
5  
  var renderer = RenderFrequencySample_SquareWave();
6  
7  
  new L<Double> l;
8  
  for (frac : countIterator(0.0, 1.0, 0.05))
9  
    print(frac + " = " + addAndReturn(l, renderer.get(c, frac)));
10  
  //copyTextToClipboard(new ToJava().get(l));
11  
  
12  
  assertEqualsVerbose(ll(1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0),
13  
    l);
14  
    
15  
  new AudioAdder adder;
16  
  renderer.subtractPeriodFrom(adder, doubleRange(0.0, 20.0), c);
17  
  printStruct(adder);
18  
  for i over l:
19  
    assertEqualsVerbose(str(i), -l.get(i), adder.sampleSum(0, i, i+1));
20  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033266
Snippet name: test_RenderFrequencySample_SquareWave
Eternal ID of this version: #1033266/22
Text MD5: a090240d002d6f4bbe144b92042cff05
Transpilation MD5: 0a050f8954b0a65ad8a7009c34153bb4
Author: stefan
Category: javax / audio analysis
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-18 07:30:12
Source code size: 714 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 214 / 346
Version history: 21 change(s)
Referenced in: [show references]