/usr/include/csound/Lindenmayer.hpp is in libcsoundac-dev 1:6.10.0~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /*
* C S O U N D
*
* L I C E N S E
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LINDENMAYER_TO_SOUND_H
#define LINDENMAYER_TO_SOUND_H
#include "Platform.hpp"
#ifdef SWIG
%module CsoundAC
%include "std_string.i"
%include "std_vector.i"
%{
#include "Silence.hpp"
#include <stack>
#include <string>
#include <map>
#include <vector>
#include <eigen3/Eigen/Dense>
%}
#else
#include "Silence.hpp"
#include <stack>
#include <string>
#include <map>
#include <vector>
#include <eigen3/Eigen/Dense>
#endif
namespace csound
{
/**
* This class implements a Lindenmayer system in music space
* for a turtle that writes either notes into a score, or Jones-Parks grains into a memory soundfile.
* The Z dimension of note space is used for chirp rate.
* The actions of the turtle are rescaled to fit the specified bounding hypercube.
* The turtle commands are represented by letters (all n default to 1):
* <ul>
* <li>G = Write the current state of the turtle into the soundfile as a grain.</li>
* <li>Mn = Translate the turtle by adding to its state its step times its orientation times n.</li>
* <li>Rabn = Rotate the turtle from dimension a to dimension b by angle 2 pi / (angleCount * n)</li>
* <li>Uan = Vary the turtle state on dimension a by a normalized (-1 through +1) uniformly distributed random variable times n.</li>
* <li>Gan = Vary the turtle state on dimension a by a normalized (-1 through +1) Gaussian random variable times n.</li>
* <li>T=an = Assign to dimension a of the turtle state the value n.</li>
* <li>T*an = Multiply dimension a of the turtle state by n.</li>
* <li>T/an = Divide dimension a of the turtle state by n.</li>
* <li>T+an = Add to dimension a of the turtle state the value n.</li>
* <li>T-an = Subtract from dimension a of the turtle state the value n.</li>
* <li>S=an = Assign to dimension a of the turtle step the value n.</li>
* <li>S*an = Multiply dimension a of the turtle step by n.</li>
* <li>S/an = Divide dimension a of the turtle step by n.</li>
* <li>S+an = Add to dimension a of the turtle step the value n.</li>
* <li>S-an = Subtract from dimension a of the turtle step the value n.</li>
* <li>[ = Push the current state of the turtle state onto a stack.</li>
* <li>] = Pop the current state of the turtle from the stack.</li>
* </ul>
* The abbreviations for the dimensions are:
* <ol>
* <li>i = instrument</li>
* <li>t = time</li>
* <li>d = duration</li>
* <li>k = MIDI key number</li>
* <li>v = MIDI velocity number</li>
* <li>p = phase</li>
* <li>x = pan</li>
* <li>y = height</li>
* <li>z = depth</li>
* <li>s = pitch-class set as Mason number</li>
* </ol>
*/
class SILENCE_PUBLIC Lindenmayer :
public ScoreNode
{
protected:
int iterationCount;
double angle;
std::string axiom;
Event turtle;
Event turtleStep;
Event turtleOrientation;
std::map<std::string, std::string> rules;
std::stack<Event> turtleStack;
std::stack<Event> turtleStepStack;
std::stack<Event> turtleOrientationStack;
clock_t beganAt;
clock_t endedAt;
clock_t elapsed;
virtual void interpret(std::string command, bool render);
virtual int getDimension (char dimension) const;
virtual void rewrite();
virtual Eigen::MatrixXd createRotation (int dimension1, int dimension2, double angle) const;
virtual void updateActual(Event &event);
virtual void initialize();
public:
Lindenmayer();
virtual ~Lindenmayer();
virtual int getIterationCount() const;
virtual void setIterationCount(int count);
virtual double getAngle() const;
virtual void setAngle(double angle);
virtual std::string getAxiom() const;
virtual void setAxiom(std::string axiom);
virtual void addRule(std::string command, std::string replacement);
virtual std::string getReplacement(std::string command);
virtual void generate();
virtual void clear();
};
}
#endif
|