mode(-1); // suppress printing

getf('demo_functions.sci');
getf('stretched_scale_demo.sci');

hs_stretch = 2^(1/12);

demo_list = [
  'Harmonic partials on a tempered freq scale' ...
    'stretch_demo(0,9,1.,1.,0,""No stretching, freq scale"");' ; ...
  'Harmonic partials on a tempered pitch scale' ...
    'stretch_demo(0,9,1.,1.,1,""No stretching, pitch scale"");' ; ...
  'Stretched partials on a tempered freq scale' ...
    'stretch_demo(0,9,1.,1.05,0,""Stretched partials, freq scale"");' ; ...
  'Stretched partials on a tempered pitch scale' ...
    'stretch_demo(0,9,1.,1.05,1,""Stretched partials, pitch scale"");' ; ...
  'Harmonic vs. stretched partials on a tempered freq scale' ...
    'stretch_2_demo(9,1.,1.05,0, ...
      ""Stretched vs. harmonic partials, freq scale"");' ; ...
  'Harmonic vs. stretched partials on a tempered pitch scale' ...
    'stretch_2_demo(9,1.,1.05,1, ...
      ""Stretched vs. harmonic partials, pitch scale"");' ; ...
  'Harmonic vs. hs stretched partials on a tempered freq scale' ...
    'stretch_2_demo(9,1.,hs_stretch,0, ...
      ""Hs stretched vs. harmonic partials, freq scale"");' ; ...
  'Harmonic vs. hs stretched partials on a tempered pitch scale' ...
    'stretch_2_demo(9,1.,hs_stretch,1, ...
      ""Hs stretched vs. harmonic partials, pitch scale"");' ; ...
  'Harmonic partials, 5th, on a tempered freq scale' ...
    'stretch_demo(7,9,1.,1.,0,""No stretching, freq scale"");' ; ...
  'Harmonic partials, 5th, on a tempered pitch scale' ...
    'stretch_demo(7,9,1.,1.,1,""No stretching, pitch scale"");' ; ...
  'Stretched partials, 5th, on a stretched freq scale' ...
    'stretch_demo(7,9,1.05,1.05,0, ...
      ""Melodic and harmonic stretching, freq scale"");' ; ...
  'Stretched partials, 5th, on a stretched pitch scale' ...
    'stretch_demo(7,9,1.05,1.05,1, ...
      ""Melodic and harmonic stretching, pitch scale"");' ; ...
  'Harmonic partials, 5th, on a stretched freq scale' ...
    'stretch_demo(7,9,1.05,1.,0, ...
      ""Melodic stretching, freq scale"");' ; ...
  'Harmonic partials, 5th, on a stretched pitch scale' ...
    'stretch_demo(7,9,1.05,1.,1, ...
      ""Melodic stretching, pitch scale"");' ; ...
  'Stretched partials, 5th, on a tempered freq scale' ...
    'stretch_demo(7,9,1.,1.05,0, ...
      ""Harmonic stretching, freq scale"");' ; ...
  'Stretched partials, 5th, on a tempered pitch scale' ...
    'stretch_demo(7,9,1.,1.05,1, ...
      ""Harmonic stretching, pitch scale"");'
];

while %T do

  demo_number = x_choose(demo_list(:,1), ...
      ['Demos for Digital Sound Modeling' ; ...
       'Chapter II: Perception' ; ...
       'Stretched scales and partials' ; ...
       'Demo 31 on Auditory Demonstrations CD' ; ...
       'choose a demo with left mouse button']);

  if demo_number == 0 then 
     return
  else
//     execstr(demo_list(demo_number,2));
     run_demo(demo_list, demo_number);
  end //if

end //while %T
