@devaloop/devalang 0.0.1-alpha.5 → 0.0.1-alpha.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/Cargo.toml +1 -1
- package/README.md +18 -6
- package/docs/CHANGELOG.md +19 -0
- package/docs/SYNTAX.md +42 -14
- package/docs/TODO.md +9 -8
- package/examples/group.deva +12 -0
- package/examples/index.deva +8 -8
- package/examples/loop.deva +15 -0
- package/examples/variables.deva +9 -0
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +44 -44
- package/project-version.json +5 -5
- package/rust/cli/build.rs +0 -1
- package/rust/cli/play.rs +2 -1
- package/rust/core/audio/interpreter.rs +317 -0
- package/rust/{audio → core/audio}/loader.rs +4 -0
- package/rust/{audio → core/audio}/render.rs +1 -5
- package/rust/core/builder/mod.rs +2 -1
- package/rust/core/lexer/handler/indent.rs +1 -1
- package/rust/core/lexer/handler/mod.rs +1 -2
- package/rust/core/lexer/handler/string.rs +3 -6
- package/rust/core/mod.rs +2 -1
- package/rust/core/parser/handler/identifier.rs +127 -1
- package/rust/core/parser/statement.rs +9 -5
- package/rust/core/preprocessor/processor.rs +28 -2
- package/rust/core/preprocessor/resolver/bank.rs +10 -9
- package/rust/core/preprocessor/resolver/group.rs +113 -0
- package/rust/core/preprocessor/resolver/loop_.rs +3 -6
- package/rust/core/preprocessor/resolver/mod.rs +7 -0
- package/rust/core/preprocessor/resolver/trigger.rs +0 -3
- package/rust/lib.rs +0 -1
- package/rust/main.rs +0 -1
- package/examples/exported.deva +0 -7
- package/rust/audio/interpreter.rs +0 -143
- /package/rust/{audio → core/audio}/engine.rs +0 -0
- /package/rust/{audio → core/audio}/mod.rs +0 -0
- /package/rust/{audio → core/audio}/player.rs +0 -0
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "devalang"
|
|
3
|
-
version = "0.0.1-alpha.
|
|
3
|
+
version = "0.0.1-alpha.7"
|
|
4
4
|
authors = ["Devaloop <contact@devaloop.com>"]
|
|
5
5
|
description = "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text."
|
|
6
6
|
license = "MIT"
|
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
[](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode)
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
## 🎼 Devalang, by **Devaloop Labs**
|
|
21
20
|
|
|
22
21
|
🎶 Compose music with code — simple, structured, sonic.
|
|
@@ -167,13 +166,27 @@ bpm globalBpm
|
|
|
167
166
|
bank globalBank
|
|
168
167
|
# Will declare a custom instrument bank using the globalBank variable
|
|
169
168
|
|
|
169
|
+
# Loops
|
|
170
|
+
|
|
170
171
|
loop 5:
|
|
171
172
|
.customKick kickDuration {reverb=50, drive=25}
|
|
172
|
-
# Will play 5 times a
|
|
173
|
+
# Will play 5 times a custom sample for 500ms with reverb and overdrive effects
|
|
174
|
+
|
|
175
|
+
# Groups
|
|
176
|
+
|
|
177
|
+
group myGroup:
|
|
178
|
+
.customKick kickDuration {reverb=50, drive=25}
|
|
179
|
+
# Will play the same sample in a group, allowing for more complex patterns
|
|
180
|
+
|
|
181
|
+
# Will be executed line by line (sequentially)
|
|
182
|
+
call myGroup
|
|
183
|
+
|
|
184
|
+
# Will be executed in parallel (concurrently)
|
|
185
|
+
# spawn myGroup
|
|
173
186
|
```
|
|
174
187
|
|
|
175
188
|
```deva
|
|
176
|
-
#
|
|
189
|
+
# variables.deva
|
|
177
190
|
|
|
178
191
|
let globalBpm = 120
|
|
179
192
|
let globalBank = 808
|
|
@@ -184,15 +197,14 @@ let kickDuration = 500
|
|
|
184
197
|
|
|
185
198
|
## 🧯 Known issues
|
|
186
199
|
|
|
187
|
-
- No support yet for `if`, `else`, `else if` statements
|
|
188
|
-
- No support yet for `@group`, `@pattern`, `@function` statements
|
|
200
|
+
- No support yet for `if`, `else`, `else if`, `pattern`, `function`, ... statements
|
|
189
201
|
- No support yet for cross-platform builds (Linux, macOS)
|
|
190
202
|
|
|
191
203
|
## 🧪 Roadmap Highlights
|
|
192
204
|
|
|
193
205
|
For more info, see [docs/ROADMAP.md](./docs/ROADMAP.md)
|
|
194
206
|
|
|
195
|
-
- ⏳ Other statements (e.g `if`,
|
|
207
|
+
- ⏳ Other statements (e.g `if`, `function`, ...)
|
|
196
208
|
- ⏳ Cross-platform support (Linux, macOS)
|
|
197
209
|
- ⏳ More built-in instruments (e.g. snare, hi-hat, etc.)
|
|
198
210
|
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## Version 0.0.1-alpha.6 (2025-07-11)
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
- Added example for `group` directive in `examples/group.devalang`.
|
|
12
|
+
|
|
13
|
+
## Structure
|
|
14
|
+
|
|
15
|
+
- Moved `rust/audio` folder to `rust/core/audio` to better organize the project structure.
|
|
16
|
+
|
|
17
|
+
### Core Components
|
|
18
|
+
|
|
19
|
+
- Implemented `group` directive to define groups of sounds.
|
|
20
|
+
- Implemented `call` directive to call a group of sounds.
|
|
21
|
+
- Implemented `spawn` directive to spawn a group of sounds in parallel.
|
|
22
|
+
- Implemented `sleep` directive to pause execution for a specified duration.
|
|
23
|
+
- Patched line and column tracking in the lexer to ensure correct indentation handling.
|
|
24
|
+
- Patched string lexing advancing to handle first character correctly.
|
|
25
|
+
|
|
7
26
|
## Version 0.0.1-alpha.5 (2025-07-05)
|
|
8
27
|
|
|
9
28
|
### Syntax
|
package/docs/SYNTAX.md
CHANGED
|
@@ -17,6 +17,18 @@ The engine uses indentation to define blocks, similar to Python. Each block must
|
|
|
17
17
|
<details>
|
|
18
18
|
<summary>Show available types</summary>
|
|
19
19
|
|
|
20
|
+
### Duration
|
|
21
|
+
|
|
22
|
+
Duration is defined using a number. It represents the length of a sound in milliseconds.
|
|
23
|
+
|
|
24
|
+
```deva
|
|
25
|
+
let duration = 1000
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Will play a sound for 1000 milliseconds (1 second).
|
|
29
|
+
|
|
30
|
+
NOTE: Other time units like seconds or beats are not supported yet, but will be in the future.
|
|
31
|
+
|
|
20
32
|
### String
|
|
21
33
|
|
|
22
34
|
Strings are defined using double quotes.
|
|
@@ -103,22 +115,13 @@ loop exportedIterator:
|
|
|
103
115
|
.kick auto exportedParams
|
|
104
116
|
```
|
|
105
117
|
|
|
106
|
-
###
|
|
118
|
+
### Triggers
|
|
107
119
|
|
|
108
|
-
|
|
120
|
+
You can load your own samples and use them in your music.
|
|
109
121
|
|
|
110
|
-
|
|
111
|
-
You can also create custom triggers using the `@load` directive.
|
|
122
|
+
Load usage : `@load <path> as <name>`
|
|
112
123
|
|
|
113
|
-
|
|
114
|
-
.kick
|
|
115
|
-
.kick 1/4
|
|
116
|
-
.kick auto {reverb: 50, decay: 30}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Custom triggers
|
|
120
|
-
|
|
121
|
-
Same usage as built-in triggers, but with custom audio files or effects.
|
|
124
|
+
Trigger usage : `.<name> <duration> <params>`
|
|
122
125
|
|
|
123
126
|
```deva
|
|
124
127
|
@load "./path/to/instrument.mp3" as mySample
|
|
@@ -138,7 +141,7 @@ let map = {myKey: 200}
|
|
|
138
141
|
let array = [0, 1, 2]
|
|
139
142
|
```
|
|
140
143
|
|
|
141
|
-
###
|
|
144
|
+
### Loops
|
|
142
145
|
|
|
143
146
|
Loops are defined using the `loop` keyword, followed by the number of iterations. The body of the loop is indented.
|
|
144
147
|
|
|
@@ -146,3 +149,28 @@ Loops are defined using the `loop` keyword, followed by the number of iterations
|
|
|
146
149
|
loop 10:
|
|
147
150
|
# ...
|
|
148
151
|
```
|
|
152
|
+
|
|
153
|
+
### Groups
|
|
154
|
+
|
|
155
|
+
Groups are defined using the `group` keyword, followed by the group name. The body of the group is indented.
|
|
156
|
+
|
|
157
|
+
```deva
|
|
158
|
+
group myGroup:
|
|
159
|
+
# ...
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Calling Groups (Sequential Execution)
|
|
163
|
+
|
|
164
|
+
Groups can be called using the `call` keyword, which executes the group in sequence.
|
|
165
|
+
|
|
166
|
+
```deva
|
|
167
|
+
call myGroup
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Spawning Groups (Parallel Execution)
|
|
171
|
+
|
|
172
|
+
Groups can be spawned using the `spawn` keyword, which executes the group in parallel.
|
|
173
|
+
|
|
174
|
+
```deva
|
|
175
|
+
spawn myGroup
|
|
176
|
+
```
|
package/docs/TODO.md
CHANGED
|
@@ -42,11 +42,14 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
42
42
|
- [x] #
|
|
43
43
|
- [x] @import
|
|
44
44
|
- [x] @export
|
|
45
|
-
- [ ] @group
|
|
46
|
-
- [ ] @pattern
|
|
47
|
-
- [ ] @function
|
|
48
45
|
- [x] @load
|
|
49
46
|
- [ ] @include
|
|
47
|
+
- [ ] function
|
|
48
|
+
- [ ] pattern
|
|
49
|
+
- [x] group
|
|
50
|
+
- [x] call
|
|
51
|
+
- [x] spawn
|
|
52
|
+
- [x] sleep
|
|
50
53
|
- [x] bpm
|
|
51
54
|
- [x] bank
|
|
52
55
|
- [x] loop
|
|
@@ -62,8 +65,6 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
62
65
|
|
|
63
66
|
## Other TODOs
|
|
64
67
|
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [ ] Add unit tests for all core components
|
|
69
|
-
- [ ] Comment all core components
|
|
68
|
+
- [ ] Patch path handling to support relative paths
|
|
69
|
+
- [ ] Comment all core components
|
|
70
|
+
- [ ] Add unit tests for all core components
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file demonstrates the use of grouping in Devalang.
|
|
2
|
+
|
|
3
|
+
@import { duration, default_bank, params, loopCount, tempo } from "./examples/variables.deva"
|
|
4
|
+
|
|
5
|
+
@load "./examples/samples/kick-808.wav" as kickCustom
|
|
6
|
+
@load "./examples/samples/hat-808.wav" as hatCustom
|
|
7
|
+
|
|
8
|
+
group myGroup:
|
|
9
|
+
.kickCustom duration params
|
|
10
|
+
.hatCustom duration params
|
|
11
|
+
|
|
12
|
+
@export { myGroup }
|
package/examples/index.deva
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
# This file demonstrates the use of main features in Devalang.
|
|
2
|
+
|
|
3
|
+
@import { duration, default_bank, params, loopCount, tempo } from "./examples/variables.deva"
|
|
4
|
+
@import { myGroup } from "./examples/group.deva"
|
|
2
5
|
|
|
3
6
|
@load "./examples/samples/kick-808.wav" as kickCustom
|
|
4
7
|
@load "./examples/samples/hat-808.wav" as hatCustom
|
|
@@ -7,11 +10,8 @@ bpm tempo
|
|
|
7
10
|
|
|
8
11
|
bank default_bank
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Uncomment the next line (.hat) while executing "play" command
|
|
14
|
-
# with `--repeat` option to see magic happen !
|
|
13
|
+
# Will be executed line by line (sequentially)
|
|
14
|
+
call myGroup
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
# Will be executed in parallel (concurrently)
|
|
17
|
+
# spawn myGroup
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# This file demonstrates the use of a loop in Devalang.
|
|
2
|
+
|
|
3
|
+
@import { duration, default_bank, params, loopCount, tempo } from "./examples/variables.deva"
|
|
4
|
+
|
|
5
|
+
@load "./examples/samples/kick-808.wav" as kickCustom
|
|
6
|
+
@load "./examples/samples/hat-808.wav" as hatCustom
|
|
7
|
+
|
|
8
|
+
loop loopCount:
|
|
9
|
+
.kickCustom duration params
|
|
10
|
+
|
|
11
|
+
# Uncomment the next line (.hat) while executing "play" command
|
|
12
|
+
# with `--repeat` option to see magic happen !
|
|
13
|
+
|
|
14
|
+
.hatCustom duration params
|
|
15
|
+
|
package/out-tsc/bin/devalang.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@devaloop/devalang",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
5
|
-
"description": "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.",
|
|
6
|
-
"main": "out-tsc/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"devalang": "./out-tsc/bin/index.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"prepublish": "cargo build --release && npm run script:postbuild",
|
|
12
|
-
"rust:dev:build": "cargo run build --entry examples --output output",
|
|
13
|
-
"rust:dev:check": "cargo run check --entry examples --output output",
|
|
14
|
-
"rust:wasm:web": "wasm-pack build --target=web --no-default-features",
|
|
15
|
-
"rust:wasm:node": "wasm-pack build --target=nodejs --no-default-features",
|
|
16
|
-
"script:postbuild": "tsc && node out-tsc/scripts/postbuild.js",
|
|
17
|
-
"script:version:bump": "tsc && node out-tsc/scripts/version/index.js"
|
|
18
|
-
},
|
|
19
|
-
"homepage": "https://devalang.com",
|
|
20
|
-
"keywords": [
|
|
21
|
-
"devalang",
|
|
22
|
-
"music",
|
|
23
|
-
"sound",
|
|
24
|
-
"domain-specific language",
|
|
25
|
-
"dsl",
|
|
26
|
-
"programming language",
|
|
27
|
-
"sound design",
|
|
28
|
-
"music hacking",
|
|
29
|
-
"audio",
|
|
30
|
-
"synthesis",
|
|
31
|
-
"scripting",
|
|
32
|
-
"sound synthesis",
|
|
33
|
-
"music programming"
|
|
34
|
-
],
|
|
35
|
-
"author": "Devaloop",
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "https://github.com/devaloop-labs/devalang.git"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@types/node": "^24.0.3"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@devaloop/devalang",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.1-alpha.7",
|
|
5
|
+
"description": "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.",
|
|
6
|
+
"main": "out-tsc/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"devalang": "./out-tsc/bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prepublish": "cargo build --release && npm run script:postbuild",
|
|
12
|
+
"rust:dev:build": "cargo run build --entry examples --output output",
|
|
13
|
+
"rust:dev:check": "cargo run check --entry examples --output output",
|
|
14
|
+
"rust:wasm:web": "wasm-pack build --target=web --no-default-features",
|
|
15
|
+
"rust:wasm:node": "wasm-pack build --target=nodejs --no-default-features",
|
|
16
|
+
"script:postbuild": "tsc && node out-tsc/scripts/postbuild.js",
|
|
17
|
+
"script:version:bump": "tsc && node out-tsc/scripts/version/index.js"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://devalang.com",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"devalang",
|
|
22
|
+
"music",
|
|
23
|
+
"sound",
|
|
24
|
+
"domain-specific language",
|
|
25
|
+
"dsl",
|
|
26
|
+
"programming language",
|
|
27
|
+
"sound design",
|
|
28
|
+
"music hacking",
|
|
29
|
+
"audio",
|
|
30
|
+
"synthesis",
|
|
31
|
+
"scripting",
|
|
32
|
+
"sound synthesis",
|
|
33
|
+
"music programming"
|
|
34
|
+
],
|
|
35
|
+
"author": "Devaloop",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/devaloop-labs/devalang.git"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@types/node": "^24.0.3"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/project-version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.0.1-alpha.
|
|
3
|
-
"channel": "alpha",
|
|
4
|
-
"lastCommit": "
|
|
5
|
-
"build":
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.1-alpha.7",
|
|
3
|
+
"channel": "alpha",
|
|
4
|
+
"lastCommit": "81db490b7d9cc92f0512b49cf3dbaeb74cf57de1",
|
|
5
|
+
"build": 6
|
|
6
6
|
}
|
package/rust/cli/build.rs
CHANGED
package/rust/cli/play.rs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
use crate::{
|
|
2
|
-
audio::player::AudioPlayer,
|
|
3
2
|
config::Config,
|
|
4
3
|
core::{
|
|
5
4
|
builder::Builder,
|
|
@@ -23,6 +22,8 @@ pub fn handle_play_command(
|
|
|
23
22
|
watch: bool,
|
|
24
23
|
repeat: bool
|
|
25
24
|
) {
|
|
25
|
+
use crate::core::audio::player::AudioPlayer;
|
|
26
|
+
|
|
26
27
|
let logger = Logger::new();
|
|
27
28
|
|
|
28
29
|
let entry_path = entry
|