0.1.0 - Initial commit
This commit is contained in:
42
schema/song_schema.go
Normal file
42
schema/song_schema.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package schema
|
||||
|
||||
// A simple song with tracks that loop
|
||||
type Song struct {
|
||||
Name string `yaml:"name"`
|
||||
BPM int `yaml:"bpm"`
|
||||
Length int `yaml:"length"` // Total length in bars
|
||||
Volume float64 `yaml:"volume"`
|
||||
Tracks []Track `yaml:"tracks"`
|
||||
}
|
||||
|
||||
// A simple instrument track that can loop or play once
|
||||
type Track struct {
|
||||
Name string `yaml:"name"`
|
||||
Instrument string `yaml:"instrument"` // sine, square, saw, triangle
|
||||
Volume float64 `yaml:"volume"`
|
||||
Pan float64 `yaml:"pan"` // -1.0 to 1.0
|
||||
Pattern []string `yaml:"pattern"` // Pattern like ["C4", ".", "E4", "."]
|
||||
Loop bool `yaml:"loop,omitempty"` // If true, pattern loops. If false, plays once then silence
|
||||
Effects []Effect `yaml:"effects,omitempty"` // Effects applied to this track
|
||||
}
|
||||
|
||||
// Defines an audio effect
|
||||
type Effect struct {
|
||||
Type string `yaml:"type"` // reverb, delay, filter, etc.
|
||||
Params map[string]interface{} `yaml:"params"` // Effect-specific parameters
|
||||
}
|
||||
|
||||
// Returns the song length in beats (bars * 4)
|
||||
func (s *Song) CalculateTotalLength() float64 {
|
||||
return float64(s.Length * 4) // 4 beats per bar
|
||||
}
|
||||
|
||||
// Returns a song with default values
|
||||
func DefaultSong() Song {
|
||||
return Song{
|
||||
Name: "New Song",
|
||||
BPM: 120,
|
||||
Length: 8, // 8 bars default
|
||||
Volume: 0.7,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user