feat: save only the units and comment to instrument/preset files

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2026-02-28 20:43:45 +02:00
parent f3bb0001cd
commit 4cb9308af3
154 changed files with 18 additions and 164 deletions

View File

@ -45,6 +45,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
did not, resulting it claiming errors in patches that worked once compiled.
### Changed
- Save only units and comment to instrument files, as we keep all the other
fields while loading a new instrument / preset and the name comes from the
filename.
- Recovery files were moved to `os.UserConfigDir()/sointu/recovery/` instead of
`os.UserConfigDir()/sointu/` so that they don't pollute the main configuration
directory and so that it's easy to delete just the recovery files.

View File

@ -21,7 +21,7 @@ type (
Instrument struct {
Name string `yaml:",omitempty"`
Comment string `yaml:",omitempty"`
NumVoices int
NumVoices int `yaml:",omitempty"`
Mute bool `yaml:",omitempty"` // Mute is only used in the tracker for soloing/muting instruments; the compiled player ignores this field
// ThreadMaskM1 is a bit mask of which threads are used, minus 1. Minus
// 1 is done so that the default value 0 means bit mask 0b0001 i.e. only

View File

@ -32,9 +32,11 @@ func main() {
return nil
}
tracker.RemoveUnusedUnitParameters(&instr) // remove invalid parameters
instr.Name = "" // we don't need the names in the preset files as they are derived from the file path
instr.NumVoices = 1
outData, err := yaml.Marshal(instr)
instr2 := sointu.Instrument{ // keep only the relevant fields
Comment: instr.Comment,
Units: instr.Units,
}
outData, err := yaml.Marshal(instr2)
if err != nil {
fmt.Fprintf(os.Stderr, "could not marshal the preset file %v: %v\n", path, err)
return nil

View File

@ -408,13 +408,18 @@ func (m *InstrModel) Write(w io.WriteCloser) bool {
var contents []byte
var err error
instr := m.d.Song.Patch[m.d.InstrIndex]
instr2 := sointu.Instrument{ // save only the relevant fields
Name: instr.Name,
Comment: instr.Comment,
Units: instr.Units,
}
if _, ok := w.(*os.File); ok {
instr.Name = "" // don't save the instrument name to a file; we'll replace the instruments name with the filename when loading from a file
instr2.Name = "" // don't save the instrument name to a file; we'll replace the instruments name with the filename when loading from a file
}
if extension == ".json" {
contents, err = json.Marshal(instr)
contents, err = json.Marshal(instr2)
} else {
contents, err = yaml.Marshal(instr)
contents, err = yaml.Marshal(instr2)
}
if err != nil {
(*Model)(m).Alerts().Add(fmt.Sprintf("Error marshaling an instrument file: %v", err), Error)

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: oscillator
id: 3

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: oscillator
id: 3

View File

@ -8,7 +8,6 @@ comment: |
Filter 1: High pass filter to remove the low end.
Filter 2: Low pass filter, with the frequency modulated by the Send (starts high and drops low, for that snap).
Envelope-distort-send: Make the filter 2 frequency drop quickly from high to low, for the "snap".
numvoices: 1
units:
- type: envelope
id: 217

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 2064
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 218
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1545
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1546
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 184
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 160

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: oscillator
id: 1983

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- type: envelope
id: 1974

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 217
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- type: envelope
id: 1821

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 235
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 68
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 208
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- type: envelope
id: 2277

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 216
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 1241
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1351
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 1351
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- id: 2041
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1296
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1005
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1011
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1005
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- type: envelope
id: 1209

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1234
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 2
units:
- type: envelope
id: 1241

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1280
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1280
parameters: {}

View File

@ -1,7 +1,6 @@
comment: |-
Generic pluck generator
Use oscillator type, color and shape to alter the sound properties
numvoices: 1
units:
- id: 1713
parameters: {}

View File

@ -1,7 +1,6 @@
comment: |-
Generic pluck generator
Use oscillator type, color and shape to alter the sound properties
numvoices: 2
units:
- id: 1007
parameters: {}

View File

@ -1,7 +1,6 @@
comment: |-
Generic pluck generator
Use oscillator type, color and shape to alter the sound properties
numvoices: 2
units:
- id: 1713
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 81

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 23

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 23

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 52

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1215

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1215

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 14

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1215

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1215

View File

@ -1,5 +1,4 @@
comment: Use range C-4 to G-4
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,6 +1,4 @@
name: DR kick-edm
comment: A#2
numvoices: 2
units:
- id: 128
parameters: {}

View File

@ -1,6 +1,4 @@
name: DR kickedm2
comment: A#2
numvoices: 2
units:
- id: 1660
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -2,7 +2,6 @@ comment: |
Closed hihat: Atk 8 + Dec 60
Open hihat: Atk8 + Dec75
Shaker: Atk55 + Dec60
numvoices: 1
units:
- id: 333
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1215
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1044

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1078

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1215

View File

@ -1,5 +1,4 @@
comment: 'Suggested note: C-3'
numvoices: 1
units:
- id: 296
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested note: C-3'
numvoices: 1
units:
- id: 296
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested note: C-3'
numvoices: 1
units:
- id: 336
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested note: C-3'
numvoices: 1
units:
- id: 339
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested note: C-3'
numvoices: 1
units:
- id: 285
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 33
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,5 +1,4 @@
comment: A#2
numvoices: 1
units:
- id: 128
parameters: {}

View File

@ -1,5 +1,4 @@
comment: A#2
numvoices: 1
units:
- id: 130
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1036

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 3021
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,5 +1,4 @@
comment: 'suggested note: D-4'
numvoices: 1
units:
- id: 334
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'suggested note: E-4'
numvoices: 1
units:
- id: 340
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -10,7 +10,6 @@ comment: |
Delay: Add some reverb to make it sound little less synthetic. Used the exact same coefficients as the main reverb, so they appear in the final .asm only once.
Compressor: Tame the transient, boost the tail.
Envelope-distort-send: Quickly drop the pitch of the tom from high to neutral.
numvoices: 1
units:
- id: 31
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested range: E-4'
numvoices: 1
units:
- id: 241
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested range: E-4'
numvoices: 1
units:
- id: 339
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested range: E-4'
numvoices: 1
units:
- id: 341
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested range: E-2 to C-3'
numvoices: 1
units:
- id: 311
parameters: {}

View File

@ -1,5 +1,4 @@
comment: 'Suggested range: E-2 to C-3'
numvoices: 1
units:
- id: 217
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1217

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 1752
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1733

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1718

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 92
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- id: 87
parameters: {}

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1974

View File

@ -1,4 +1,3 @@
numvoices: 1
units:
- type: envelope
id: 1993

Some files were not shown because too many files have changed in this diff Show More