@devaloop/devalang 0.0.1-alpha.13 → 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 +58 -54
- package/README.md +36 -21
- package/docs/CHANGELOG.md +40 -2
- package/docs/CONTRIBUTING.md +1 -0
- package/docs/ROADMAP.md +2 -2
- package/docs/TODO.md +5 -4
- package/examples/bank.deva +2 -4
- package/examples/function.deva +15 -0
- package/examples/index.deva +25 -11
- 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 +69 -30
- package/rust/cli/check.rs +45 -5
- 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 +44 -19
- 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 +152 -42
- package/rust/core/audio/interpreter/arrow_call.rs +34 -15
- package/rust/core/audio/interpreter/call.rs +2 -2
- package/rust/core/audio/interpreter/driver.rs +19 -14
- package/rust/core/audio/interpreter/spawn.rs +2 -2
- package/rust/core/builder/mod.rs +11 -6
- package/rust/core/lexer/handler/indent.rs +16 -2
- package/rust/core/lexer/token.rs +1 -0
- package/rust/core/mod.rs +2 -1
- package/rust/core/parser/driver.rs +46 -5
- 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 +43 -22
- package/rust/core/plugin/loader.rs +48 -0
- package/rust/core/plugin/mod.rs +1 -0
- package/rust/core/preprocessor/loader.rs +6 -4
- 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/main.rs +32 -9
- package/rust/utils/logger.rs +16 -0
- 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,54 +1,58 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "devalang"
|
|
3
|
-
version = "0.0.1-alpha.
|
|
4
|
-
authors = ["Devaloop <contact@devaloop.com>"]
|
|
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
|
-
license = "MIT"
|
|
7
|
-
repository = "https://github.com/devaloop-labs/devalang"
|
|
8
|
-
keywords = ["music", "dsl", "audio", "cli"]
|
|
9
|
-
categories = ["command-line-utilities", "development-tools", "parser-implementations"]
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
homepage = "https://devalang.com"
|
|
12
|
-
documentation = "https://docs.devalang.com/"
|
|
13
|
-
license-file = "LICENSE"
|
|
14
|
-
edition = "2024"
|
|
15
|
-
|
|
16
|
-
[[bin]]
|
|
17
|
-
name = "devalang"
|
|
18
|
-
path = "rust/main.rs"
|
|
19
|
-
required-features = ["cli"]
|
|
20
|
-
|
|
21
|
-
[lib]
|
|
22
|
-
path = "rust/lib.rs"
|
|
23
|
-
crate-type = ["cdylib", "rlib"]
|
|
24
|
-
|
|
25
|
-
[profile.release]
|
|
26
|
-
opt-level = "s"
|
|
27
|
-
|
|
28
|
-
[features]
|
|
29
|
-
default = ["cli"]
|
|
30
|
-
cli = ["crossterm", "indicatif", "inquire", "zip", "reqwest", "flate2", "tokio"]
|
|
31
|
-
|
|
32
|
-
[dependencies]
|
|
33
|
-
clap = { version = "4.5", features = ["derive"] }
|
|
34
|
-
serde = { version = "1.0", features = ["derive"] }
|
|
35
|
-
serde_json = "1.0"
|
|
36
|
-
rodio = "0.17"
|
|
37
|
-
hound = "3.4.0"
|
|
38
|
-
toml = "0.8"
|
|
39
|
-
notify = "6.1"
|
|
40
|
-
fs_extra = "1.3"
|
|
41
|
-
include_dir = "0.7"
|
|
42
|
-
wasm-bindgen = "0.2"
|
|
43
|
-
serde-wasm-bindgen = "0.4"
|
|
44
|
-
nom_locate = "4.0.0"
|
|
45
|
-
chrono = "0.4"
|
|
46
|
-
crossterm = { version = "0.27", optional = true }
|
|
47
|
-
indicatif = { version = "0.17", optional = true }
|
|
48
|
-
inquire = { version = "0.7.5", optional = true }
|
|
49
|
-
js-sys = "0.3"
|
|
50
|
-
reqwest = { version = "0.12.22", optional = true, features = ["json"] }
|
|
51
|
-
flate2 = { version = "1.0", optional = true }
|
|
52
|
-
tokio = { version = "1", features = ["full"], optional = true }
|
|
53
|
-
zip = { version = "4.3.0", optional = true }
|
|
54
|
-
rayon = "1.10.0"
|
|
1
|
+
[package]
|
|
2
|
+
name = "devalang"
|
|
3
|
+
version = "0.0.1-alpha.14"
|
|
4
|
+
authors = ["Devaloop <contact@devaloop.com>"]
|
|
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
|
+
license = "MIT"
|
|
7
|
+
repository = "https://github.com/devaloop-labs/devalang"
|
|
8
|
+
keywords = ["music", "dsl", "audio", "cli"]
|
|
9
|
+
categories = ["command-line-utilities", "development-tools", "parser-implementations"]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
homepage = "https://devalang.com"
|
|
12
|
+
documentation = "https://docs.devalang.com/"
|
|
13
|
+
license-file = "LICENSE"
|
|
14
|
+
edition = "2024"
|
|
15
|
+
|
|
16
|
+
[[bin]]
|
|
17
|
+
name = "devalang"
|
|
18
|
+
path = "rust/main.rs"
|
|
19
|
+
required-features = ["cli"]
|
|
20
|
+
|
|
21
|
+
[lib]
|
|
22
|
+
path = "rust/lib.rs"
|
|
23
|
+
crate-type = ["cdylib", "rlib"]
|
|
24
|
+
|
|
25
|
+
[profile.release]
|
|
26
|
+
opt-level = "s"
|
|
27
|
+
|
|
28
|
+
[features]
|
|
29
|
+
default = ["cli"]
|
|
30
|
+
cli = ["crossterm", "indicatif", "inquire", "zip", "reqwest", "flate2", "tokio"]
|
|
31
|
+
|
|
32
|
+
[dependencies]
|
|
33
|
+
clap = { version = "4.5", features = ["derive"] }
|
|
34
|
+
serde = { version = "1.0", features = ["derive"] }
|
|
35
|
+
serde_json = "1.0"
|
|
36
|
+
rodio = "0.17"
|
|
37
|
+
hound = "3.4.0"
|
|
38
|
+
toml = "0.8"
|
|
39
|
+
notify = "6.1"
|
|
40
|
+
fs_extra = "1.3"
|
|
41
|
+
include_dir = "0.7"
|
|
42
|
+
wasm-bindgen = "0.2"
|
|
43
|
+
serde-wasm-bindgen = "0.4"
|
|
44
|
+
nom_locate = "4.0.0"
|
|
45
|
+
chrono = "0.4"
|
|
46
|
+
crossterm = { version = "0.27", optional = true }
|
|
47
|
+
indicatif = { version = "0.17", optional = true }
|
|
48
|
+
inquire = { version = "0.7.5", optional = true }
|
|
49
|
+
js-sys = "0.3"
|
|
50
|
+
reqwest = { version = "0.12.22", optional = true, features = ["json"] }
|
|
51
|
+
flate2 = { version = "1.0", optional = true }
|
|
52
|
+
tokio = { version = "1", features = ["full"], 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
|
|
@@ -141,6 +152,10 @@ MIT — see [LICENSE](./LICENSE)
|
|
|
141
152
|
Contributions, bug reports and suggestions are welcome !
|
|
142
153
|
Feel free to open an issue or submit a pull request.
|
|
143
154
|
|
|
155
|
+
For more info, see [docs/CONTRIBUTING.md](./docs/CONTRIBUTING.md).
|
|
156
|
+
|
|
144
157
|
## 📢 Contact
|
|
145
158
|
|
|
159
|
+
Feel free to reach out for any inquiries or feedback.
|
|
160
|
+
|
|
146
161
|
📧 [contact@devaloop.com](mailto:contact@devaloop.com)
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,54 @@
|
|
|
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
|
+
|
|
7
45
|
## Version 0.0.1-alpha.13 (2025-07-26)
|
|
8
46
|
|
|
9
47
|
### 🧩 Language Features
|
|
10
48
|
|
|
11
49
|
- Added support for `fn` directive to define functions in Devalang.
|
|
12
50
|
- Example: `fn myFunction(param1, param2):`
|
|
13
|
-
|
|
51
|
+
|
|
14
52
|
### 🧠 Core Engine
|
|
15
53
|
|
|
16
54
|
- Patched `trigger`, `call`, and `spawn`, `renderer` to handle correct cursor time in the audio interpreter.
|
|
@@ -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
|
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,15 +1,29 @@
|
|
|
1
|
-
# This
|
|
2
|
-
bpm 135
|
|
1
|
+
# This example demonstrates how to create a custom synth and use it in a group with notes.
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
bpm 135
|
|
5
4
|
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let customSynth = synth sine {
|
|
6
|
+
attack: 0,
|
|
7
|
+
decay: 100,
|
|
8
|
+
sustain: 50,
|
|
9
|
+
release: 200,
|
|
10
|
+
}
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
})
|
|
14
28
|
|
|
15
|
-
|
|
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
|
@@ -21,7 +21,9 @@ pub fn handle_build_command(
|
|
|
21
21
|
config: Option<Config>,
|
|
22
22
|
entry: Option<String>,
|
|
23
23
|
output: Option<String>,
|
|
24
|
-
watch: bool
|
|
24
|
+
watch: bool,
|
|
25
|
+
debug: bool,
|
|
26
|
+
compress: bool
|
|
25
27
|
) {
|
|
26
28
|
let fetched_entry = if entry.is_none() {
|
|
27
29
|
config
|
|
@@ -77,7 +79,7 @@ pub fn handle_build_command(
|
|
|
77
79
|
|
|
78
80
|
// SECTION Begin build
|
|
79
81
|
if fetched_watch {
|
|
80
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
82
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
81
83
|
|
|
82
84
|
logger.log_message(
|
|
83
85
|
LogLevel::Watcher,
|
|
@@ -87,14 +89,14 @@ pub fn handle_build_command(
|
|
|
87
89
|
watch_directory(entry_file.clone(), move || {
|
|
88
90
|
logger.log_message(LogLevel::Watcher, "Detected changes, re-building...");
|
|
89
91
|
|
|
90
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
92
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
91
93
|
}).unwrap();
|
|
92
94
|
} else {
|
|
93
|
-
begin_build(entry_file.clone(), fetched_output.clone());
|
|
95
|
+
begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
fn begin_build(entry: String, output: String) {
|
|
99
|
+
fn begin_build(entry: String, output: String, debug: bool, compress: bool) {
|
|
98
100
|
let spinner = with_spinner("Building...", || {
|
|
99
101
|
thread::sleep(Duration::from_millis(800));
|
|
100
102
|
});
|
|
@@ -112,49 +114,86 @@ fn begin_build(entry: String, output: String) {
|
|
|
112
114
|
let (modules_tokens, modules_statements) = module_loader.load_all_modules(&mut global_store);
|
|
113
115
|
|
|
114
116
|
// SECTION Write logs
|
|
115
|
-
|
|
116
|
-
|
|
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(
|
|
117
133
|
&normalized_output_dir,
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
"resolved_statements.log",
|
|
135
|
+
modules_statements.clone()
|
|
120
136
|
);
|
|
121
|
-
|
|
137
|
+
write_variables_log_file(
|
|
122
138
|
&normalized_output_dir,
|
|
123
|
-
|
|
124
|
-
|
|
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()
|
|
125
146
|
);
|
|
126
147
|
}
|
|
127
148
|
|
|
128
|
-
write_lexer_log_file(&normalized_output_dir, "lexer_tokens.log", modules_tokens.clone());
|
|
129
|
-
write_preprocessor_log_file(
|
|
130
|
-
&normalized_output_dir,
|
|
131
|
-
"resolved_statements.log",
|
|
132
|
-
modules_statements.clone()
|
|
133
|
-
);
|
|
134
|
-
write_variables_log_file(
|
|
135
|
-
&normalized_output_dir,
|
|
136
|
-
"global_variables.log",
|
|
137
|
-
global_store.variables.clone()
|
|
138
|
-
);
|
|
139
|
-
write_function_log_file(
|
|
140
|
-
&normalized_output_dir,
|
|
141
|
-
"global_functions.log",
|
|
142
|
-
global_store.functions.clone()
|
|
143
|
-
);
|
|
144
|
-
|
|
145
149
|
// SECTION Building AST and Audio
|
|
146
150
|
let builder = Builder::new();
|
|
147
|
-
builder.build_ast(&modules_statements, &normalized_output_dir);
|
|
151
|
+
builder.build_ast(&modules_statements, &normalized_output_dir, compress);
|
|
148
152
|
builder.build_audio(&modules_statements, &normalized_output_dir, &mut global_store);
|
|
149
153
|
|
|
150
154
|
// SECTION Logging
|
|
151
155
|
let logger = Logger::new();
|
|
152
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
|
+
|
|
153
191
|
let success_message = format!(
|
|
154
192
|
"Build completed successfully in {:.2?}. Output files written to: '{}'",
|
|
155
193
|
duration.elapsed(),
|
|
156
194
|
normalized_output_dir
|
|
157
195
|
);
|
|
158
196
|
|
|
197
|
+
spinner.finish_and_clear();
|
|
159
198
|
logger.log_message(LogLevel::Success, &success_message);
|
|
160
199
|
}
|