;; followtest.sal -- investigate environment problem in FOLLOW
;;
;; RBD, Jan 2022

;; WARNING: test with audacity's follow implementation:
load "audacityfollow.lsp"


;; make some input for follow
;;
function input()
  return seq(s-rest(2), seqrep(i, 5, set-logical-stop(pluck(c5, 0.2), 1))) @ 20



function test1() 
  exec s-plot(follow(input(), 0.01, 0.2, 0.2, 0.25), 8)

function test2() 
  exec s-plot(audfollow(input(), 0.01, 0.2, 0.2, 0.25), 8)

function F2()
  begin
    exec s-plot(input(), 8)
    print "************** INPUT ******************"
  end

function F3()
  begin
    exec test1() ;; perfect peaks at 2, 3, 4, 5, 6
    print "************** OUTPUT ******************"
  end

function F4()
  begin
    exec test2() ;; perfect peaks at 2, 3, 4, 5, 6
    print "************** OUTPUT AUDACITY ******************"
  end

function F5()
  begin
    exec test1() ~ 2 ;; test under stretched environment
    print "************** STRETCH TEST ******************"
  end

function F6()
  begin
    exec test2() ~ 2 ;; test under stretched environment
    print "************** STRETCH TEST AUDACITY ******************"
  end

function F7()
  begin
    exec test1() @ 2 ;; test under shifted environment
    print "************** SHIFT TEST ******************"
  end

function F8()
  begin
    exec test2() @ 2 ;; test under shifted environment
    print "************** SHIFT TEST AUDACITY ******************"
  end

function F9()
  begin
    exec test1() ~ 2 @ 2 ;; test under shifted and stretched environment
    print "************** STRETCH AND SHIFT TEST ******************"
  end

function F10()
  begin
    exec test2() ~ 2 @ 2 ;; test under shifted and stretched environment
    print "************** STRETCH AND SHIFT TEST AUDACITY ******************"
  end

