1.1.0 - TOML
This commit is contained in:
145
README.md
145
README.md
@ -14,47 +14,45 @@ cd music
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
## JSON Configuration
|
||||
## TOML Configuration
|
||||
|
||||
Create declaritive songs with structured JSON:
|
||||
Create declaritive songs with structured TOML:
|
||||
|
||||
```bash
|
||||
cargo run --bin musicgen json examples/fantasy.json
|
||||
cargo run --bin musicgen toml examples/enchanted.toml
|
||||
```
|
||||
|
||||
### From Binary
|
||||
```bash
|
||||
./target/release/musicgen json examples/fantasy.json
|
||||
./target/release/musicgen toml examples/enchanted.toml
|
||||
```
|
||||
|
||||
### Basic JSON Structure
|
||||
### Basic TOML Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"composition": {
|
||||
"key": 60,
|
||||
"scale": "minor",
|
||||
"tempo": 85.0,
|
||||
"measures": 16
|
||||
},
|
||||
"tracks": [
|
||||
{
|
||||
"name": "bass",
|
||||
"instrument": "sine",
|
||||
"volume": 0.8,
|
||||
"pattern": {
|
||||
"type": "custom",
|
||||
"steps": [
|
||||
{ "time": 0.0, "note": "C2", "duration": 0.75, "velocity": 0.9 }
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"export": {
|
||||
"filename": "my_song",
|
||||
"format": "wav"
|
||||
}
|
||||
}
|
||||
```toml
|
||||
[composition]
|
||||
key = 60
|
||||
scale = "minor"
|
||||
tempo = 85.0
|
||||
measures = 16
|
||||
|
||||
[[tracks]]
|
||||
name = "bass"
|
||||
instrument = "sine"
|
||||
volume = 0.8
|
||||
|
||||
[tracks.pattern]
|
||||
type = "custom"
|
||||
|
||||
[[tracks.pattern.steps]]
|
||||
time = 0.0
|
||||
note = "C2"
|
||||
duration = 0.75
|
||||
velocity = 0.9
|
||||
|
||||
[export]
|
||||
filename = "my_song"
|
||||
format = "wav"
|
||||
```
|
||||
|
||||
### Definitions
|
||||
@ -85,46 +83,55 @@ cargo run --bin musicgen json examples/fantasy.json
|
||||
|
||||
### Track Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"tracks": [
|
||||
{
|
||||
"name": "bass",
|
||||
"instrument": "sine",
|
||||
"volume": 0.8,
|
||||
"pattern": {
|
||||
"type": "custom",
|
||||
"steps": [
|
||||
{ "time": 0.0, "note": "C2", "duration": 0.75, "velocity": 0.9 },
|
||||
{ "time": 2.0, "note": "G2", "duration": 0.75, "velocity": 0.8 }
|
||||
],
|
||||
"loop_length": 4.0
|
||||
},
|
||||
"effects": [
|
||||
{
|
||||
"type": "lowpass",
|
||||
"cutoff": 400.0,
|
||||
"resonance": 1.8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "drums",
|
||||
"instrument": "noise",
|
||||
"volume": 0.6,
|
||||
"pattern": {
|
||||
"type": "custom",
|
||||
"steps": [
|
||||
{ "time": 0.0, "note": "C1", "duration": 0.1, "velocity": 1.0 },
|
||||
{ "time": 1.0, "note": "E3", "duration": 0.05, "velocity": 0.7 }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```toml
|
||||
[[tracks]]
|
||||
name = "bass"
|
||||
instrument = "sine"
|
||||
volume = 0.8
|
||||
|
||||
[tracks.pattern]
|
||||
type = "custom"
|
||||
loop_length = 4.0
|
||||
|
||||
[[tracks.pattern.steps]]
|
||||
time = 0.0
|
||||
note = "C2"
|
||||
duration = 0.75
|
||||
velocity = 0.9
|
||||
|
||||
[[tracks.pattern.steps]]
|
||||
time = 2.0
|
||||
note = "G2"
|
||||
duration = 0.75
|
||||
velocity = 0.8
|
||||
|
||||
[[tracks.effects]]
|
||||
type = "lowpass"
|
||||
cutoff = 400.0
|
||||
resonance = 1.8
|
||||
|
||||
[[tracks]]
|
||||
name = "drums"
|
||||
instrument = "noise"
|
||||
volume = 0.6
|
||||
|
||||
[tracks.pattern]
|
||||
type = "custom"
|
||||
|
||||
[[tracks.pattern.steps]]
|
||||
time = 0.0
|
||||
note = "C1"
|
||||
duration = 0.1
|
||||
velocity = 1.0
|
||||
|
||||
[[tracks.pattern.steps]]
|
||||
time = 1.0
|
||||
note = "E3"
|
||||
duration = 0.05
|
||||
velocity = 0.7
|
||||
```
|
||||
|
||||
See `examples` for complete examples and the full schema.
|
||||
See `composition-schema` for a complete example and the full schema.
|
||||
|
||||
## Output
|
||||
|
||||
|
Reference in New Issue
Block a user