/////////////////////////////////////////////////////////////////////////////// // // $Id: test_granulator.cc 101 2007-07-19 15:37:58Z weegreenblobbie $ // // Copyright (c) 2002-2007 Nick Hilton // // weegreenblobbie_yahoo_com (replace '_' with '@' and '.') // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // 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 Library 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. // /////////////////////////////////////////////////////////////////////////////// // C headers #include // C++ headers #include // Nsound headers #include #include #include #include #include #include // Nsound using namespace Nsound; // std using std::cerr; using std::cout; using std::endl; using std::flush; int main(int argc, char ** argv) { Sine sin(44100); Granulator gran(44100, Granulator::GAUSSIAN_90); AudioStream as1(1,44100); Buffer grain_freqs; grain_freqs << 220; Buffer waves_per_grain; waves_per_grain << 4.0; Buffer grains_per_second = sin.drawLine(2.0, 200, 20); //grains_per_second.plot("gps"); Tic(); cout << "gran.generate() ... " << flush; as1 << 0.6 * gran.generate(2, grain_freqs, waves_per_grain, grains_per_second); cout << Toc() << " seconds" << endl << flush; Wavefile::write("grans.wav", as1, 16); return 0; }