renardo 0.9.4.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.1
2
+ Name: renardo
3
+ Version: 0.9.4.dev0
4
+ Summary: Launcher/config editor for Renardo livecoding environment
5
+ Home-page: http://renardo.org/
6
+ Author: Elie Gavoty
7
+ Author-email: eliegavoty@free.fr
8
+ License: cc-by-sa-4.0
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: renardo-lib>=0.9.4.dev0
11
+ Requires-Dist: FoxDotEditor>=0.9.4.dev0
12
+ Requires-Dist: renardo_gatherer>=0.1.3.dev0
13
+ Requires-Dist: psutil
14
+ Requires-Dist: textual
15
+
16
+ Renardo v0.9 - FoxDot fork
17
+ ===========================
18
+
19
+ FoxDot is a Python programming environment that provides a fast and user-friendly abstraction to SuperCollider. It also comes with its own IDE, which means it can be used straight out of the box; all you need is Python and SuperCollider and you're ready to go!
20
+
21
+ ## Important
22
+
23
+ If you are having trouble installing using `pip install FoxDot`, try updating Python's `setuptools` and `wheel` libraries using the following code and trying again.
24
+
25
+ ```
26
+ pip install -U setuptools
27
+ pip install -U wheel
28
+ ```
29
+
30
+ ### v0.8 Updates
31
+
32
+ - Added `stretch` synth for timestretching samples, similar to `loop` but better and only plays the whole file. Stretches the audio's duration to the `sus` attribute without affecting pitch and does not require the tempo to be known.
33
+
34
+ ```python
35
+ # Stretches the audio to 4 beats without affecting pitch
36
+ p1 >> stretch("Basic_Rock_135", dur=4)
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Installation and startup
42
+
43
+ #### Prerequisites
44
+ - [Python 2 or 3](https://www.python.org/) - add Python to your path and install "pip" when prompted during the install.
45
+ - [SuperCollider 3.8 and above](http://supercollider.github.io/download)
46
+ - [Tkinter](https://tkdocs.com/tutorial/install.html) - Usually packaged with Python but Linux and MacOS users may need to install using:
47
+ ```bash
48
+ $ sudo apt-get install python3-tk (Linux)
49
+ $ sudo port install py-tkinter (MacOS)
50
+ ```
51
+ #### Recommended
52
+ - [sc3 plugins](http://sc3-plugins.sourceforge.net/)
53
+
54
+ #### Installing FoxDot
55
+
56
+ - Open up a command prompt and type `pip install --user FoxDot`. This will download and install the latest stable version of FoxDot from the Python Package Index if you have properly configured Python.
57
+ - You can update FoxDot to the latest version if it's already installed by adding `-U` or `--upgrade` flag to this command.
58
+ - Alternatively, you can build from source from directly from this repository:
59
+ ``` bash
60
+ $ git clone https://github.com/Qirky/FoxDot.git
61
+ $ cd FoxDot
62
+ $ python setup.py install
63
+ ```
64
+ - Open SuperCollder and install the FoxDot Quark and its dependencies (this allows FoxDot to communicate with SuperCollider) by entering the following and pressing `Ctrl+Return` (Note: this requires [Git to be installed](http://git-scm.com/) on your machine if it is not already):
65
+ ```supercollider
66
+ Quarks.install("FoxDot")
67
+ ```
68
+ - Recompile the SuperCollider class library by going to `Language -> Recompile Class Library` or pressing `Ctrl+Shift+L`
69
+
70
+ #### Startup
71
+
72
+ 1. Open SuperCollider and type in `FoxDot.start` and evaluate this line. SuperCollider is now listening for messages from FoxDot.
73
+ 2. Start FoxDot by entering `FoxDot` at the command line. If that doesn't work, try `python -m FoxDot`.
74
+ 3. If you have installed the SC3 Plugins, use the "Code" drop-down menu to select "Use SC3 Plugins". Restart FoxDot and you'll have access to classes found in the SC3 Plugins.
75
+ 4. Keep up to date with the latest verion of FoxDot by running `pip install FoxDot --upgrade` every few weeks.
76
+ 5. Check out the [YouTube tutorials](https://www.youtube.com/channel/UCRyrNX07lFcfRSymZEWwl6w) for some in-depth tutorial videos on getting to grips with FoxDot
77
+
78
+ #### Installing with SuperCollider 3.7 or earlier
79
+
80
+ If you are having trouble installing the FoxDot Quark in SuperCollider, it is usually because the version of SuperCollider you are installing doesn’t have the functionality for installing Quarks or it doesn’t work properly. If this is the case, you can download the contents of the following SuperCollider script: [foxdot.scd](http://foxdot.org/wp-content/uploads/foxdot.scd). Once downloaded, open the file in SuperCollider and press Ctrl+Return to run it. This will make SuperCollider start listening for messages from FoxDot.
81
+
82
+ #### Frequently Asked Questions
83
+
84
+ You can find answers to many frequently asked questions on the [FAQ post on the FoxDot discussion forum](http://foxdot.org/forum/?view=thread&id=1).
85
+
86
+ ## Basics
87
+
88
+ ### Executing Code
89
+
90
+ A 'block' of code in FoxDot is made up of consecutive lines of code with no empty lines. Pressing `Ctrl+Return` (or `Cmd+Return` on a Mac) will execute the block of code that the cursor is currently in. Try `print(1 + 1)` to see what happens!
91
+
92
+ ### Player Objects
93
+
94
+ Python supports many different programming paradigms, including procedural and functional, but FoxDot implements a traditional object orientated approach with a little bit of cheating to make it easier to live code. A player object is what FoxDot uses to make music by assigning it a synth (the 'instrument' it will play) and some instructions, such as note pitches. All one and two character variable names are reserved for player objects at startup so, by default, the variables `a`, `bd`, and `p1` are 'empty' player objects. If you use one of these variables to store something else but want to use it as a player object again, or you want to use a variable with more than two characters, you just have to reserve it by creating a `Player` and assigning it like so:
95
+
96
+ ``` python
97
+ p1 = Player("p1") # The string name is optional
98
+ ```
99
+
100
+ To stop a Player, use the `stop` method e.g. `p1.stop()`. If you want to stop all players, you can use the command `Clock.clear()` or the keyboard short-cut `Ctrl+.`, which executes this command.
101
+
102
+ Assigning synths and instructions to a player object is done using the double-arrow operator `>>`. So if you wanted to assign a synth to `p1` called 'pads' (execute `print(SynthDefs)` to see all available synths) you would use the following code:
103
+
104
+ ``` python
105
+ p1 >> pads([0,1,2,3])
106
+ ```
107
+
108
+ The empty player object, `p1` is now assigned a the 'pads' synth and some playback instructions. `p1` will play the first four notes of the default scale using a SuperCollider `SynthDef` with the name `\pads`. By default, each note lasts for 1 beat at 120 bpm. These defaults can be changed by specifying keyword arguments:
109
+
110
+ ```python
111
+ p1 >> pads([0,1,2,3], dur=[1/4,3/4], sus=1, vib=4, scale=Scale.minor)
112
+ ```
113
+
114
+ The keyword arguments `dur`, `oct`, and `scale` apply to all player objects - any others, such as `vib` in the above example, refer to keyword arguments in the corresponding `SynthDef`. The first argument, `degree`, does not have to be stated explicitly. Notes can be grouped together so that they are played simultaneously using round brackets, `()`. The sequence `[(0,2,4),1,2,3]` will play the the the first harmonic triad of the default scale followed by the next three notes.
115
+
116
+ ### 'Sample Player' Objects
117
+
118
+ In FoxDot, sound files can be played through using a specific SynthDef called `play`. A player object that uses this SynthDef is referred to as a Sample Player object. Instead of specifying a list of numbers to generate notes, the Sample Player takes a string of characters (known as a "PlayString") as its first argument. To see a list of what samples are associated to what characters, use `print(Samples)`. To create a basic drum beat, you can execute the following line of code:
119
+
120
+ ``` python
121
+ d1 >> play("x-o-")
122
+ ```
123
+
124
+ To have samples play simultaneously, you can create a new 'Sample Player' object for some more complex patterns.
125
+
126
+ ``` python
127
+ bd >> play("x( x) ")
128
+ hh >> play("---[--]")
129
+ sn >> play(" o ")
130
+ ```
131
+
132
+ Alternatively, you can do this in one line using `<>` arrows to separate patterns you want to play together like so:
133
+
134
+ ```python
135
+ d1 >> play("<x( x) ><---[--]>< o >")
136
+ ```
137
+
138
+ Or you can use `PZip`, the `zip` method, or the `&` sign to create one pattern that does this. This can be useful if you want to perform some function on individual layers later on:
139
+
140
+ ``` python
141
+ d1 >> play(P["x( x) "].palindrome().zip("---[--]").zip(P[" o "].amen()))
142
+
143
+ # The first item must be a P[] pattern, not a string.
144
+
145
+ d1 >> play(P["x( x) "].palindrome() & "---[--]" & P[" o "].amen())
146
+ ```
147
+
148
+ Grouping characters in round brackets laces the pattern so that on each play through of the sequence of samples, the next character in the group's sample is played. The sequence `(xo)---` would be played back as if it were entered `x---o---`. Using square brackets will force the enclosed samples to played in the same time span as a single character e.g. `--[--]` will play two hi-hat hits at a half beat then two at a quarter beat. You can play a random sample from a selection by using curly braces in your Play String like so:
149
+
150
+ ``` python
151
+ d1 >> play("x-o{-[--]o[-o]}")
152
+ ```
153
+
154
+ There is now the functionality to specify the sample number for an individual sample when using the `play` SynthDef. This can be done from the play string itself by using the bar character in the form `|<char><sample>|`. These can also be patterns created using brackets:
155
+
156
+ ```python
157
+ # Plays the kick drum with sample 2 but the rest with sample 0
158
+ p1 >> play("|x2|-o-")
159
+
160
+ # You can use square brackets to play multiple samples
161
+ p1 >> play("|x[12]| o ")
162
+
163
+ # Round brackets alternate which sample is used on each loop through the sequence
164
+ p1 >> play("|x(12)| o ")
165
+
166
+ # Curly braces will pick a sample at random
167
+ p1 >> play("|x{0123}| o ")
168
+ ```
169
+
170
+ ## Scheduling Player methods
171
+
172
+ You can perform actions like shuffle, mirror, and rotate on Player Objects just by calling the appropriate method.
173
+
174
+ ```python
175
+ bd >> play("x o xo ")
176
+
177
+ # Shuffle the contents of bd
178
+ bd.shuffle()
179
+ ```
180
+
181
+ You can schedule these methods by calling the `every` method, which takes a list of durations (in beats), the name of the method as a string, and any other arguments. The following syntax mirrors the string of sample characters after 6 beats, then again 2 beats later and also shuffles it every 8 beats.
182
+
183
+ ```python
184
+ bd >> play("x-o-[xx]-o(-[oo])").every([6,2], 'mirror').every(8, 'shuffle')
185
+ ```
186
+
187
+ ## Documentation
188
+
189
+ [Link to documentation website](https://foxdot.org/docs/) (still in progress)
190
+
191
+ ## Using alternative editors
192
+
193
+ FoxDot comes pre-packaged with its own basic editor so that you don't have to tinker with config files or download any other tools but if you want to use an existing editor you can. [Koltes](https://github.com/KoltesDigital) has written a plugin for the popular Atom editor. You can install it by going to Settings -> Install -> Searching "foxdot" and pressing install on the plug in. Press Ctrl+Alt+f or go to menu -> Packages -> FoxDot -> Toggle to start FoxDot running.
194
+
195
+ ## Running Python files with FoxDot code
196
+
197
+ You can import `FoxDot` into your own Python programs as you would any other module. If you are not writing an interactive program, i.e. only containing FoxDot code, then you need to call a function `Go()` at the end of your program to get playback otherwise the program will terminate immediately. For example your program, `my_file.py`, should look something like this:
198
+
199
+ ```python
200
+ from FoxDot import *
201
+ p1 >> pads([0, 1, 2, 3])
202
+ d1 >> play("x-o-")
203
+ Go()
204
+ ```
205
+
206
+ Then just run like any other Python program: `python my_file.py`
207
+
208
+ ## Thanks
209
+
210
+ - The SuperCollider development community and, of course, James McCartney, its original developer
211
+ - PyOSC, Artem Baguinski et al
212
+ - Members of the Live Coding community who have contributed to the project in one way or another including, but not limited to, Alex McLean, Sean Cotterill, and Dan Hett.
213
+ - Big thanks to those who have used, tested, and submitted bugs, which have all helped improve FoxDot
214
+ - Thank you to those who have found solutions for SuperCollider related issues, such as DavidS48
215
+
216
+ ### Samples
217
+
218
+ FoxDot's audio files have been obtained from a number of sources but I've lost record of which files are attributed to which original author. Here's a list of thanks for the unknowing creators of FoxDot's sample archive.
219
+
220
+ - [Legowelt Sample Kits](https://awolfe.home.xs4all.nl/samples.html)
221
+ - [Game Boy Drum Kit](http://bedroomproducersblog.com/2015/04/08/game-boy-drum-kit/)
222
+ - A number of sounds courtesy of Mike Hodnick's live coded album, [Expedition](https://github.com/kindohm/expedition)
223
+ - Many samples have been obtained from http://freesound.org and have been placed in the public domain via the Creative Commons 0 License: http://creativecommons.org/publicdomain/zero/1.0/ - thank you to the original creators
224
+ - Other samples have come from the [Dirt Sample Engine](https://github.com/tidalcycles/Dirt-Samples/tree/c2db9a0dc4ffb911febc613cdb9726cae5175223) which is part of the TidalCycles live coding language created by Yaxu - another huge amount of thanks.
225
+
226
+ If you feel I've used a sample where I shouldn't have, please get in touch!
@@ -0,0 +1,211 @@
1
+ Renardo v0.9 - FoxDot fork
2
+ ===========================
3
+
4
+ FoxDot is a Python programming environment that provides a fast and user-friendly abstraction to SuperCollider. It also comes with its own IDE, which means it can be used straight out of the box; all you need is Python and SuperCollider and you're ready to go!
5
+
6
+ ## Important
7
+
8
+ If you are having trouble installing using `pip install FoxDot`, try updating Python's `setuptools` and `wheel` libraries using the following code and trying again.
9
+
10
+ ```
11
+ pip install -U setuptools
12
+ pip install -U wheel
13
+ ```
14
+
15
+ ### v0.8 Updates
16
+
17
+ - Added `stretch` synth for timestretching samples, similar to `loop` but better and only plays the whole file. Stretches the audio's duration to the `sus` attribute without affecting pitch and does not require the tempo to be known.
18
+
19
+ ```python
20
+ # Stretches the audio to 4 beats without affecting pitch
21
+ p1 >> stretch("Basic_Rock_135", dur=4)
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Installation and startup
27
+
28
+ #### Prerequisites
29
+ - [Python 2 or 3](https://www.python.org/) - add Python to your path and install "pip" when prompted during the install.
30
+ - [SuperCollider 3.8 and above](http://supercollider.github.io/download)
31
+ - [Tkinter](https://tkdocs.com/tutorial/install.html) - Usually packaged with Python but Linux and MacOS users may need to install using:
32
+ ```bash
33
+ $ sudo apt-get install python3-tk (Linux)
34
+ $ sudo port install py-tkinter (MacOS)
35
+ ```
36
+ #### Recommended
37
+ - [sc3 plugins](http://sc3-plugins.sourceforge.net/)
38
+
39
+ #### Installing FoxDot
40
+
41
+ - Open up a command prompt and type `pip install --user FoxDot`. This will download and install the latest stable version of FoxDot from the Python Package Index if you have properly configured Python.
42
+ - You can update FoxDot to the latest version if it's already installed by adding `-U` or `--upgrade` flag to this command.
43
+ - Alternatively, you can build from source from directly from this repository:
44
+ ``` bash
45
+ $ git clone https://github.com/Qirky/FoxDot.git
46
+ $ cd FoxDot
47
+ $ python setup.py install
48
+ ```
49
+ - Open SuperCollder and install the FoxDot Quark and its dependencies (this allows FoxDot to communicate with SuperCollider) by entering the following and pressing `Ctrl+Return` (Note: this requires [Git to be installed](http://git-scm.com/) on your machine if it is not already):
50
+ ```supercollider
51
+ Quarks.install("FoxDot")
52
+ ```
53
+ - Recompile the SuperCollider class library by going to `Language -> Recompile Class Library` or pressing `Ctrl+Shift+L`
54
+
55
+ #### Startup
56
+
57
+ 1. Open SuperCollider and type in `FoxDot.start` and evaluate this line. SuperCollider is now listening for messages from FoxDot.
58
+ 2. Start FoxDot by entering `FoxDot` at the command line. If that doesn't work, try `python -m FoxDot`.
59
+ 3. If you have installed the SC3 Plugins, use the "Code" drop-down menu to select "Use SC3 Plugins". Restart FoxDot and you'll have access to classes found in the SC3 Plugins.
60
+ 4. Keep up to date with the latest verion of FoxDot by running `pip install FoxDot --upgrade` every few weeks.
61
+ 5. Check out the [YouTube tutorials](https://www.youtube.com/channel/UCRyrNX07lFcfRSymZEWwl6w) for some in-depth tutorial videos on getting to grips with FoxDot
62
+
63
+ #### Installing with SuperCollider 3.7 or earlier
64
+
65
+ If you are having trouble installing the FoxDot Quark in SuperCollider, it is usually because the version of SuperCollider you are installing doesn’t have the functionality for installing Quarks or it doesn’t work properly. If this is the case, you can download the contents of the following SuperCollider script: [foxdot.scd](http://foxdot.org/wp-content/uploads/foxdot.scd). Once downloaded, open the file in SuperCollider and press Ctrl+Return to run it. This will make SuperCollider start listening for messages from FoxDot.
66
+
67
+ #### Frequently Asked Questions
68
+
69
+ You can find answers to many frequently asked questions on the [FAQ post on the FoxDot discussion forum](http://foxdot.org/forum/?view=thread&id=1).
70
+
71
+ ## Basics
72
+
73
+ ### Executing Code
74
+
75
+ A 'block' of code in FoxDot is made up of consecutive lines of code with no empty lines. Pressing `Ctrl+Return` (or `Cmd+Return` on a Mac) will execute the block of code that the cursor is currently in. Try `print(1 + 1)` to see what happens!
76
+
77
+ ### Player Objects
78
+
79
+ Python supports many different programming paradigms, including procedural and functional, but FoxDot implements a traditional object orientated approach with a little bit of cheating to make it easier to live code. A player object is what FoxDot uses to make music by assigning it a synth (the 'instrument' it will play) and some instructions, such as note pitches. All one and two character variable names are reserved for player objects at startup so, by default, the variables `a`, `bd`, and `p1` are 'empty' player objects. If you use one of these variables to store something else but want to use it as a player object again, or you want to use a variable with more than two characters, you just have to reserve it by creating a `Player` and assigning it like so:
80
+
81
+ ``` python
82
+ p1 = Player("p1") # The string name is optional
83
+ ```
84
+
85
+ To stop a Player, use the `stop` method e.g. `p1.stop()`. If you want to stop all players, you can use the command `Clock.clear()` or the keyboard short-cut `Ctrl+.`, which executes this command.
86
+
87
+ Assigning synths and instructions to a player object is done using the double-arrow operator `>>`. So if you wanted to assign a synth to `p1` called 'pads' (execute `print(SynthDefs)` to see all available synths) you would use the following code:
88
+
89
+ ``` python
90
+ p1 >> pads([0,1,2,3])
91
+ ```
92
+
93
+ The empty player object, `p1` is now assigned a the 'pads' synth and some playback instructions. `p1` will play the first four notes of the default scale using a SuperCollider `SynthDef` with the name `\pads`. By default, each note lasts for 1 beat at 120 bpm. These defaults can be changed by specifying keyword arguments:
94
+
95
+ ```python
96
+ p1 >> pads([0,1,2,3], dur=[1/4,3/4], sus=1, vib=4, scale=Scale.minor)
97
+ ```
98
+
99
+ The keyword arguments `dur`, `oct`, and `scale` apply to all player objects - any others, such as `vib` in the above example, refer to keyword arguments in the corresponding `SynthDef`. The first argument, `degree`, does not have to be stated explicitly. Notes can be grouped together so that they are played simultaneously using round brackets, `()`. The sequence `[(0,2,4),1,2,3]` will play the the the first harmonic triad of the default scale followed by the next three notes.
100
+
101
+ ### 'Sample Player' Objects
102
+
103
+ In FoxDot, sound files can be played through using a specific SynthDef called `play`. A player object that uses this SynthDef is referred to as a Sample Player object. Instead of specifying a list of numbers to generate notes, the Sample Player takes a string of characters (known as a "PlayString") as its first argument. To see a list of what samples are associated to what characters, use `print(Samples)`. To create a basic drum beat, you can execute the following line of code:
104
+
105
+ ``` python
106
+ d1 >> play("x-o-")
107
+ ```
108
+
109
+ To have samples play simultaneously, you can create a new 'Sample Player' object for some more complex patterns.
110
+
111
+ ``` python
112
+ bd >> play("x( x) ")
113
+ hh >> play("---[--]")
114
+ sn >> play(" o ")
115
+ ```
116
+
117
+ Alternatively, you can do this in one line using `<>` arrows to separate patterns you want to play together like so:
118
+
119
+ ```python
120
+ d1 >> play("<x( x) ><---[--]>< o >")
121
+ ```
122
+
123
+ Or you can use `PZip`, the `zip` method, or the `&` sign to create one pattern that does this. This can be useful if you want to perform some function on individual layers later on:
124
+
125
+ ``` python
126
+ d1 >> play(P["x( x) "].palindrome().zip("---[--]").zip(P[" o "].amen()))
127
+
128
+ # The first item must be a P[] pattern, not a string.
129
+
130
+ d1 >> play(P["x( x) "].palindrome() & "---[--]" & P[" o "].amen())
131
+ ```
132
+
133
+ Grouping characters in round brackets laces the pattern so that on each play through of the sequence of samples, the next character in the group's sample is played. The sequence `(xo)---` would be played back as if it were entered `x---o---`. Using square brackets will force the enclosed samples to played in the same time span as a single character e.g. `--[--]` will play two hi-hat hits at a half beat then two at a quarter beat. You can play a random sample from a selection by using curly braces in your Play String like so:
134
+
135
+ ``` python
136
+ d1 >> play("x-o{-[--]o[-o]}")
137
+ ```
138
+
139
+ There is now the functionality to specify the sample number for an individual sample when using the `play` SynthDef. This can be done from the play string itself by using the bar character in the form `|<char><sample>|`. These can also be patterns created using brackets:
140
+
141
+ ```python
142
+ # Plays the kick drum with sample 2 but the rest with sample 0
143
+ p1 >> play("|x2|-o-")
144
+
145
+ # You can use square brackets to play multiple samples
146
+ p1 >> play("|x[12]| o ")
147
+
148
+ # Round brackets alternate which sample is used on each loop through the sequence
149
+ p1 >> play("|x(12)| o ")
150
+
151
+ # Curly braces will pick a sample at random
152
+ p1 >> play("|x{0123}| o ")
153
+ ```
154
+
155
+ ## Scheduling Player methods
156
+
157
+ You can perform actions like shuffle, mirror, and rotate on Player Objects just by calling the appropriate method.
158
+
159
+ ```python
160
+ bd >> play("x o xo ")
161
+
162
+ # Shuffle the contents of bd
163
+ bd.shuffle()
164
+ ```
165
+
166
+ You can schedule these methods by calling the `every` method, which takes a list of durations (in beats), the name of the method as a string, and any other arguments. The following syntax mirrors the string of sample characters after 6 beats, then again 2 beats later and also shuffles it every 8 beats.
167
+
168
+ ```python
169
+ bd >> play("x-o-[xx]-o(-[oo])").every([6,2], 'mirror').every(8, 'shuffle')
170
+ ```
171
+
172
+ ## Documentation
173
+
174
+ [Link to documentation website](https://foxdot.org/docs/) (still in progress)
175
+
176
+ ## Using alternative editors
177
+
178
+ FoxDot comes pre-packaged with its own basic editor so that you don't have to tinker with config files or download any other tools but if you want to use an existing editor you can. [Koltes](https://github.com/KoltesDigital) has written a plugin for the popular Atom editor. You can install it by going to Settings -> Install -> Searching "foxdot" and pressing install on the plug in. Press Ctrl+Alt+f or go to menu -> Packages -> FoxDot -> Toggle to start FoxDot running.
179
+
180
+ ## Running Python files with FoxDot code
181
+
182
+ You can import `FoxDot` into your own Python programs as you would any other module. If you are not writing an interactive program, i.e. only containing FoxDot code, then you need to call a function `Go()` at the end of your program to get playback otherwise the program will terminate immediately. For example your program, `my_file.py`, should look something like this:
183
+
184
+ ```python
185
+ from FoxDot import *
186
+ p1 >> pads([0, 1, 2, 3])
187
+ d1 >> play("x-o-")
188
+ Go()
189
+ ```
190
+
191
+ Then just run like any other Python program: `python my_file.py`
192
+
193
+ ## Thanks
194
+
195
+ - The SuperCollider development community and, of course, James McCartney, its original developer
196
+ - PyOSC, Artem Baguinski et al
197
+ - Members of the Live Coding community who have contributed to the project in one way or another including, but not limited to, Alex McLean, Sean Cotterill, and Dan Hett.
198
+ - Big thanks to those who have used, tested, and submitted bugs, which have all helped improve FoxDot
199
+ - Thank you to those who have found solutions for SuperCollider related issues, such as DavidS48
200
+
201
+ ### Samples
202
+
203
+ FoxDot's audio files have been obtained from a number of sources but I've lost record of which files are attributed to which original author. Here's a list of thanks for the unknowing creators of FoxDot's sample archive.
204
+
205
+ - [Legowelt Sample Kits](https://awolfe.home.xs4all.nl/samples.html)
206
+ - [Game Boy Drum Kit](http://bedroomproducersblog.com/2015/04/08/game-boy-drum-kit/)
207
+ - A number of sounds courtesy of Mike Hodnick's live coded album, [Expedition](https://github.com/kindohm/expedition)
208
+ - Many samples have been obtained from http://freesound.org and have been placed in the public domain via the Creative Commons 0 License: http://creativecommons.org/publicdomain/zero/1.0/ - thank you to the original creators
209
+ - Other samples have come from the [Dirt Sample Engine](https://github.com/tidalcycles/Dirt-Samples/tree/c2db9a0dc4ffb911febc613cdb9726cae5175223) which is part of the TidalCycles live coding language created by Yaxu - another huge amount of thanks.
210
+
211
+ If you feel I've used a sample where I shouldn't have, please get in touch!
@@ -0,0 +1,74 @@
1
+ import os
2
+ import subprocess
3
+ from sys import platform
4
+ import time
5
+ import pathlib
6
+
7
+ import psutil
8
+
9
+ from renardo.SCFilesHandling import SC_USER_CONFIG_DIR
10
+
11
+ class PulsarNotFoundError(Exception):
12
+ pass
13
+
14
+ class PulsarInstance:
15
+
16
+ def __init__(self):
17
+ self.pulsar_process = None
18
+
19
+ if platform == "win32":
20
+ # if chocolatey
21
+ pulsar_appdata_path = pathlib.Path(os.getenv('LOCALAPPDATA')) / 'Programs' / 'Pulsar' / 'Pulsar.exe'
22
+ pulsar_c_path = pathlib.WindowsPath("C:") / 'Program Files' / 'Pulsar' / 'Pulsar.exe'
23
+ if pulsar_appdata_path.exists():
24
+ self.pulsar_exec = [str(pulsar_appdata_path)]
25
+ elif pulsar_c_path.exists():
26
+ self.pulsar_exec = [str(pulsar_c_path)]
27
+ else:
28
+ raise PulsarNotFoundError
29
+ elif platform == "Darwin":
30
+ pulsar_path = pathlib.Path("/Applications" / "Pulsar.app")
31
+ self.pulsar_exec = ['open', str(pulsar_path)]
32
+ else:
33
+ self.pulsar_exec = ["pulsar"]
34
+
35
+
36
+ def start_pulsar_subprocess(self):
37
+ if not self.is_pulsar_running():
38
+ self.pulsar_process = subprocess.Popen(
39
+ args=self.pulsar_exec,
40
+ #shell=True,
41
+ stdout=subprocess.PIPE,
42
+ stderr=subprocess.PIPE,
43
+ stdin=subprocess.PIPE,
44
+ )
45
+
46
+ def read_stdout_line(self):
47
+ if self.pulsar_process.returncode is None:
48
+ return self.pulsar_process.stdout.readline().decode("utf-8")
49
+
50
+ def read_stderr_line(self):
51
+ if self.pulsar_process.returncode is None:
52
+ return self.pulsar_process.stderr.readline().decode("utf-8")
53
+
54
+ def evaluate_sclang_code(self, code_string):
55
+ raw = code_string.encode("utf-8") + b"\x1b"
56
+ self.pulsar_process.stdin.write(raw)
57
+ self.pulsar_process.stdin.flush()
58
+
59
+ # TODO : find a way to consistently stop sclang and scsynth when renardo stops/dies
60
+ # TODO : find a way to name/tag the sclang/synth processes with name renardo to find it better
61
+ # TODO : Use name renardo for scsynth audio server (for example with JACK Driver)
62
+
63
+ def __del__(self):
64
+ pass
65
+ # self.popen.kill() # TODO: fix that the destructor is not called
66
+ # need to clarify the launch and close process of foxdot/renardo !
67
+ # self.popen.wait()
68
+
69
+ def is_pulsar_running(self):
70
+ running = False
71
+ for process in psutil.process_iter():
72
+ if 'pulsar' in process.name().lower():
73
+ running = True
74
+ return running
@@ -0,0 +1,88 @@
1
+ from .SCFilesHandling import write_sc_renardo_files_in_user_config
2
+ from .SuperColliderInstance import SupercolliderInstance
3
+ from .PulsarInstance import PulsarInstance
4
+ from .RenardoTUI import RenardoTUI
5
+ from renardo_gatherer.samples_download import SPackManager
6
+
7
+ import argparse
8
+ import time
9
+
10
+ class RenardoApp:
11
+
12
+ def __init__(self):
13
+ self.sc_instance = None
14
+ self.spack_manager = SPackManager()
15
+ self.args = RenardoApp.parse_args()
16
+ self.sc_instance = SupercolliderInstance()
17
+ self.pulsar_instance = PulsarInstance()
18
+ self.launch()
19
+
20
+ def launch(self):
21
+
22
+ # if args.cli:
23
+ # if args.dir:
24
+ # try:
25
+ # # Use given directory
26
+ # FoxDotCode.use_sample_directory(args.dir)
27
+ # except OSError as e:
28
+ # # Exit with last error
29
+ # import sys, traceback
30
+ # sys.exit(traceback.print_exc(limit=1))
31
+
32
+ # if args.startup:
33
+ # try:
34
+ # FoxDotCode.use_startup_file(args.startup)
35
+ # except OSError as e:
36
+ # import sys, traceback
37
+ # sys.exit(traceback.print_exc(limit=1))
38
+ # if args.no_startup:
39
+ # FoxDotCode.no_startup()
40
+
41
+ if self.args.create_scfiles:
42
+ write_sc_renardo_files_in_user_config()
43
+
44
+ if not (self.args.no_tui or self.args.pipe or self.args.foxdot_editor):
45
+ RenardoTUI(self).run()
46
+
47
+ if self.args.boot:
48
+ print("Launching Renardo SC module with SCLang...")
49
+ self.sc_instance.start_sclang_subprocess()
50
+ output_line = self.sc_instance.read_stdout_line()
51
+ while "Welcome to" not in output_line:
52
+ print(output_line[:-1]) # remove \n at the end to avoid double newline
53
+ output_line = self.sc_instance.read_stdout_line()
54
+ self.sc_instance.evaluate_sclang_code("Renardo.start;")
55
+ time.sleep(3)
56
+
57
+ if self.args.pipe:
58
+ from renardo_lib import handle_stdin, FoxDotCode
59
+ # Just take commands from the CLI
60
+ handle_stdin()
61
+ elif self.args.foxdot_editor:
62
+ from renardo_lib import FoxDotCode
63
+ # Open the GUI
64
+ from FoxDotEditor.Editor import workspace
65
+ FoxDot = workspace(FoxDotCode).run()
66
+ elif self.args.no_tui:
67
+ print("You need to choose a launching mode : TUI, --pipe or --foxdot-editor...")
68
+ print("Quitting...")
69
+
70
+ @staticmethod
71
+ def parse_args():
72
+ parser = argparse.ArgumentParser(
73
+ prog="renardo",
74
+ description="Live coding with Python and SuperCollider",
75
+ epilog="More information: https://renardo.org/"
76
+ )
77
+ parser.add_argument('-N', '--no-tui', action='store_true', help="does start renardo TUI")
78
+ parser.add_argument('-p', '--pipe', action='store_true', help="run Renardo from the command line interface")
79
+ parser.add_argument('-f', '--foxdot-editor', action='store_true', help="run Renardo with the classic FoxDot code editor")
80
+ # parser.add_argument('-d', '--dir', action='store', help="use an alternate directory for looking up samples")
81
+ # parser.add_argument('-s', '--startup', action='store', help="use an alternate startup file")
82
+ # parser.add_argument('-n', '--no-startup', action='store_true', help="does not load startup.py on boot")
83
+ # store_false => boot default value = True WTF
84
+ parser.add_argument('-b', '--boot', action='store_true', help="Boot SuperCollider Renardo instance automatically")
85
+ parser.add_argument('-c', '--create-scfiles', action='store_true', help="Create Renardo class file and startup file in SuperCollider user conf dir.")
86
+
87
+ return parser.parse_args()
88
+