

//
//    Sfront example: how to use input_bus and the sample wavetable generator
//    Copyright (C) 2000 Regents of the University of California
//
//    The audio files are voice recordings of Linus Torvalds found on
//    Eric Raymond's Linus Torvalds FAQ -- assumed to be public domain.
//    
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License (Version 2) as
//    published by the Free Software Foundation.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//    Maintainer: John Lazzaro, lazzaro@cs.berkeley.edu
//

//
// English Linus comes in through the input_bus
// Swedish Linus is read into a table using sample wavetable generator

global {
  krate 1000;
  outchannels 2;
  send (mixer; ; input_bus);
  table swedish(sample, -1, "swedish.wav");
}

///
// simple signal processing to eliminate bad recording quality. Feel
// free to write something more sophisticated and contribute it.
//

instr mixer () {
  
  imports table swedish;
  asig l, r, orig;
  
  orig = doscil(swedish);

  // massively filter to capture fundamental while losing clicks

  l = lopass(lopass(lopass(orig, 700), 700), 700);
  r = lopass(lopass(lopass(input[0], 700), 700), 700);
	     
  // add back a little of original to keep some high frequencies.
  // different languages on the two channels.

  output(l + 0.2*orig, r + 0.2*input[0]);

}
