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

svoid test_RenderFrequencySample_SquareWave() {
  var c = complex(0, 1);
  print(angle := c.angle()/twoPi());
  
  var renderer = RenderFrequencySample_SquareWave();

  new L<Double> l;
  for (frac : countIterator(0.0, 1.0, 0.05))
    print(frac + " = " + addAndReturn(l, renderer.get(c, frac)));
  //copyTextToClipboard(new ToJava().get(l));
  
  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),
    l);
    
  new AudioAdder adder;
  renderer.subtractPeriodFrom(adder, doubleRange(0.0, 20.0), c);
  printStruct(adder);
  for i over l:
    assertEqualsVerbose(str(i), -l.get(i), adder.sampleSum(0, i, i+1));
}

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: 213 / 344
Version history: 21 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)