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. did not, resulting it claiming errors in patches that worked once compiled.
### Changed ### 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 - Recovery files were moved to `os.UserConfigDir()/sointu/recovery/` instead of
`os.UserConfigDir()/sointu/` so that they don't pollute the main configuration `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. directory and so that it's easy to delete just the recovery files.

View File

@@ -21,8 +21,8 @@ type (
Instrument struct { Instrument struct {
Name string `yaml:",omitempty"` Name string `yaml:",omitempty"`
Comment 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 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 // 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 // 1 is done so that the default value 0 means bit mask 0b0001 i.e. only
// thread 1 is rendering the instrument. // thread 1 is rendering the instrument.

View File

@@ -32,9 +32,11 @@ func main() {
return nil return nil
} }
tracker.RemoveUnusedUnitParameters(&instr) // remove invalid parameters 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 instr2 := sointu.Instrument{ // keep only the relevant fields
instr.NumVoices = 1 Comment: instr.Comment,
outData, err := yaml.Marshal(instr) Units: instr.Units,
}
outData, err := yaml.Marshal(instr2)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "could not marshal the preset file %v: %v\n", path, err) fmt.Fprintf(os.Stderr, "could not marshal the preset file %v: %v\n", path, err)
return nil return nil

View File

@@ -408,13 +408,18 @@ func (m *InstrModel) Write(w io.WriteCloser) bool {
var contents []byte var contents []byte
var err error var err error
instr := m.d.Song.Patch[m.d.InstrIndex] 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 { 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" { if extension == ".json" {
contents, err = json.Marshal(instr) contents, err = json.Marshal(instr2)
} else { } else {
contents, err = yaml.Marshal(instr) contents, err = yaml.Marshal(instr2)
} }
if err != nil { if err != nil {
(*Model)(m).Alerts().Add(fmt.Sprintf("Error marshaling an instrument file: %v", err), Error) (*Model)(m).Alerts().Add(fmt.Sprintf("Error marshaling an instrument file: %v", err), Error)

View File

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

View File

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

View File

@@ -8,7 +8,6 @@ comment: |
Filter 1: High pass filter to remove the low end. 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). 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". Envelope-distort-send: Make the filter 2 frequency drop quickly from high to low, for the "snap".
numvoices: 1
units: units:
- type: envelope - type: envelope
id: 217 id: 217

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
numvoices: 1
units: units:
- type: envelope - type: envelope
id: 1 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. 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. Compressor: Tame the transient, boost the tail.
Envelope-distort-send: Quickly drop the pitch of the tom from high to neutral. Envelope-distort-send: Quickly drop the pitch of the tom from high to neutral.
numvoices: 1
units: units:
- id: 31 - id: 31
parameters: {} parameters: {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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