devalang 0.1.8

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.
Documentation
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<div align="center">
    <img src="https://devalang.com/images/devalang-logo-min.png" alt="Devalang Logo" width="100" />
</div>

![Rust](https://img.shields.io/badge/Made%20with-Rust-%23DEA584?logo=rust)
![TypeScript](https://img.shields.io/badge/Built%20with-TypeScript-%233178C6?logo=typescript&logoColor=white)

![Rust](https://img.shields.io/badge/Rust-1.70.0%2B-%23DEA584?logo=rust)
![Node.js](https://img.shields.io/badge/Node.js-18%2B-%2368A063?logo=node.js&logoColor=white)

![Project Status](https://img.shields.io/badge/status-preview-%237C5FFF)
![Version](https://img.shields.io/npm/v/@devaloop/devalang?label=version&color=%237C5FFF)
![License: MIT](https://img.shields.io/badge/license-MIT-%237C5FFF)

![Platforms](https://img.shields.io/badge/platform-Windows%20%2F%20Linux%20%2F%20macOS-blue?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMjQwLTEyMHYtODBsNDAtNDBIMTYwcS0zMyAwLTU2LjUtMjMuNVQ4MC0zMjB2LTQ0MHEwLTMzIDIzLjUtNTYuNVQxNjAtODQwaDY0MHEzMyAwIDU2LjUgMjMuNVQ4ODAtNzYwdjQ0MHEwIDMzLTIzLjUgNTYuNVQ4MDAtMjQwSDY4MGw0MCA0MHY4MEgyNDBabS04MC0yMDBoNjQwdi00NDBIMTYwdjQ0MFptMCAwdi00NDAgNDQwWiIvPjwvc3ZnPg==)

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/devaloop-labs/devalang/.github/workflows/ci.yml?label=CI&logo=github)
![Coverage](https://img.shields.io/badge/coverage-TBD-red?label=coverage&logo=codecov&logoColor=white)

![npm](https://img.shields.io/npm/dt/@devaloop/devalang?label=npm&color=%231DB954)
![crates](https://img.shields.io/crates/d/devalang?label=crates.io&color=%231DB954)

# ๐ŸฆŠ Devalang โ€” Write music, like you write code.

Devalang is a compact **domain-specific language** (DSL) for **music makers**, **sound designers**, and **creative coders**.
Compose loops, control samples, synthesize audio, and render your ideas โ€” all in clean, **readable text**.

Whether you're **prototyping a beat**, building **generative music**, or **performing live**, Devalang gives you rhythmic precision with the elegance of code.

**From studio sketches to live sets, Devalang puts musical ideas into motion.**

## ๐Ÿ“š Quick Access

### Websites & Resources

[![Website](https://img.shields.io/badge/Official%20Website-%233D2E81?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDgwLjI4LTk2UTQwMS05NiAzMzEtMTI2dC0xMjIuNS04Mi41UTE1Ni0yNjEgMTI2LTMzMC45NnQtMzAtMTQ5LjVROTYtNTYwIDEyNi02MjkuNXEzMC02OS41IDgyLjUtMTIyVDMzMC45Ni04MzRxNjkuOTYtMzAgMTQ5LjUtMzB0MTQ5LjA0IDMwcTY5LjUgMzAgMTIyIDgyLjVUODM0LTYyOS4yOHEzMCA2OS43MyAzMCAxNDlRODY0LTQwMSA4MzQtMzMxdC04Mi41IDEyMi41UTY5OS0xNTYgNjI5LjI4LTEyNnEtNjkuNzMgMzAtMTQ5IDMwWm0tLjI4LTcycTEyMiAwIDIxMC04MXQxMDAtMjAwcS05IDgtMjAuNSAxMi41VDc0NC00MzJINjAwcS0yOS43IDAtNTAuODUtMjEuMTVRNTI4LTQ3NC4zIDUyOC01MDR2LTQ4SDM2MHYtOTZxMC0yOS43IDIxLjE1LTUwLjg1UTQwMi4zLTcyMCA0MzItNzIwaDQ4di0yNHEwLTE0IDUtMjZ0MTMtMjFxLTMtMS0xMC0xaC04cS0xMzAgMC0yMjEgOTF0LTkxIDIyMWgyMTZxNjAgMCAxMDIgNDJ0NDIgMTAydjQ4SDM4NHYxMDVxMjMgOCA0Ni43MyAxMS41UTQ1NC40NS0xNjggNDgwLTE2OFoiLz48L3N2Zz4=&logoColor=white)](https://devalang.com)
[![Docs](https://img.shields.io/badge/Documentation-%235A44BA?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDQ0LTI0NnYtNDU0cS00Mi0yMi04Ny0zM3QtOTMuMjItMTFxLTM2Ljk0IDAtNzMuMzYgNi41VDEyMC03MTZ2NDUycTM1LTEzIDcwLjgxLTE4LjVRMjI2LjYzLTI4OCAyNjQtMjg4cTQ3LjM1IDAgOTIuMTcgMTJRNDAxLTI2NCA0NDQtMjQ2Wm0zNiAxMDJxLTQ5LTMyLTEwMy01MnQtMTEzLTIwcS0zOCAwLTc2IDcuNVQxMTUtMTg2cS0yNCAxMC00NS41LTMuNTNUNDgtMjI5di01MDNxMC0xNCA3LjUtMjZUNzYtNzc2cTQ1LTIwIDkxLjktMzAgNDYuOTEtMTAgOTUuNjgtMTBRMzMzLTgxNiAzODQtODAyLjVUNDkyLTc2MHExMSA2IDE3LjUgMTYuNVQ1MTYtNzIwdjQ3NHE0My0yMCA4Ny44My0zMSA0NC44Mi0xMSA5Mi4xNy0xMSAzNyAwIDczLjUgNXQ3MC41IDE5di01MjlxMTEgNCAyMi4xMyA3LjkgMTEuMTMgMy45IDIxLjg3IDkuMSAxMyA2IDIxIDE4dDggMjZ2NTAzcTAgMjUtMTUuNSA0MHQtMzIuNSA3cS00MC0xOC04Mi40OC0yNi00Mi40Ny04LTg2LjUyLTgtNTkgMC0xMTMgMjB0LTEwMyA1MlptMTQ0LTI0MHYtNDMybDEyMC00OHY0MzJsLTEyMCA0OFpNMjgyLTQ5NVoiLz48L3N2Zz4=&logoColor=white)](https://docs.devalang.com)
[![Playground](https://img.shields.io/badge/Playground-%237C5FFF?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJtMjcyLTQ0MCAyMDggMTIwIDIwOC0xMjAtMTY4LTk3djEzN2gtODB2LTEzN2wtMTY4IDk3Wm0xNjgtMTg5di0xN3EtNDQtMTMtNzItNDkuNVQzNDAtNzgwcTAtNTggNDEtOTl0OTktNDFxNTggMCA5OSA0MXQ0MSA5OXEwIDQ4LTI4IDg0LjVUNTIwLTY0NnYxN2wyODAgMTYxcTE5IDExIDI5LjUgMjkuNVQ4NDAtMzk4djc2cTAgMjItMTAuNSA0MC41VDgwMC0yNTJMNTIwLTkxcS0xOSAxMS00MCAxMXQtNDAtMTFMMTYwLTI1MnEtMTktMTEtMjkuNS0yOS41VDEyMC0zMjJ2LTc2cTAtMjIgMTAuNS00MC41VDE2MC00NjhsMjgwLTE2MVptMCAzNzhMMjAwLTM4OXY2N2wyODAgMTYyIDI4MC0xNjJ2LTY3TDUyMC0yNTFxLTE5IDExLTQwIDExdC00MC0xMVptNDAtNDY5cTI1IDAgNDIuNS0xNy41VDU0MC03ODBxMC0yNS0xNy41LTQyLjVUNDgwLTg0MHEtMjUgMC00Mi41IDE3LjVUNDIwLTc4MHEwIDI1IDE3LjUgNDIuNVQ0ODAtNzIwWm0wIDU2MFoiLz48L3N2Zz4=&logoColor=white)](https://playground.devalang.com)

### Important files

[![Changelog](https://img.shields.io/badge/Changelog-%23129978?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMjQwLTgwcS01MCAwLTg1LTM1dC0zNS04NXYtMTIwaDEyMHYtNTYwbDYwIDYwIDYwLTYwIDYwIDYwIDYwLTYwIDYwIDYwIDYwLTYwIDYwIDYwIDYwLTYwIDYwIDYwIDYwLTYwdjY4MHEwIDUwLTM1IDg1dC04NSAzNUgyNDBabTQ4MC04MHExNyAwIDI4LjUtMTEuNVQ3NjAtMjAwdi01NjBIMzIwdjQ0MGgzNjB2MTIwcTAgMTcgMTEuNSAyOC41VDcyMC0xNjBaTTM2MC02MDB2LTgwaDI0MHY4MEgzNjBabTAgMTIwdi04MGgyNDB2ODBIMzYwWm0zMjAtMTIwcS0xNyAwLTI4LjUtMTEuNVQ2NDAtNjQwcTAtMTcgMTEuNS0yOC41VDY4MC02ODBxMTcgMCAyOC41IDExLjVUNzIwLTY0MHEwIDE3LTExLjUgMjguNVQ2ODAtNjAwWm0wIDEyMHEtMTcgMC0yOC41LTExLjVUNjQwLTUyMHEwLTE3IDExLjUtMjguNVQ2ODAtNTYwcTE3IDAgMjguNSAxMS41VDcyMC01MjBxMCAxNy0xMS41IDI4LjVUNjgwLTQ4MFpNMjQwLTE2MGgzNjB2LTgwSDIwMHY0MHEwIDE3IDExLjUgMjguNVQyNDAtMTYwWm0tNDAgMHYtODAgODBaIi8+PC9zdmc+)](https://github.com/devaloop-labs/devalang/blob/main/docs/CHANGELOG.md)
[![Examples](https://img.shields.io/badge/Examples-%231DE9B6?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDgwLTgwcS0zMyAwLTU2LjUtMjMuNVQ0MDAtMTYwaDE2MHEwIDMzLTIzLjUgNTYuNVQ0ODAtODBaTTMyMC0yMDB2LTgwaDMyMHY4MEgzMjBabTEwLTEyMHEtNjktNDEtMTA5LjUtMTEwVDE4MC01ODBxMC0xMjUgODcuNS0yMTIuNVQ0ODAtODgwcTEyNSAwIDIxMi41IDg3LjVUNzgwLTU4MHEwIDgxLTQwLjUgMTUwVDYzMC0zMjBIMzMwWm0yNC04MGgyNTJxNDUtMzIgNjkuNS03OVQ3MDAtNTgwcTAtOTItNjQtMTU2dC0xNTYtNjRxLTkyIDAtMTU2IDY0dC02NCAxNTZxMCA1NCAyNC41IDEwMXQ2OS41IDc5Wm0xMjYgMFoiLz48L3N2Zz4=)](https://github.com/devaloop-labs/devalang/blob/main/examples)

### Common projects and tools

[![Devapack](https://img.shields.io/badge/Devapack-%235A44BA?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDQwLTE4M3YtMjc0TDIwMC01OTZ2Mjc0bDI0MCAxMzlabTgwIDAgMjQwLTEzOXYtMjc0TDUyMC00NTd2Mjc0Wm0tODAgOTJMMTYwLTI1MnEtMTktMTEtMjkuNS0yOVQxMjAtMzIxdi0zMThxMC0yMiAxMC41LTQwdDI5LjUtMjlsMjgwLTE2MXExOS0xMSA0MC0xMXQ0MCAxMWwyODAgMTYxcTE5IDExIDI5LjUgMjl0MTAuNSA0MHYzMThxMCAyMi0xMC41IDQwVDgwMC0yNTJMNTIwLTkxcS0xOSAxMS00MCAxMXQtNDAtMTFabTIwMC01MjggNzctNDQtMjM3LTEzNy03OCA0NSAyMzggMTM2Wm0tMTYwIDkzIDc4LTQ1LTIzNy0xMzctNzggNDUgMjM3IDEzN1oiLz48L3N2Zz4=)](https://github.com/devaloop-labs/devapack)
[![VSCode Extension](https://img.shields.io/badge/VSCode%20Extension-%237C5FFF?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMzUyLTEyMEgyMDBxLTMzIDAtNTYuNS0yMy41VDEyMC0yMDB2LTE1MnE0OCAwIDg0LTMwLjV0MzYtNzcuNXEwLTQ3LTM2LTc3LjVUMTIwLTU2OHYtMTUycTAtMzMgMjMuNS01Ni41VDIwMC04MDBoMTYwcTAtNDIgMjktNzF0NzEtMjlxNDIgMCA3MSAyOXQyOSA3MWgxNjBxMzMgMCA1Ni41IDIzLjVUODAwLTcyMHYxNjBxNDIgMCA3MSAyOXQyOSA3MXEwIDQyLTI5IDcxdC03MSAyOXYxNjBxMCAzMy0yMy41IDU2LjVUNzIwLTEyMEg1NjhxMC01MC0zMS41LTg1VDQ2MC0yNDBxLTQ1IDAtNzYuNSAzNVQzNTItMTIwWm0tMTUyLTgwaDg1cTI0LTY2IDc3LTkzdDk4LTI3cTQ1IDAgOTggMjd0NzcgOTNoODV2LTI0MGg4MHE4IDAgMTQtNnQ2LTE0cTAtOC02LTE0dC0xNC02aC04MHYtMjQwSDQ4MHYtODBxMC04LTYtMTR0LTE0LTZxLTggMC0xNCA2dC02IDE0djgwSDIwMHY4OHE1NCAyMCA4NyA2N3QzMyAxMDVxMCA1Ny0zMyAxMDR0LTg3IDY4djg4Wm0yNjAtMjYwWiIvPjwvc3ZnPg==)](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode)

### Downloads

[![Binaries & Installers](https://img.shields.io/badge/Binaries%20%26%20installers-%23129978?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDgwLTMyMCAyODAtNTIwbDU2LTU4IDEwNCAxMDR2LTMyNmg4MHYzMjZsMTA0LTEwNCA1NiA1OC0yMDAgMjAwWk0yNDAtMTYwcS0zMyAwLTU2LjUtMjMuNVQxNjAtMjQwdi0xMjBoODB2MTIwaDQ4MHYtMTIwaDgwdjEyMHEwIDMzLTIzLjUgNTYuNVQ3MjAtMTYwSDI0MFoiLz48L3N2Zz4=)](https://devalang.com/download)

### Community

[![Discord](https://img.shields.io/badge/Labscend-%235865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/wCqd8e6JD8)
[![Instagram](https://img.shields.io/badge/Labscend-%23E1306C?style=for-the-badge&logo=Instagram&logoColor=white)](https://www.instagram.com/labscend)
[![X](https://img.shields.io/badge/Labscend-%23000?style=for-the-badge&logo=X&logoColor=white)](https://x.com/labscend)
[![LinkedIn](https://img.shields.io/badge/Labscend%20studios-%230077B5?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfYAAAH0CAMAAAD4/f+FAAAALVBMVEUAAAAAAAAA//////8AAAAAKir29vb9/f34+Pj////+/v/8/Pz+/v7///////+uVs+nAAAADnRSTlMAAQEBAgY1fIK4ucPM8ZH270sAAAf9SURBVHja7d3pQhs3FIBRy4EADcz7P6ec1mncopJmxcHgZRZJ93y/2hACzPHVSA7BaXWw9f1KzZZffWs69IbBlWu83fZUduadj3yCHhF+jz0V6L3Bp1V5e9qpRxj4PfZ3H1ymCPDJqEd0X1MP0LA/34l6xHlf//Sn3ve8vzzt1APNe6Ie0X3tcsRZ59Nv7Ia9/1LZZ6ceoIf9RZ56sGXevT1U5dedvGGPtps37TF3d4Y94rib9qjTbtjjjbtpDxn2cGf3r+zWeNMu7Op2lV8/uBCmXUHYk2tg2oVd2NXTVh67aRd2YRd2YRd2YRd2YRd2YRd2YRd2YRd2YRd2Yccu7MIu7MIu7MIu7MIu7MIu7MIu7MKui0oz/sjZzZdXKkklvb9x3Zcsz8b+wkvHPzy+I9Axez74Fj/cul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IW+fjLPHP2FPh3mubvb9oTc/+j3uEUf+NnXsM9T32VO6uXaX+9vDljWk38N21277wi+mFXwPf9QJ/iJ175+gH2Ml30afPB9+UDr7l5saF6+mofiT7U+sb+/oWK3/6PrlgpdcnWVKw/gPIIVzGz5rzvQAAAABJRU5ErkJggg==)](https://linkedin.com/company/labscend-studios)


## โšก Quick Start

### [Try in Your Browser](https://playground.devalang.com)

Launch the Devalang Playground to write, run, and share Devalang code directly in your web browser. No installation required !

### [Download an installer (recommended)](https://devalang.com/download)

Visit the download page to get the latest releases for Windows, macOS, and Linux.

This is the recommended way to install Devalang, as the installers will set up everything for you, including adding Devalang to your system PATH.

### [Download a binary executable (advanced)](https://devalang.com/download)

You can also download the standalone binaries for your OS from the download page.

You must ensure that the binary is executable (e.g., `chmod +x <binary_name>` on Linux/Mac).

You must also add the binary to your system PATH to use it from any terminal location.

---

### Install via npm (Node.js)

```bash
npm install -g @devaloop/devalang
```

### Install via Cargo (Rust)

```bash
cargo install devalang
```

### (optional but recommended) Install the VSCode extension

```bash
code --install-extension devaloop.devalang-vscode
```

### Create Your First Project

```bash
# Initialize a new project
devalang init my-project

# Navigate to the project
cd my-project

# Check syntax
devalang check --entry examples/index.deva

# Build audio files
devalang build --path examples/index.deva --formats wav mid

# Play audio (live mode)
devalang play --live --input examples/index.deva
```

## ๐Ÿ“ฆ (optional) Install addons

Devalang supports addons to extend functionalities. This allows you to easily add sound banks, effects, or other features.

> To create your own addon, please refer to the [Devapack documentation](https://github.com/devaloop-labs/devapack/tree/main/docs).

```bash
# List available addons
devalang addon list

# Install an addon (format: <author>.<addon-name>)
devalang addon install devaloop.808
```

This will install the `devaloop.808` sound bank in your current working directory inside `.deva` folder.

**You can then use it in your Devalang scripts !**

## ๐ŸŽต Your First Devalang File

Create a file `hello.deva` or `index.deva` (if you do not specify `--input` argument, it defaults to `index.deva`).

#### Nomenclature for .deva files

- Devalang files use the `.deva` extension.
- Devalang engine is **indentation-sensitive** for blocks, similar to Python.
- Files are plain text and can be edited with **any text editor** (VSCode recommended).
- Ensure your text editor supports **UTF-8 encoding**.
- Devalang is **case-sensitive**, so be consistent with capitalization.
- Devalang reads files from **top to bottom**, so order matters.
- Devalang files typically starts with :
  1. Module system (`load`, `import`, `use`)
  2. Global settings (`bpm`, `bank`)
  3. Definitions (`const/let/var`, `synth`, `pattern`, `group`)
  4. Algorithmic logic (`if`, `loop`, `for`)
  5. Musical logic / Execution (trigger calls, automations, `call`, `spawn`, `sleep`)
  6. Optional exports (`export`)
- Devalang files can include comments using `#` or `//` for single-line comments.
- You can name your files anything, but `index.deva` is a common convention for the main entry file.
- You can organize your project with subfolders as needed. (use module system like `import { var } from '<module_file_path>.deva'` and `export { var }`).

Refer to the [documentation](https://docs.devalang.com) for a complete syntax reference.

```deva
# Import some variables from other modules
import { myTempo } from "./shared/variables.deva" 

# Load an external sample and a MIDI file
load "./samples/my-sample.wav" as mySample
load "./midi/my-midi-file.mid" as myMidiFile

# Set the tempo with the imported variable
bpm myTempo

# Load a bank of sounds (make sure you have the bank installed)
bank devaloop.808 as drums

# Create a simple kick pattern (can also use "mySample")
pattern kickPattern with drums.kick = "x--- x--- x--- x---"

# Define a constant for synth, with a global LFO effect
# You can define variables scopes using const/let/var
const mySynth = synth saw
  -> lfo({
    rate: "1/8",
    depth: 1.0,
    waveform: "triangle",
    target: "pitch",
    semitones: 3.0
  })

# Define a melody using a group to organize notes
group myMelody:
  mySynth -> note(C5)
          -> duration(500)            # Note playing for 500ms

  mySynth -> note(E5)
          -> duration(1/4)            # Note playing for 1/4 beats

  mySynth -> chord(Gmaj7)
          -> duration(1/8)            # Chord playing for 1/8 beats
          -> velocity(100)            # Velocity (0.0 to 1.0) or 0-127
          -> lpf({
              cutoff: 800.0,          # Lowpass filter at 800 Hz
              resonance: 0.5          # Filter resonance at 50%
            })
          -> reverb({ size: 0.3 })    # Small reverb effect

# Play the kick pattern (in parallel) (non-blocking)
layer kickPattern

# Play the melody (in sequential) (blocking)
sequence myMelody

# Bind and play the loaded MIDI pattern with 'mySynth' synth
bind myMidiFile -> mySynth

# Pause for 1/4 beats
sleep 1/4

# Store the sample in a variable and apply effects to it
let myAwesomeSample = .mySample
    -> reverse(true)                  # Reverse the sample audio
    -> speed(2.0)                     # Multiply the playing speed by 2
    -> dist({
        amount: 1.0,                  # Apply a maximal distortion
        mix: 0.5                      # Apply a 50% mixing
    })
    -> reverb({
        size: 1.0,                    # Apply a maximal reverb size
        decay: 0.1,                   # Apply a short decay
        mix: 0.5                      # Apply a 50% mixing
    })
    -> reverb({                       # Duplicate reverb for a stronger effect
        size: 1.0,
        decay: 0.1,
        mix: 0.5
    })

# Playing the stored sample trigger in different ways
.myAwesomeSample                        # Play the full sample length
.myAwesomeSample auto                   # Use maximal sample length by default
.myAwesomeSample 1/8                    # Play the sample for 1/8 beats

# Play the sample in conditional loop
for i in 0..3:
    if i == 2:
        .myAwesomeSample 1/4            # Play for 1/4 beats on iteration 2
    else:
        .myAwesomeSample 1/8            # Play for 1/8 beats otherwise

# Play the sample in a blocking loop (run 10 times before continuing)
loop 10:
    .myAwesomeSample auto

# Play the sample in an (infinite) passthrough loop (non-blocking)
# This will continue playing in the background and let the script continue
# You can also specify a duration using "loop pass(<duration>):"
loop pass:
    .myAwesomeSample auto

# Export the melody
export { myMelody }
```

### โš™๏ธ (optional) Configure project settings

You can create a `devalang.json` (recommended) or `devalang.toml` or even `.devalang` (legacy) file to customize check/build/play settings.

This typically evitate to re-type common arguments like `--path`, `--formats`, etc.

> Comments are not supported in config files, please use `devalang init` to generate a default config.

```jsonc
{
  "project": {
    "name": "My Awesome Project"        // Change this to adjust project name
  },
  "paths": {
    "entry": "audio/helloWorld.deva",   // Change this to adjust entry file path
    "output": "output"                  // Change this to adjust output directory
  },
  "audio": {
    "format": ["wav", "mid"],           // Change this to adjust output formats (options: wav, mid, mp3)
    "bit_depth": 16,                    // Change this to 24 or 32 for higher quality
    "channels": 2,                      // Change this to 1 for mono output
    "sample_rate": 44100,               // Change this to 48000 for higher quality
    "resample_quality": "sinc24",       // Change this to adjust resampling quality (options: sinc8, sinc16, sinc24, sinc32)
    "bpm": 120                           // Change this to adjust the project tempo (only if not set in code)
  },
  "live": {
    "crossfade_ms": 50                  // Change this to adjust crossfade duration when playing live
  },
  "rules": {
    "explicit_durations": "warning",
    "deprecated_syntax": "warning",
    "var_keyword": "error",             // Change this to "warning", "info" or "off" to relax the rule
    "missing_duration": "info",
    "implicit_type_conversion": "info",
    "unused_variables": "warning"
  }
}

```

### Build the audio

```bash
# Build to WAV, MP3, and MIDI
devalang build --path hello.deva --formats wav,mp3,mid
```

### Play the audio

```bash
# Play the audio file
devalang play --input hello.deva

# Play live (repeats and watch until stopped)
devalang play --live --input hello.deva

# Play live loop without crossfade
# With 0ms, transitions between loops are no more distinguishable
devalang play --live --crossfade-ms 0 --input hello.deva
```

## ๐Ÿš€ Features

### ๐ŸŽต **Core Language**
- โœ… **Lexer & Parser** โ€” Complete tokenization and AST generation
- โœ… **Patterns** โ€” Rhythmic notation with swing, humanize, velocity
- โœ… **Synths** โ€” Built-in synthesizers with ADSR envelopes
- โœ… **Filters** โ€” Lowpass, highpass, bandpass audio filtering
- โœ… **Effects** โ€” Reverb, delay, distortion, drive, chorus
- โœ… **Variables** โ€” `let`, `const`, `var` with scoping
- โœ… **Groups & Spawn** โ€” Organize and parallelize execution
- โœ… **Loops & Conditions** โ€” `for`, `if`, `else` control flow
- โœ… **Triggers** โ€” Conditional audio triggering
- โœ… **Events** โ€” Event system with `on` and `emit`

### ๐Ÿ› ๏ธ **CLI Tools**
- โœ… `devalang init` โ€” Scaffold new projects
- โœ… `devalang build` โ€” Compile to WAV/MIDI/MP3
- โœ… `devalang check` โ€” Validate syntax
- โœ… `devalang play` โ€” Audio playback
- โœ… `devalang addon` โ€” Manage addons (install, list, discover)
- โœ… `devalang login/logout` โ€” Authentication
- โœ… `devalang telemetry` โ€” Privacy controls

### ๐ŸŒ **WASM API**
- โœ… `render_audio()` โ€” Browser audio rendering
- โœ… `render_midi_array()` โ€” MIDI export
- โœ… `debug_render()` โ€” Debug information
- โœ… `parse()` โ€” Parse Devalang code
- โœ… TypeScript types included

### ๐Ÿ“ฆ **Output Formats**
- โœ… **WAV** โ€” 16/24/32-bit audio export
- โœ… **MIDI** โ€” Standard MIDI file export
- โœ… **MP3** โ€” Lossy audio export (via LAME)

### ๐ŸŽฏ **Performance**
- โšก **Fast builds** โ€” 7-10ms for typical projects
- โšก **Low latency** โ€” Optimized audio engine
- โšก **Release builds** โ€” 5-6x faster than debug

### ๐Ÿ“š **Learning Resources**
- โœ… **Online Docs** โ€” Complete language reference
- โœ… **VSCode Extension** โ€” Syntax highlighting

## ๐Ÿ’ก Why Devalang?

- ๐ŸŽน **Prototype audio ideas** without opening a DAW
- ๐Ÿ’ป **Integrate sound** into code-based workflows
- ๐ŸŽ›๏ธ **Control audio parameters** with readable syntax
- ๐Ÿงช **Build musical logic** with variables and conditions
- ๐Ÿ”„ **Create patterns** with expressive notation
- ๐ŸŽจ **Live code** with fast iteration cycles
- ๐Ÿ“ฆ **Version control** your music with git

## ๐Ÿ”ง Development

### Build from Source

```bash
# Clone the repository
git clone https://github.com/devaloop-labs/devalang.git
cd devalang

# NPM (TypeScript) and Cargo (Rust) are required
npm install

# Build CLI (Rust)
cargo build

# Build WASM (Web & Node.js)
npm run rust:wasm:all

# Build TypeScript
npm run ts:build

# Run tests
cargo test --features cli
npm test
```

## ๐Ÿค Contributing

We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.

### Ways to Contribute

- ๐Ÿ› **Report bugs** via [GitHub Issues](https://github.com/devaloop-labs/devalang/issues)
- ๐Ÿ’ก **Suggest features** on [hello@labscend.studio](mailto://hello@labscend.studio)
- ๐ŸŽต **Share examples** of your creations with **#devalang** tag

## ๐Ÿ“œ License

MIT License โ€” See [LICENSE](./LICENSE) for details.

Copyright (c) 2025 Labscend Studios

---

<div align="center">
    <strong>Made with โค๏ธ by <a href="https://labscend.studio">Labscend Studios</a></strong>
    <br />
    <sub>Star โญ the repo if you like it !</sub>
</div>