@devaloop/devalang 0.1.6 → 0.1.7
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.
- package/README.md +21 -13
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -149,25 +149,25 @@ Create a file `hello.deva` or `index.deva` (if you do not specify `--input` argu
|
|
|
149
149
|
- Devalang is **case-sensitive**, so be consistent with capitalization.
|
|
150
150
|
- Devalang reads files from **top to bottom**, so order matters.
|
|
151
151
|
- Devalang files typically starts with :
|
|
152
|
-
1. Module system (
|
|
152
|
+
1. Module system (`load`, `import`, `use`)
|
|
153
153
|
2. Global settings (`bpm`, `bank`)
|
|
154
154
|
3. Definitions (`const/let/var`, `synth`, `pattern`, `group`)
|
|
155
155
|
4. Algorithmic logic (`if`, `loop`, `for`)
|
|
156
156
|
5. Musical logic / Execution (trigger calls, automations, `call`, `spawn`, `sleep`)
|
|
157
|
-
6. Optional exports (
|
|
157
|
+
6. Optional exports (`export`)
|
|
158
158
|
- Devalang files can include comments using `#` or `//` for single-line comments.
|
|
159
159
|
- You can name your files anything, but `index.deva` is a common convention for the main entry file.
|
|
160
|
-
- You can organize your project with subfolders as needed. (use module system like
|
|
160
|
+
- You can organize your project with subfolders as needed. (use module system like `import { var } from '<module_file_path>.deva'` and `export { var }`).
|
|
161
161
|
|
|
162
162
|
Refer to the [documentation](https://docs.devalang.com) for a complete syntax reference.
|
|
163
163
|
|
|
164
164
|
```deva
|
|
165
165
|
# Import some variables from other modules
|
|
166
|
-
|
|
166
|
+
import { myTempo } from "./shared/variables.deva"
|
|
167
167
|
|
|
168
168
|
# Load an external sample and a MIDI file
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
load "./samples/my-sample.wav" as mySample
|
|
170
|
+
load "./midi/my-midi-file.mid" as myMidiFile
|
|
171
171
|
|
|
172
172
|
# Set the tempo with the imported variable
|
|
173
173
|
bpm myTempo
|
|
@@ -206,11 +206,11 @@ group myMelody:
|
|
|
206
206
|
})
|
|
207
207
|
-> reverb({ size: 0.3 }) # Small reverb effect
|
|
208
208
|
|
|
209
|
-
# Play the
|
|
210
|
-
|
|
209
|
+
# Play the kick pattern (in parallel) (non-blocking)
|
|
210
|
+
layer kickPattern
|
|
211
211
|
|
|
212
|
-
# Play the
|
|
213
|
-
|
|
212
|
+
# Play the melody (in sequential) (blocking)
|
|
213
|
+
sequence myMelody
|
|
214
214
|
|
|
215
215
|
# Bind and play the loaded MIDI pattern with 'mySynth' synth
|
|
216
216
|
bind myMidiFile -> mySynth
|
|
@@ -243,7 +243,7 @@ let myAwesomeSample = .mySample
|
|
|
243
243
|
.myAwesomeSample 1/8 # Play the sample for 1/8 beats
|
|
244
244
|
|
|
245
245
|
# Play the sample in conditional loop
|
|
246
|
-
for i in
|
|
246
|
+
for i in 0..3:
|
|
247
247
|
if i == 2:
|
|
248
248
|
.myAwesomeSample 1/4 # Play for 1/4 beats on iteration 2
|
|
249
249
|
else:
|
|
@@ -255,12 +255,12 @@ loop 10:
|
|
|
255
255
|
|
|
256
256
|
# Play the sample in an (infinite) passthrough loop (non-blocking)
|
|
257
257
|
# This will continue playing in the background and let the script continue
|
|
258
|
-
# You can also specify a
|
|
258
|
+
# You can also specify a duration using "loop pass(<duration>):"
|
|
259
259
|
loop pass:
|
|
260
260
|
.myAwesomeSample auto
|
|
261
261
|
|
|
262
262
|
# Export the melody
|
|
263
|
-
|
|
263
|
+
export { myMelody }
|
|
264
264
|
```
|
|
265
265
|
|
|
266
266
|
### ⚙️ (optional) Configure project settings
|
|
@@ -290,6 +290,14 @@ This typically evitate to re-type common arguments like `--path`, `--formats`, e
|
|
|
290
290
|
},
|
|
291
291
|
"live": {
|
|
292
292
|
"crossfade_ms": 50 // Change this to adjust crossfade duration when playing live
|
|
293
|
+
},
|
|
294
|
+
"rules": {
|
|
295
|
+
"explicit_durations": "warning",
|
|
296
|
+
"deprecated_syntax": "warning",
|
|
297
|
+
"var_keyword": "error", // Change this to "warning", "info" or "off" to relax the rule
|
|
298
|
+
"missing_duration": "info",
|
|
299
|
+
"implicit_type_conversion": "info",
|
|
300
|
+
"unused_variables": "warning"
|
|
293
301
|
}
|
|
294
302
|
}
|
|
295
303
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devaloop/devalang",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"description": "Write music with code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.",
|
|
6
6
|
"main": "out-tsc/index.js",
|
|
7
7
|
"types": "./out-tsc/index.d.ts",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"sound-design"
|
|
49
49
|
],
|
|
50
50
|
"author": {
|
|
51
|
-
"name": "
|
|
52
|
-
"email": "
|
|
53
|
-
"url": "https://
|
|
51
|
+
"name": "Labscend",
|
|
52
|
+
"email": "hello@labscend.studio",
|
|
53
|
+
"url": "https://labscend.studio"
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"repository": {
|