Nsound  0.9.4
FluteSlide.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: FluteSlide.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4 //
5 // Nsound is a C++ library and Python module for audio synthesis featuring
6 // dynamic digital filters. Nsound lets you easily shape waveforms and write
7 // to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8 // use.
9 //
10 // Copyright (c) 2009-Present Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
14 // Based on physical models written in Csound by Hans Mikelson.
15 //
16 //-----------------------------------------------------------------------------
17 
18 //-----------------------------------------------------------------------------
19 //
20 // This program is free software; you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation; either version 2 of the License, or
23 // (at your option) any later version.
24 //
25 // This program is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 // GNU Library General Public License for more details.
29 //
30 // You should have received a copy of the GNU General Public License
31 // along with this program; if not, write to the Free Software
32 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 //
34 //-----------------------------------------------------------------------------
35 
36 #ifndef _NSOUND_FLUTE_SLIDE_H_
37 #define _NSOUND_FLUTE_SLIDE_H_
38 
39 #include <Nsound/Instrument.h>
40 
41 namespace Nsound
42 {
43 
44 // Forward Declarations
45 class AudioStream;
46 class Buffer;
47 
48 //-----------------------------------------------------------------------------
50 class FluteSlide : public Instrument
51 {
52  public:
53 
55  FluteSlide(const float64 & sample_rate);
56 
58  ~FluteSlide();
59 
61  AudioStream play();
62 
64  AudioStream play(const float64 & duration, const float64 & frequency);
65 
68  const float64 & duration,
69  const float64 & frequency,
70  const float64 & presure,
71  const float64 & breath);
72 
74  std::string getInfo()
75  {
76  return
77  "Nsound::FluteSlide by Nick Hilton\n\n"
78 
79  "Based on physical models written in Csound by Hans Mikelson.\n"
80  "Originally based on Perry Cook's physical model.\n\n"
81 
82  ";PERRY COOK'S SLIDE FLUTE\n"
83  "\n"
84  " instr 3\n"
85  "\n"
86  "aflute1 init 0\n"
87  "ifqc = cpspch(p5)\n"
88  "ipress = p6\n"
89  "ibreath = p7\n"
90  "\n"
91  "; FLOW SETUP\n"
92  "kenv1 linseg 0, .1, ipress, p3-.2, ipress, .1, 0\n"
93  "kenv2 linseg 0, .01, 1, p3-.02, 1, .01, 0\n"
94  "\n"
95  "; THE VALUES MUST BE AROUND -1 AND 1 OR THE CUBIC WILL BLOW UP.\n"
96  "aflow1 rand 1\n"
97  "aflow1 = aflow1 * kenv1\n"
98  "\n"
99  "; .0356 CAN BE USED TO ADJUST THE BREATH LEVEL.\n"
100  "asum1 = ibreath*aflow1 + kenv1\n"
101  "asum2 = asum1 + aflute1*.4\n"
102  "\n"
103  "; EMBOUCHURE DELAY SHOULD BE 1/2 THE BORE DELAY\n"
104  "\n"
105  "ax delay asum2, 1/ifqc/2 - 15/sr\n"
106  "\n"
107  "apoly = ax - ax*ax*ax\n"
108  "asum3 = apoly + aflute1*.4\n"
109  "\n"
110  "avalue tone asum3, 2000\n"
111  "\n"
112  "; BORE THE BORE LENGTH DETERMINES PITCH. SHORTER IS HIGHER.\n"
113  "aflute1 delay avalue, 1/ifqc - 15/sr\n"
114  "\n"
115  " out avalue*p4*kenv2\n"
116  "\n"
117  " endin;\n";
118  };
119 
120 };
121 
122 };
123 
124 // :mode=c++: jEdit modeline
125 #endif
~FluteSlide()
Destructor.
Definition: FluteSlide.cc:48
std::string getInfo()
Nsound::FluteSlide information.
Definition: FluteSlide.h:74
double float64
Definition: Nsound.h:146
The Nsound Instrument baseclass. All Nsound instruments extend this class.
Definition: Instrument.h:50
Class Drum.
Definition: FluteSlide.h:50
AudioStream play()
Plays a demo for this instrument.
Definition: FluteSlide.cc:54
FluteSlide(const float64 &sample_rate)
Creates a Bass Kick Drum.
Definition: FluteSlide.cc:40