@devaloop/devalang 0.0.1-alpha.12 → 0.0.1-alpha.14
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/.devalang +8 -9
- package/Cargo.toml +8 -3
- package/README.md +36 -34
- package/docs/CHANGELOG.md +65 -1
- package/docs/CONTRIBUTING.md +1 -0
- package/docs/ROADMAP.md +2 -2
- package/docs/TODO.md +6 -5
- package/examples/bank.deva +2 -4
- package/examples/function.deva +15 -0
- package/examples/index.deva +25 -14
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +6 -6
- package/project-version.json +3 -3
- package/rust/cli/bank.rs +2 -1
- package/rust/cli/build.rs +76 -14
- package/rust/cli/check.rs +71 -8
- package/rust/cli/driver.rs +40 -28
- package/rust/cli/install.rs +22 -7
- package/rust/cli/login.rs +134 -0
- package/rust/cli/mod.rs +2 -1
- package/rust/cli/play.rs +45 -20
- package/rust/common/api.rs +8 -0
- package/rust/common/cdn.rs +2 -5
- package/rust/common/mod.rs +3 -1
- package/rust/common/sso.rs +8 -0
- package/rust/config/driver.rs +19 -1
- package/rust/config/loader.rs +56 -10
- package/rust/core/audio/engine.rs +254 -91
- package/rust/core/audio/interpreter/arrow_call.rs +34 -15
- package/rust/core/audio/interpreter/call.rs +72 -47
- package/rust/core/audio/interpreter/condition.rs +14 -12
- package/rust/core/audio/interpreter/driver.rs +90 -128
- package/rust/core/audio/interpreter/function.rs +21 -0
- package/rust/core/audio/interpreter/load.rs +1 -1
- package/rust/core/audio/interpreter/loop_.rs +24 -18
- package/rust/core/audio/interpreter/mod.rs +2 -1
- package/rust/core/audio/interpreter/sleep.rs +0 -6
- package/rust/core/audio/interpreter/spawn.rs +78 -60
- package/rust/core/audio/interpreter/trigger.rs +157 -70
- package/rust/core/audio/loader/trigger.rs +37 -4
- package/rust/core/audio/player.rs +20 -10
- package/rust/core/audio/renderer.rs +24 -25
- package/rust/core/builder/mod.rs +11 -6
- package/rust/core/debugger/mod.rs +2 -0
- package/rust/core/debugger/module.rs +47 -0
- package/rust/core/debugger/store.rs +25 -11
- package/rust/core/error/mod.rs +6 -0
- package/rust/core/lexer/handler/driver.rs +23 -1
- package/rust/core/lexer/handler/identifier.rs +1 -0
- package/rust/core/lexer/handler/indent.rs +16 -2
- package/rust/core/lexer/handler/mod.rs +1 -0
- package/rust/core/lexer/handler/parenthesis.rs +41 -0
- package/rust/core/lexer/token.rs +4 -0
- package/rust/core/mod.rs +2 -1
- package/rust/core/parser/driver.rs +47 -4
- package/rust/core/parser/handler/arrow_call.rs +78 -18
- package/rust/core/parser/handler/bank.rs +35 -7
- package/rust/core/parser/handler/dot.rs +81 -123
- package/rust/core/parser/handler/identifier/call.rs +69 -22
- package/rust/core/parser/handler/identifier/function.rs +92 -0
- package/rust/core/parser/handler/identifier/let_.rs +13 -19
- package/rust/core/parser/handler/identifier/mod.rs +1 -0
- package/rust/core/parser/handler/identifier/spawn.rs +74 -27
- package/rust/core/parser/statement.rs +16 -4
- package/rust/core/plugin/loader.rs +48 -0
- package/rust/core/plugin/mod.rs +1 -0
- package/rust/core/preprocessor/loader.rs +50 -32
- package/rust/core/preprocessor/module.rs +3 -1
- package/rust/core/preprocessor/processor.rs +26 -1
- package/rust/core/preprocessor/resolver/call.rs +61 -84
- package/rust/core/preprocessor/resolver/condition.rs +11 -6
- package/rust/core/preprocessor/resolver/driver.rs +52 -6
- package/rust/core/preprocessor/resolver/function.rs +78 -0
- package/rust/core/preprocessor/resolver/group.rs +43 -13
- package/rust/core/preprocessor/resolver/let_.rs +7 -10
- package/rust/core/preprocessor/resolver/mod.rs +2 -1
- package/rust/core/preprocessor/resolver/spawn.rs +64 -30
- package/rust/core/preprocessor/resolver/trigger.rs +7 -3
- package/rust/core/preprocessor/resolver/value.rs +10 -1
- package/rust/core/shared/value.rs +4 -1
- package/rust/core/store/function.rs +34 -0
- package/rust/core/store/global.rs +9 -10
- package/rust/core/store/mod.rs +2 -1
- package/rust/core/store/variable.rs +6 -0
- package/rust/installer/addon.rs +80 -0
- package/rust/installer/bank.rs +24 -14
- package/rust/installer/mod.rs +4 -1
- package/rust/installer/plugin.rs +55 -0
- package/rust/lib.rs +10 -7
- package/rust/main.rs +32 -9
- package/rust/utils/logger.rs +16 -0
- package/rust/utils/mod.rs +45 -1
- package/rust/utils/spinner.rs +2 -4
package/.devalang
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
[defaults]
|
|
2
|
-
entry = "./examples"
|
|
3
|
-
output = "./output"
|
|
4
|
-
watch = false
|
|
5
|
-
|
|
6
|
-
[[banks]]
|
|
7
|
-
path = "devalang://bank/808"
|
|
8
|
-
version = "0.0.
|
|
9
|
-
author = "devaloop"
|
|
1
|
+
[defaults]
|
|
2
|
+
entry = "./examples"
|
|
3
|
+
output = "./output"
|
|
4
|
+
watch = false
|
|
5
|
+
|
|
6
|
+
[[banks]]
|
|
7
|
+
path = "devalang://bank/devaloop.808"
|
|
8
|
+
version = "0.0.2"
|
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.14"
|
|
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"
|
|
@@ -20,7 +20,7 @@ required-features = ["cli"]
|
|
|
20
20
|
|
|
21
21
|
[lib]
|
|
22
22
|
path = "rust/lib.rs"
|
|
23
|
-
crate-type = ["cdylib"]
|
|
23
|
+
crate-type = ["cdylib", "rlib"]
|
|
24
24
|
|
|
25
25
|
[profile.release]
|
|
26
26
|
opt-level = "s"
|
|
@@ -50,4 +50,9 @@ js-sys = "0.3"
|
|
|
50
50
|
reqwest = { version = "0.12.22", optional = true, features = ["json"] }
|
|
51
51
|
flate2 = { version = "1.0", optional = true }
|
|
52
52
|
tokio = { version = "1", features = ["full"], optional = true }
|
|
53
|
-
zip = { version = "4.3.0", optional = true }
|
|
53
|
+
zip = { version = "4.3.0", optional = true }
|
|
54
|
+
rayon = "1.10.0"
|
|
55
|
+
webbrowser = "0.8"
|
|
56
|
+
tiny_http = "0.9.0"
|
|
57
|
+
dirs = "5"
|
|
58
|
+
urlencoding = "2.1"
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://devalang.com/images/devalang-logo
|
|
2
|
+
<img src="https://devalang.com/images/devalang-logo.svg" alt="Devalang Logo" width="300" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|

|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|

|
|
8
8
|
|
|
9
9
|

|
|
10
|
-

|
|
11
11
|

|
|
12
12
|

|
|
13
13
|
|
|
@@ -16,26 +16,20 @@
|
|
|
16
16
|
|
|
17
17
|
[](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode)
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
Compose music with code — structured, expressive, and fast.
|
|
19
|
+
# 🦊 Devalang (CORE) — Compose music with code
|
|
22
20
|
|
|
23
21
|
Devalang is a tiny domain-specific language (DSL) for music makers, sound designers, and audio hackers.
|
|
24
22
|
Compose loops, control samples, render and play audio — all in clean, readable text.
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
Whether you're building a track, shaping textures, or performing live, Devalang helps you think in rhythms. It’s designed to be simple, expressive, and fast — because your ideas shouldn’t wait.
|
|
27
25
|
|
|
28
26
|
From studio sketches to live sets, Devalang gives you rhythmic control — with the elegance of code.
|
|
29
27
|
|
|
30
|
-
> 🚧
|
|
31
|
-
>
|
|
32
|
-
> NEW: Devalang is available in your browser at [playground.devalang.com](https://playground.devalang.com) !
|
|
33
|
-
>
|
|
34
|
-
> NEW: Online documentation is now available at [docs.devalang.com](https://docs.devalang.com)
|
|
28
|
+
> 🚧 Alpha Notice 🚧
|
|
35
29
|
>
|
|
36
30
|
> Includes synthesis, playback, and rendering features, but is still in early development.
|
|
37
31
|
>
|
|
38
|
-
> Currently, Devalang CLI is only available for **Windows**.
|
|
32
|
+
> Currently, Devalang CLI is only available for **Windows**.
|
|
39
33
|
> Linux and macOS binaries will be added in future releases via cross-platform builds.
|
|
40
34
|
|
|
41
35
|
## 📚 Quick Access
|
|
@@ -51,7 +45,11 @@ From studio sketches to live sets, Devalang gives you rhythmic control — with
|
|
|
51
45
|
|
|
52
46
|
## ⏱️ Try it now !
|
|
53
47
|
|
|
54
|
-
###
|
|
48
|
+
### Try Devalang in your browser
|
|
49
|
+
|
|
50
|
+
> Have a look at the [Playground](https://playground.devalang.com) to try Devalang directly in your browser
|
|
51
|
+
|
|
52
|
+
### Try Devalang CLI
|
|
55
53
|
|
|
56
54
|
```bash
|
|
57
55
|
# Install Devalang CLI globally
|
|
@@ -68,10 +66,23 @@ Create a new Devalang file `src/index.deva` in the project directory:
|
|
|
68
66
|
# src/index.deva
|
|
69
67
|
|
|
70
68
|
group myLead:
|
|
71
|
-
let mySynth = synth sine
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
let mySynth = synth sine {
|
|
70
|
+
attack: 0,
|
|
71
|
+
decay: 100,
|
|
72
|
+
sustain: 100,
|
|
73
|
+
release: 100
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
mySynth -> note(C4, {
|
|
77
|
+
duration: 400,
|
|
78
|
+
velocity: 0.7,
|
|
79
|
+
glide: true
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
mySynth -> note(G4, {
|
|
83
|
+
duration: 600,
|
|
84
|
+
slide: true
|
|
85
|
+
})
|
|
75
86
|
|
|
76
87
|
# Play the lead
|
|
77
88
|
|
|
@@ -95,19 +106,19 @@ devalang play --repeat
|
|
|
95
106
|
|
|
96
107
|
> For more examples, check out the [examples directory](./examples/).
|
|
97
108
|
|
|
98
|
-
## ❓ Why Devalang?
|
|
109
|
+
## ❓ Why Devalang ?
|
|
99
110
|
|
|
100
|
-
- 🎹 Prototype audio ideas without opening a DAW
|
|
111
|
+
- 🎹 Prototype audio ideas without opening a DAW, even VSCode
|
|
101
112
|
- 💻 Integrate sound into code-based workflows
|
|
102
113
|
- 🎛️ Control audio parameters through readable syntax
|
|
103
114
|
- 🧪 Build musical logic with variables and conditions
|
|
104
|
-
|
|
105
|
-
> Producer, coder, or both — Devalang gives you musical structure, instantly.
|
|
115
|
+
- 🔄 Create complex patterns with ease
|
|
106
116
|
|
|
107
117
|
## 🚀 Features
|
|
108
118
|
|
|
109
119
|
- 🎵 **Audio Engine**: Integrated audio playback and rendering
|
|
110
120
|
- 🧩 **Module system** for importing and exporting variables between files
|
|
121
|
+
- 📦 **Addon manager** for managing external banks, plugins and more
|
|
111
122
|
- 📜 **Structured AST** generation for debugging and future compilation
|
|
112
123
|
- 🔢 **Basic data types**: strings, numbers, booleans, maps, arrays
|
|
113
124
|
- 👁️ **Watch mode** for `build`, `check` and `play` commands
|
|
@@ -119,22 +130,9 @@ devalang play --repeat
|
|
|
119
130
|
|
|
120
131
|
### Please refer to the [online documentation](https://docs.devalang.com) for detailed information on syntax, features, and usage examples.
|
|
121
132
|
|
|
122
|
-
## 📜 Changelog Highlights
|
|
123
|
-
|
|
124
|
-
For a complete list of changes, see [docs/CHANGELOG.md](./docs/CHANGELOG.md)
|
|
125
|
-
|
|
126
|
-
- Implemented beat durations in `triggers` and `arrow_calls` statements
|
|
127
|
-
- Implemented `bank` resolver to resolve banks of sounds in the code
|
|
128
|
-
- Support for namespaced banks of sounds (e.g. `.808.myTrigger`)
|
|
129
|
-
- Implemented multiple commands for `bank` management
|
|
130
|
-
- `bank list`, `bank available`, `bank info <bank_name>`, `bank remove <bank_name>`, `bank update`, `bank update <bank_name>`
|
|
131
|
-
- Implemented `install` command to install banks of sounds
|
|
132
|
-
- `install bank <bank_name>`
|
|
133
|
-
|
|
134
133
|
## 🧯 Known issues
|
|
135
134
|
|
|
136
135
|
- No smart modules yet, all groups, variables, and samples must be explicitly imported where used
|
|
137
|
-
- No support yet for `pattern`, `function`, ... statements
|
|
138
136
|
- No support yet for cross-platform builds (Linux, macOS)
|
|
139
137
|
|
|
140
138
|
## 🧪 Roadmap Highlights
|
|
@@ -154,6 +152,10 @@ MIT — see [LICENSE](./LICENSE)
|
|
|
154
152
|
Contributions, bug reports and suggestions are welcome !
|
|
155
153
|
Feel free to open an issue or submit a pull request.
|
|
156
154
|
|
|
155
|
+
For more info, see [docs/CONTRIBUTING.md](./docs/CONTRIBUTING.md).
|
|
156
|
+
|
|
157
157
|
## 📢 Contact
|
|
158
158
|
|
|
159
|
+
Feel free to reach out for any inquiries or feedback.
|
|
160
|
+
|
|
159
161
|
📧 [contact@devaloop.com](mailto:contact@devaloop.com)
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,73 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://devalang.com/images/devalang-logo
|
|
2
|
+
<img src="https://devalang.com/images/devalang-logo.svg" alt="Devalang Logo" width="300" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## Version 0.0.1-alpha.14 (2025-08-24)
|
|
8
|
+
|
|
9
|
+
### 🌎 Ecosystem
|
|
10
|
+
|
|
11
|
+
- Deployed "SSO" (Single Sign-On) for user authentication. [(https://sso.devalang.com)](https://sso.devalang.com) when using `devalang login`.
|
|
12
|
+
|
|
13
|
+
### 🧩 Language Features
|
|
14
|
+
|
|
15
|
+
- Added support for ADSR envelopes in synthesizers.
|
|
16
|
+
- Example: `let mySynth = synth sine { attack: 0, decay: 50, sustain: 100, release: 50 }`
|
|
17
|
+
- Added support for `note` parameters in synthesizers.
|
|
18
|
+
- Example: `mySynth -> note(C4, { duration: 500, velocity: 0.8, glide: true, slide: false })`
|
|
19
|
+
|
|
20
|
+
### 🧠 Core Engine
|
|
21
|
+
|
|
22
|
+
- Patched banks resolution with improved namespace handling. (declaring `bank <bank_author>.<bank_name>` and using `.<bank_name>.<bank_trigger>`)
|
|
23
|
+
- Patched `arrow_call` to correctly handle argument parsing and improve error reporting.
|
|
24
|
+
- Implemented multi-line argument parsing for `arrow_call`.
|
|
25
|
+
- Patched execution of `arrow_call` to ensure correct timing and execution order.
|
|
26
|
+
- Upgraded indent lexer to handle multi-line statements and improve indentation handling.
|
|
27
|
+
- Upgraded `parse_map_value` to handle multi-line values and improve parsing logic in Parser.
|
|
28
|
+
- Added `log_message_with_trace` function to log messages with informations when running commands with `debug` flag.
|
|
29
|
+
|
|
30
|
+
### 🧰 Commands
|
|
31
|
+
|
|
32
|
+
- Added `login` command to authenticate users to install protected or private packages.
|
|
33
|
+
- Refactored `install` command to support installing banks, presets and plugins.
|
|
34
|
+
- `install bank <bank_author>.<bank_name>` to install a specific bank of sounds.
|
|
35
|
+
- `install preset <preset_author>.<preset_name>` to install a specific preset.
|
|
36
|
+
- `install plugin <plugin_author>.<plugin_name>` to install a specific plugin.
|
|
37
|
+
- Implemented `debug` and `compress` arguments for `build`, `check` and `play` commands.
|
|
38
|
+
- `build --debug` to build the AST with debug information.
|
|
39
|
+
- `check --debug` to check the syntax with debug information.
|
|
40
|
+
- `play --debug` to play the audio with debug information.
|
|
41
|
+
- `build --compress` to compress the output.
|
|
42
|
+
- `check --compress` to compress the output.
|
|
43
|
+
- `play --compress` to compress the output.
|
|
44
|
+
|
|
45
|
+
## Version 0.0.1-alpha.13 (2025-07-26)
|
|
46
|
+
|
|
47
|
+
### 🧩 Language Features
|
|
48
|
+
|
|
49
|
+
- Added support for `fn` directive to define functions in Devalang.
|
|
50
|
+
- Example: `fn myFunction(param1, param2):`
|
|
51
|
+
|
|
52
|
+
### 🧠 Core Engine
|
|
53
|
+
|
|
54
|
+
- Patched `trigger`, `call`, and `spawn`, `renderer` to handle correct cursor time in the audio interpreter.
|
|
55
|
+
- Refactored audio engine and interpreter to handle correct timing and execution while using `loop`, `call`, and `spawn` statements.
|
|
56
|
+
- Refactored `trigger` effects to apply more effects to triggers.
|
|
57
|
+
- Example: `.myTrigger auto { reverb: 0.25, pitch: 0.75, gain: 0.8 }`
|
|
58
|
+
- Refactored `preprocessor` to handle correct namespaced banks of sounds and triggers.
|
|
59
|
+
- Refactored `collect_errors_recursively` to provide detailed error reporting across nested statements.
|
|
60
|
+
- Optimized the `renderer` to handle silent buffers and improve performance.
|
|
61
|
+
|
|
62
|
+
### 🛠️ Utilities
|
|
63
|
+
|
|
64
|
+
- Added the `extract_loop_body_statements` utility for better loop handling.
|
|
65
|
+
- Improved logging for module variables and functions.
|
|
66
|
+
|
|
67
|
+
### 🧩 Web Assembly
|
|
68
|
+
|
|
69
|
+
- Patched `lib.rs` dependencies to ensure compatibility with the latest Rust and WASM standards.
|
|
70
|
+
|
|
7
71
|
## Version 0.0.1-alpha.12 (2025-07-21)
|
|
8
72
|
|
|
9
73
|
### 🧩 Language Features
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# This file is a placeholder
|
package/docs/ROADMAP.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
2
|
+
<img src="https://devalang.com/images/devalang-logo.svg" alt="Devalang Logo" width="300" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
# Roadmap
|
|
@@ -8,7 +8,7 @@ Devalang is a work in progress. Here’s what we’re planning next:
|
|
|
8
8
|
|
|
9
9
|
## Completed
|
|
10
10
|
|
|
11
|
-
- ✅ **Audio engine**: Integrate the audio engine for sound playback.
|
|
11
|
+
- ✅ **Audio engine**: Integrate the audio engine for sound playback.
|
|
12
12
|
- ✅ **Basic syntax**: Implement the core syntax for Devalang, including data types and basic statements.
|
|
13
13
|
- ✅ **Watch mode**: Add a watch mode to automatically rebuild on file changes.
|
|
14
14
|
- ✅ **Module system**: Add support for importing and exporting variables between files using `@import` and `@export`.
|
package/docs/TODO.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://devalang.com/images/devalang-logo
|
|
2
|
+
<img src="https://devalang.com/images/devalang-logo.svg" alt="Devalang Logo" width="300" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
# TODOs list
|
|
@@ -17,15 +17,16 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
17
17
|
- [x] Implement template info
|
|
18
18
|
- [x] Checking
|
|
19
19
|
- [x] Implement watch mode
|
|
20
|
-
- [
|
|
20
|
+
- [x] Implement debug mode
|
|
21
21
|
- [ ] Implement compilation mode
|
|
22
22
|
- [x] Building
|
|
23
23
|
- [x] Implement watch mode
|
|
24
|
-
- [
|
|
24
|
+
- [x] Implement debug mode
|
|
25
25
|
- [ ] Implement compilation mode
|
|
26
|
-
- [
|
|
26
|
+
- [x] Implement compression mode
|
|
27
27
|
- [x] Play
|
|
28
28
|
- [x] Implement Audio Engine
|
|
29
|
+
- [x] Implement debug mode
|
|
29
30
|
- [x] Implement loop mode
|
|
30
31
|
|
|
31
32
|
## Core components
|
|
@@ -44,7 +45,7 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
44
45
|
- [x] @export
|
|
45
46
|
- [x] @load
|
|
46
47
|
- [ ] @include
|
|
47
|
-
- [
|
|
48
|
+
- [x] function
|
|
48
49
|
- [ ] pattern
|
|
49
50
|
- [x] group
|
|
50
51
|
- [x] call
|
package/examples/bank.deva
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# This file demonstrates the use of main features in Devalang.
|
|
2
|
+
bpm 135
|
|
3
|
+
|
|
4
|
+
bank 808
|
|
5
|
+
|
|
6
|
+
let entityTest1 = .808.kick auto
|
|
7
|
+
let entityTest2 = .808.clap auto
|
|
8
|
+
let entityTest3 = .808.snare auto
|
|
9
|
+
|
|
10
|
+
fn myFirstGroup(entity1, entity2, entity3):
|
|
11
|
+
.entity1
|
|
12
|
+
.entity2
|
|
13
|
+
.entity3
|
|
14
|
+
|
|
15
|
+
call myFirstGroup(entityTest1, entityTest2, entityTest3)
|
package/examples/index.deva
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
# This
|
|
1
|
+
# This example demonstrates how to create a custom synth and use it in a group with notes.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
@import { myLead } from "./synth.deva"
|
|
5
|
-
@import { myLoop } from "./loop.deva"
|
|
3
|
+
bpm 135
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let customSynth = synth sine {
|
|
6
|
+
attack: 0,
|
|
7
|
+
decay: 100,
|
|
8
|
+
sustain: 50,
|
|
9
|
+
release: 200,
|
|
10
|
+
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
group mySynthGroup:
|
|
13
|
+
customSynth -> note(C4, {
|
|
14
|
+
duration: 1000,
|
|
15
|
+
glide: true,
|
|
16
|
+
velocity: 0.8
|
|
17
|
+
})
|
|
18
|
+
customSynth -> note(E3, {
|
|
19
|
+
duration: 1000,
|
|
20
|
+
glide: true,
|
|
21
|
+
velocity: 0.5
|
|
22
|
+
})
|
|
23
|
+
customSynth -> note(D3, {
|
|
24
|
+
duration: 1000,
|
|
25
|
+
glide: true,
|
|
26
|
+
velocity: 0.6
|
|
27
|
+
})
|
|
11
28
|
|
|
12
|
-
|
|
13
|
-
# spawn myLoop
|
|
14
|
-
# spawn myLead
|
|
15
|
-
|
|
16
|
-
# call myTrack
|
|
17
|
-
|
|
18
|
-
.kickCustom duration { gain: 1, pitch: 1.25 }
|
|
29
|
+
spawn mySynthGroup
|
package/out-tsc/bin/devalang.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devaloop/devalang",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.14",
|
|
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
|
"main": "out-tsc/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"devalang": "./out-tsc/bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"rust:dev:
|
|
13
|
-
"rust:dev:
|
|
14
|
-
"rust:dev:play": "cargo run play --entry examples --output output --repeat",
|
|
11
|
+
"rust:dev:build": "cargo run build --entry examples --output output --debug",
|
|
12
|
+
"rust:dev:check": "cargo run check --entry examples --output output --debug",
|
|
13
|
+
"rust:dev:play": "cargo run play --entry examples --output output --repeat --debug",
|
|
15
14
|
"rust:wasm:web": "wasm-pack build --target=web --no-default-features",
|
|
16
15
|
"rust:wasm:node": "wasm-pack build --target=nodejs --no-default-features",
|
|
17
16
|
"script:postbuild": "tsc && node out-tsc/scripts/postbuild.js",
|
|
18
|
-
"script:version:bump": "tsc && node out-tsc/scripts/version/index.js"
|
|
17
|
+
"script:version:bump": "tsc && node out-tsc/scripts/version/index.js",
|
|
18
|
+
"prepublish": "cargo build --release && npm run script:postbuild"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://devalang.com",
|
|
21
21
|
"keywords": [
|
package/project-version.json
CHANGED
package/rust/cli/bank.rs
CHANGED
|
@@ -398,6 +398,7 @@ async fn list_installed_banks() -> Result<Vec<BankFile>, String> {
|
|
|
398
398
|
return Ok(banks); // No banks installed
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
// TODO: Verify installed banks in files
|
|
401
402
|
// let installed_banks = std::fs
|
|
402
403
|
// ::read_dir(bank_dir)
|
|
403
404
|
// .map_err(|e| format!("Failed to read bank directory: {}", e))?;
|
|
@@ -416,7 +417,7 @@ async fn list_installed_banks() -> Result<Vec<BankFile>, String> {
|
|
|
416
417
|
);
|
|
417
418
|
}
|
|
418
419
|
|
|
419
|
-
let
|
|
420
|
+
let config = load_config(Some(&config_path)).ok_or_else(||
|
|
420
421
|
format!("Failed to load config from '{}'", config_path.display())
|
|
421
422
|
)?;
|
|
422
423
|
|
package/rust/cli/build.rs
CHANGED
|
@@ -4,8 +4,9 @@ use crate::{
|
|
|
4
4
|
builder::Builder,
|
|
5
5
|
debugger::{
|
|
6
6
|
lexer::write_lexer_log_file,
|
|
7
|
+
module::{ write_module_function_log_file, write_module_variable_log_file },
|
|
7
8
|
preprocessor::write_preprocessor_log_file,
|
|
8
|
-
store::
|
|
9
|
+
store::{ write_function_log_file, write_variables_log_file },
|
|
9
10
|
},
|
|
10
11
|
preprocessor::loader::ModuleLoader,
|
|
11
12
|
store::global::GlobalStore,
|
|
@@ -20,7 +21,9 @@ pub fn handle_build_command(
|
|
|
20
21
|
config: Option<Config>,
|
|
21
22
|
entry: Option<String>,
|
|
22
23
|
output: Option<String>,
|
|
23
|
-
watch: bool
|
|
24
|
+
watch: bool,
|
|
25
|
+
debug: bool,
|
|
26
|
+
compress: bool
|
|
24
27
|
) {
|
|
25
28
|
let fetched_entry = if entry.is_none() {
|
|
26
29
|
config
|
|
@@ -76,7 +79,7 @@ pub fn handle_build_command(
|
|
|
76
79
|
|
|
77
80
|
// SECTION Begin build
|
|
78
81
|
if fetched_watch {
|
|
79
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
82
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
80
83
|
|
|
81
84
|
logger.log_message(
|
|
82
85
|
LogLevel::Watcher,
|
|
@@ -86,14 +89,14 @@ pub fn handle_build_command(
|
|
|
86
89
|
watch_directory(entry_file.clone(), move || {
|
|
87
90
|
logger.log_message(LogLevel::Watcher, "Detected changes, re-building...");
|
|
88
91
|
|
|
89
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
92
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
90
93
|
}).unwrap();
|
|
91
94
|
} else {
|
|
92
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
95
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
fn begin_build(entry: String, output: String) {
|
|
99
|
+
fn begin_build(entry: String, output: String, debug: bool, compress: bool) {
|
|
97
100
|
let spinner = with_spinner("Building...", || {
|
|
98
101
|
thread::sleep(Duration::from_millis(800));
|
|
99
102
|
});
|
|
@@ -111,27 +114,86 @@ fn begin_build(entry: String, output: String) {
|
|
|
111
114
|
let (modules_tokens, modules_statements) = module_loader.load_all_modules(&mut global_store);
|
|
112
115
|
|
|
113
116
|
// SECTION Write logs
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
if debug {
|
|
118
|
+
for (module_path, module) in global_store.modules.clone() {
|
|
119
|
+
write_module_variable_log_file(
|
|
120
|
+
&normalized_output_dir,
|
|
121
|
+
&module_path,
|
|
122
|
+
&module.variable_table
|
|
123
|
+
);
|
|
124
|
+
write_module_function_log_file(
|
|
125
|
+
&normalized_output_dir,
|
|
126
|
+
&module_path,
|
|
127
|
+
&module.function_table
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
write_lexer_log_file(&normalized_output_dir, "lexer_tokens.log", modules_tokens.clone());
|
|
132
|
+
write_preprocessor_log_file(
|
|
133
|
+
&normalized_output_dir,
|
|
134
|
+
"resolved_statements.log",
|
|
135
|
+
modules_statements.clone()
|
|
136
|
+
);
|
|
137
|
+
write_variables_log_file(
|
|
138
|
+
&normalized_output_dir,
|
|
139
|
+
"global_variables.log",
|
|
140
|
+
global_store.variables.clone()
|
|
141
|
+
);
|
|
142
|
+
write_function_log_file(
|
|
143
|
+
&normalized_output_dir,
|
|
144
|
+
"global_functions.log",
|
|
145
|
+
global_store.functions.clone()
|
|
146
|
+
);
|
|
147
|
+
}
|
|
121
148
|
|
|
122
149
|
// SECTION Building AST and Audio
|
|
123
150
|
let builder = Builder::new();
|
|
124
|
-
builder.build_ast(&modules_statements, &normalized_output_dir);
|
|
151
|
+
builder.build_ast(&modules_statements, &normalized_output_dir, compress);
|
|
125
152
|
builder.build_audio(&modules_statements, &normalized_output_dir, &mut global_store);
|
|
126
153
|
|
|
127
154
|
// SECTION Logging
|
|
128
155
|
let logger = Logger::new();
|
|
129
156
|
|
|
157
|
+
if debug {
|
|
158
|
+
let modules_loaded = global_store.modules
|
|
159
|
+
.iter()
|
|
160
|
+
.map(|(k, _)| k)
|
|
161
|
+
.collect::<Vec<_>>();
|
|
162
|
+
let global_variables_loaded = global_store.variables.variables.keys().collect::<Vec<_>>();
|
|
163
|
+
let global_functions_loaded = global_store.functions.functions.keys().collect::<Vec<_>>();
|
|
164
|
+
|
|
165
|
+
logger.log_message_with_trace(
|
|
166
|
+
LogLevel::Debug,
|
|
167
|
+
&format!("Modules loaded: {}", global_store.modules.len()),
|
|
168
|
+
modules_loaded
|
|
169
|
+
.iter()
|
|
170
|
+
.map(|s| s.as_str())
|
|
171
|
+
.collect()
|
|
172
|
+
);
|
|
173
|
+
logger.log_message_with_trace(
|
|
174
|
+
LogLevel::Debug,
|
|
175
|
+
&format!("Global variables: {}", global_store.variables.variables.len()),
|
|
176
|
+
global_variables_loaded
|
|
177
|
+
.iter()
|
|
178
|
+
.map(|s| s.as_str())
|
|
179
|
+
.collect()
|
|
180
|
+
);
|
|
181
|
+
logger.log_message_with_trace(
|
|
182
|
+
LogLevel::Debug,
|
|
183
|
+
&format!("Global functions: {}", global_store.functions.functions.len()),
|
|
184
|
+
global_functions_loaded
|
|
185
|
+
.iter()
|
|
186
|
+
.map(|s| s.as_str())
|
|
187
|
+
.collect()
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
130
191
|
let success_message = format!(
|
|
131
192
|
"Build completed successfully in {:.2?}. Output files written to: '{}'",
|
|
132
193
|
duration.elapsed(),
|
|
133
194
|
normalized_output_dir
|
|
134
195
|
);
|
|
135
196
|
|
|
197
|
+
spinner.finish_and_clear();
|
|
136
198
|
logger.log_message(LogLevel::Success, &success_message);
|
|
137
199
|
}
|