@devaloop/devalang 0.0.1-alpha.3 β 0.0.1-alpha.5
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 +1 -1
- package/Cargo.toml +9 -7
- package/README.md +49 -25
- package/docs/CHANGELOG.md +30 -0
- package/docs/COMMANDS.md +31 -0
- package/docs/CONFIG.md +6 -4
- package/docs/ROADMAP.md +4 -4
- package/docs/TODO.md +4 -4
- package/examples/index.deva +9 -2
- package/examples/samples/hat-808.wav +0 -0
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +44 -42
- package/project-version.json +6 -6
- package/rust/audio/engine.rs +126 -0
- package/rust/audio/interpreter.rs +143 -0
- package/rust/audio/loader.rs +46 -0
- package/rust/audio/mod.rs +5 -0
- package/rust/audio/player.rs +54 -0
- package/rust/audio/render.rs +57 -0
- package/rust/cli/build.rs +17 -5
- package/rust/cli/check.rs +2 -1
- package/rust/cli/init.rs +4 -2
- package/rust/cli/mod.rs +29 -0
- package/rust/cli/play.rs +192 -0
- package/rust/cli/template.rs +2 -1
- package/rust/config/loader.rs +0 -1
- package/rust/config/mod.rs +3 -2
- package/rust/core/builder/mod.rs +54 -6
- package/rust/core/debugger/lexer.rs +20 -5
- package/rust/core/debugger/preprocessor.rs +9 -5
- package/rust/core/lexer/handler/mod.rs +2 -2
- package/rust/core/lexer/handler/newline.rs +5 -1
- package/rust/core/lexer/mod.rs +10 -5
- package/rust/core/parser/handler/loop_.rs +11 -0
- package/rust/core/parser/mod.rs +0 -1
- package/rust/core/preprocessor/loader.rs +89 -16
- package/rust/core/preprocessor/module.rs +2 -0
- package/rust/core/preprocessor/resolver/bank.rs +46 -0
- package/rust/core/preprocessor/resolver/loop_.rs +148 -0
- package/rust/core/preprocessor/resolver/mod.rs +151 -0
- package/rust/core/preprocessor/resolver/tempo.rs +49 -0
- package/rust/core/preprocessor/resolver/trigger.rs +114 -0
- package/rust/lib.rs +118 -0
- package/rust/main.rs +8 -0
- package/rust/utils/logger.rs +45 -6
- package/rust/utils/spinner.rs +2 -0
- package/rust/utils/watcher.rs +10 -2
- package/templates/minimal/.devalang +2 -1
- package/templates/minimal/README.md +202 -0
- package/templates/welcome/.devalang +2 -1
- package/templates/welcome/README.md +48 -31
- package/rust/core/preprocessor/resolver.rs +0 -372
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://firebasestorage.googleapis.com/v0/b/devaloop-labs.firebasestorage.app/o/devalang-teal-logo.svg?alt=media&token=d2a5705a-1eba-4b49-88e6-895a761fb7f7" alt="Devalang Logo">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## πΌ Devalang, by **Devaloop Labs**
|
|
18
|
+
|
|
19
|
+
πΆ Compose music with code β simple, structured, sonic.
|
|
20
|
+
|
|
21
|
+
Devalang is a tiny domain-specific language (DSL) for music makers, sound designers, and audio hackers.
|
|
22
|
+
Compose loops, control samples, render and play audio β all in clean, readable text.
|
|
23
|
+
|
|
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.
|
|
25
|
+
|
|
26
|
+
From studio sketches to live sets, Devalang gives you rhythmic control β with the elegance of code.
|
|
27
|
+
|
|
28
|
+
> π§ **v0.0.1-alpha.5 Notice** π§
|
|
29
|
+
>
|
|
30
|
+
> Currently, Devalang CLI is only available for **Windows**.
|
|
31
|
+
> Linux and macOS binaries will be added in future releases via cross-platform builds.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## π Quick Access
|
|
36
|
+
|
|
37
|
+
- [π Documentation](./docs/)
|
|
38
|
+
- [π‘ Examples](./examples/)
|
|
39
|
+
- [π Project Website](https://devalang.com)
|
|
40
|
+
|
|
41
|
+
## π Features
|
|
42
|
+
|
|
43
|
+
- π΅ **Audio Engine**: Integrated audio playback and rendering
|
|
44
|
+
- π§© **Module system** for importing and exporting variables between files
|
|
45
|
+
- π **Structured AST** generation for debugging and future compilation
|
|
46
|
+
- π’ **Basic data types**: strings, numbers, booleans, maps, arrays
|
|
47
|
+
- ποΈ **Watch mode** for `build`, `check` and `play` commands
|
|
48
|
+
- π **Project templates** for quick setup
|
|
49
|
+
|
|
50
|
+
## π Installation
|
|
51
|
+
|
|
52
|
+
### For users
|
|
53
|
+
|
|
54
|
+
> - β οΈ Requires [Node.js 18+](https://nodejs.org/en/download)
|
|
55
|
+
|
|
56
|
+
Install the package globally (NPM)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g @devaloop/devalang
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Usage without install (NPX)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx @devaloop/devalang <command>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### For contributors
|
|
69
|
+
|
|
70
|
+
> - β οΈ Requires [Node.js 18+](https://nodejs.org/en/download)
|
|
71
|
+
> - β οΈ Requires [Rust 1.70+](https://www.rust-lang.org/learn/get-started#installing-rust)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
> git clone https://github.com/devaloop-labs/devalang.git
|
|
75
|
+
> cd devalang
|
|
76
|
+
> npm install
|
|
77
|
+
> cargo install --path .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Development usage (you can customize arguments in package.json)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# For syntax checking test
|
|
84
|
+
npm run rust:dev:check
|
|
85
|
+
# For building test
|
|
86
|
+
npm run rust:dev:build
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## β Usage
|
|
90
|
+
|
|
91
|
+
NOTE: Commands are available via `devalang` or `npx @devaloop/devalang`.
|
|
92
|
+
|
|
93
|
+
NOTE: Arguments can be passed to commands using `--<argument>` syntax. You can also use a configuration file to set default values for various settings, making it easier to manage your Devalang project.
|
|
94
|
+
|
|
95
|
+
NOTE: Some commands require a mandatory `--entry` argument to specify the input folder, and a `--output` argument to specify the output folder. If not specified, they default to `./src` and `./output` respectively.
|
|
96
|
+
|
|
97
|
+
For more examples, see [docs/COMMANDS.md](./docs/COMMANDS.md)
|
|
98
|
+
|
|
99
|
+
### Initialize a new project
|
|
100
|
+
|
|
101
|
+
In the current directory
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
devalang init
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or use optional arguments to specify a directory name and a template
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
devalang init --name <project-name> --template <template-name>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Checking syntax only
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
devalang check --watch
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Building output files
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
devalang build --watch
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Playing audio files (once by file change)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
devalang play --watch
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Playing audio files (continuous playback, even without file changes)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
devalang play --repeat
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## βοΈ Configuration
|
|
138
|
+
|
|
139
|
+
You can use a configuration file to set default values for various settings, making it easier to manage your Devalang project.
|
|
140
|
+
|
|
141
|
+
To do this, create a `.devalang` file in the root of your project directory.
|
|
142
|
+
|
|
143
|
+
See [docs/CONFIG.md](./docs/CONFIG.md) for more information.
|
|
144
|
+
|
|
145
|
+
## π Syntax example
|
|
146
|
+
|
|
147
|
+
For more examples, see [docs/SYNTAX.md](./docs/SYNTAX.md)
|
|
148
|
+
|
|
149
|
+
```deva
|
|
150
|
+
# index.deva
|
|
151
|
+
|
|
152
|
+
@import { globalBpm, globalBank, kickDuration } from "global.deva"
|
|
153
|
+
|
|
154
|
+
@load "./examples/samples/kick-808.wav" as customKick
|
|
155
|
+
|
|
156
|
+
bpm globalBpm
|
|
157
|
+
# Will declare the tempo at the globalBpm variable beats per minute
|
|
158
|
+
|
|
159
|
+
bank globalBank
|
|
160
|
+
# Will declare a custom instrument bank using the globalBank variable
|
|
161
|
+
|
|
162
|
+
loop 5:
|
|
163
|
+
.customKick kickDuration {reverb=50, drive=25}
|
|
164
|
+
# Will play 5 times a kick for the duration of the kickDuration variable with reverb and drive effects
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
```deva
|
|
168
|
+
# global.deva
|
|
169
|
+
|
|
170
|
+
let globalBpm = 120
|
|
171
|
+
let globalBank = 808
|
|
172
|
+
let kickDuration = 500
|
|
173
|
+
|
|
174
|
+
@export { globalBpm, globalBank, kickDuration }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## π§― Known issues
|
|
178
|
+
|
|
179
|
+
- No support yet for `if`, `else`, `else if` statements
|
|
180
|
+
- No support yet for `@group`, `@pattern`, `@function` statements
|
|
181
|
+
- No support yet for cross-platform builds (Linux, macOS)
|
|
182
|
+
|
|
183
|
+
## π§ͺ Roadmap Highlights
|
|
184
|
+
|
|
185
|
+
For more info, see [docs/ROADMAP.md](./docs/ROADMAP.md)
|
|
186
|
+
|
|
187
|
+
- β³ Other statements (e.g `if`, `@group`, ...)
|
|
188
|
+
- β³ Cross-platform support (Linux, macOS)
|
|
189
|
+
- β³ More built-in instruments (e.g. snare, hi-hat, etc.)
|
|
190
|
+
|
|
191
|
+
## π‘οΈ License
|
|
192
|
+
|
|
193
|
+
MIT β see [LICENSE](./LICENSE)
|
|
194
|
+
|
|
195
|
+
## π€ Contributing
|
|
196
|
+
|
|
197
|
+
Contributions, bug reports and suggestions are welcome !
|
|
198
|
+
Feel free to open an issue or submit a pull request.
|
|
199
|
+
|
|
200
|
+
## π’ Contact
|
|
201
|
+
|
|
202
|
+
π§ [contact@devaloop.com](mailto:contact@devaloop.com)
|
|
@@ -11,44 +11,41 @@
|
|
|
11
11
|

|
|
12
12
|

|
|
13
13
|
|
|
14
|
-

|
|
15
|
+

|
|
15
16
|
|
|
16
17
|
## πΌ Devalang, by **Devaloop Labs**
|
|
17
18
|
|
|
18
19
|
πΆ Compose music with code β simple, structured, sonic.
|
|
19
20
|
|
|
20
21
|
Devalang is a tiny domain-specific language (DSL) for music makers, sound designers, and audio hackers.
|
|
21
|
-
Compose loops, control samples, and
|
|
22
|
+
Compose loops, control samples, render and play audio β all in clean, readable text.
|
|
22
23
|
|
|
23
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.
|
|
24
25
|
|
|
25
26
|
From studio sketches to live sets, Devalang gives you rhythmic control β with the elegance of code.
|
|
26
27
|
|
|
27
|
-
> π§ **v0.0.1-alpha.
|
|
28
|
-
>
|
|
29
|
-
> Devalang is still in early development. This version does not yet include **sound rendering**.
|
|
30
|
-
>
|
|
31
|
-
> You can parse code, generate the AST, and validate syntax β all essential building blocks for the upcoming audio engine.
|
|
32
|
-
>
|
|
33
|
-
> Currently, only `.kick` is included as a built-in trigger.
|
|
34
|
-
> Custom instruments can be defined with `@load`, allowing any sound sample to be triggered with the same syntax.
|
|
28
|
+
> π§ **v0.0.1-alpha.5 Notice** π§
|
|
35
29
|
>
|
|
36
30
|
> Currently, Devalang CLI is only available for **Windows**.
|
|
37
31
|
> Linux and macOS binaries will be added in future releases via cross-platform builds.
|
|
38
32
|
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## π Quick Access
|
|
36
|
+
|
|
37
|
+
- [π Documentation](./docs/)
|
|
38
|
+
- [π‘ Examples](./examples/)
|
|
39
|
+
- [π Project Website](https://devalang.com)
|
|
40
|
+
|
|
39
41
|
## π Features
|
|
40
42
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- π Looping system with fixed repetitions (`loop 4:`)
|
|
48
|
-
- π§ͺ Instruction calls with parameters (e.g. `.kick auto {reverb:10, decay:20}`) for testing pattern syntax
|
|
49
|
-
- π `let` assignments for storing reusable values
|
|
50
|
-
- π `@load` assignment to load a sample (.mp3, .wav) to use it as a value
|
|
51
|
-
- π οΈ CLI tools for syntax checking (`check`), AST output (`build`)
|
|
43
|
+
- π΅ **Audio Engine**: Integrated audio playback and rendering
|
|
44
|
+
- π§© **Module system** for importing and exporting variables between files
|
|
45
|
+
- π **Structured AST** generation for debugging and future compilation
|
|
46
|
+
- π’ **Basic data types**: strings, numbers, booleans, maps, arrays
|
|
47
|
+
- ποΈ **Watch mode** for `build`, `check` and `play` commands
|
|
48
|
+
- π **Project templates** for quick setup
|
|
52
49
|
|
|
53
50
|
## π Installation
|
|
54
51
|
|
|
@@ -80,15 +77,23 @@ npx @devaloop/devalang <command>
|
|
|
80
77
|
> cargo install --path .
|
|
81
78
|
```
|
|
82
79
|
|
|
83
|
-
|
|
80
|
+
Development usage (you can customize arguments in package.json)
|
|
84
81
|
|
|
85
82
|
```bash
|
|
86
83
|
# For syntax checking test
|
|
87
|
-
npm run rust:dev
|
|
84
|
+
npm run rust:dev:check
|
|
85
|
+
# For building test
|
|
86
|
+
npm run rust:dev:build
|
|
88
87
|
```
|
|
89
88
|
|
|
90
89
|
## β Usage
|
|
91
90
|
|
|
91
|
+
NOTE: Commands are available via `devalang` or `npx @devaloop/devalang`.
|
|
92
|
+
|
|
93
|
+
NOTE: Arguments can be passed to commands using `--<argument>` syntax. You can also use a configuration file to set default values for various settings, making it easier to manage your Devalang project.
|
|
94
|
+
|
|
95
|
+
NOTE: Some commands require a mandatory `--entry` argument to specify the input folder, and a `--output` argument to specify the output folder. If not specified, they default to `./src` and `./output` respectively.
|
|
96
|
+
|
|
92
97
|
For more examples, see [docs/COMMANDS.md](./docs/COMMANDS.md)
|
|
93
98
|
|
|
94
99
|
### Initialize a new project
|
|
@@ -105,16 +110,28 @@ Or use optional arguments to specify a directory name and a template
|
|
|
105
110
|
devalang init --name <project-name> --template <template-name>
|
|
106
111
|
```
|
|
107
112
|
|
|
108
|
-
### Checking syntax only
|
|
113
|
+
### Checking syntax only
|
|
109
114
|
|
|
110
115
|
```bash
|
|
111
|
-
devalang check --
|
|
116
|
+
devalang check --watch
|
|
112
117
|
```
|
|
113
118
|
|
|
114
|
-
### Building output
|
|
119
|
+
### Building output files
|
|
115
120
|
|
|
116
121
|
```bash
|
|
117
|
-
devalang build --
|
|
122
|
+
devalang build --watch
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Playing audio files (once by file change)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
devalang play --watch
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Playing audio files (continuous playback, even without file changes)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
devalang play --repeat
|
|
118
135
|
```
|
|
119
136
|
|
|
120
137
|
## βοΈ Configuration
|
|
@@ -134,6 +151,8 @@ For more examples, see [docs/SYNTAX.md](./docs/SYNTAX.md)
|
|
|
134
151
|
|
|
135
152
|
@import { globalBpm, globalBank, kickDuration } from "global.deva"
|
|
136
153
|
|
|
154
|
+
@load "./examples/samples/kick-808.wav" as customKick
|
|
155
|
+
|
|
137
156
|
bpm globalBpm
|
|
138
157
|
# Will declare the tempo at the globalBpm variable beats per minute
|
|
139
158
|
|
|
@@ -141,7 +160,7 @@ bank globalBank
|
|
|
141
160
|
# Will declare a custom instrument bank using the globalBank variable
|
|
142
161
|
|
|
143
162
|
loop 5:
|
|
144
|
-
.
|
|
163
|
+
.customKick kickDuration {reverb=50, drive=25}
|
|
145
164
|
# Will play 5 times a kick for the duration of the kickDuration variable with reverb and drive effects
|
|
146
165
|
```
|
|
147
166
|
|
|
@@ -157,16 +176,14 @@ let kickDuration = 500
|
|
|
157
176
|
|
|
158
177
|
## π§― Known issues
|
|
159
178
|
|
|
160
|
-
- No support yet for Audio Engine
|
|
161
179
|
- No support yet for `if`, `else`, `else if` statements
|
|
162
180
|
- No support yet for `@group`, `@pattern`, `@function` statements
|
|
163
|
-
-
|
|
181
|
+
- No support yet for cross-platform builds (Linux, macOS)
|
|
164
182
|
|
|
165
183
|
## π§ͺ Roadmap Highlights
|
|
166
184
|
|
|
167
185
|
For more info, see [docs/ROADMAP.md](./docs/ROADMAP.md)
|
|
168
186
|
|
|
169
|
-
- β³ Audio engine integration
|
|
170
187
|
- β³ Other statements (e.g `if`, `@group`, ...)
|
|
171
188
|
- β³ Cross-platform support (Linux, macOS)
|
|
172
189
|
- β³ More built-in instruments (e.g. snare, hi-hat, etc.)
|