Add main menu theme

soundtrack
Ensar Sarajčić 2021-11-22 20:48:43 +01:00
parent ed9d478d0c
commit 9cdfc17815
7 changed files with 58 additions and 69 deletions

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/main_theme.wav-fc7a93fb910535b9bc6e7800904a7ba5.sample"
[deps]
source_file="res://assets/music/main_theme.wav"
dest_files=[ "res://.import/main_theme.wav-fc7a93fb910535b9bc6e7800904a7ba5.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0

View File

@ -1,75 +1,16 @@
(ns music.songs.main-theme
(:require
[clojure.set :as set]
[edna.core :as edna]))
(ns music.songs.main-theme)
(def tempo 72)
(defn intro [volume]
#{
[:piano {:octave 4
:tempo tempo
:volume volume}
1/4 :-d :-a 1/8 :-e :-c 1/4 :-g :e :c
1/2 :-d
1/4 :-d :-a 1/8 :-e :-c 1/4 :-g :d :-f 1/8 :e :g 1/4 :f :a 1/16 :g 1/4 :f 1/2 :c] })
(defn verse [volume]
#{
[:piano {:octave 4
:tempo tempo
:volume volume}
1/16 #{:-d :f#} 1/8 #{:-e :+f} :a 1/2 #{:f# :+d}
:r :r
1/16 #{:-c :g#} 1/8 #{:-e :+f} :b 1/2 #{:+d :f#}]
[:steel-drum {:octave 3
:tempo tempo
:volume (quot volume 2) }
1/8 :-a :a :b 1/2 :a
:c :c
:a 1/8 :b :a :-a]
[:acoustic-bass {:octave 3
:tempo tempo
:volume (quot volume 3) }
1/8 :-a :a :b 1/2 :a
:c :c
:a 1/8 :b :a :-a]})
(defn pre-chorus [volume]
#{
[:steel-drum {:octave 3
:tempo (* 2 tempo)
:volume volume}
1/8 :a 1/4 :a 1/8 :b 1/2 :-a]
[:acoustic-bass {:octave 3
:tempo (* 2 tempo)
:volume volume}
1/8 :b 1/4 :c 1/8 :g 1/2 :-g#]
})
(defn chorus [volume]
#{
[:piano {:octave 3
:tempo tempo
:volume volume}
1/16 #{:-d :f#} 1/8 #{:-e :+f} :a 1/4 #{:f# :+d}
1/16 :c :r :d :r :e :r :f
1/16 :r 1/4 :d 1/8 :r :r
1/16 :f :r :e :r :d :r :c ]
[:acoustic-bass {:octave 3
:tempo tempo
:volume (quot volume 3) }
1/16 :-a :a :b :c 1/4 :a
1/64 (repeat 7 [:c :d :g :-f])
1/16 :a :c :b :a 1/4 :-b
1/64 (repeat 7 [:-b :a :c :-g])] })
(set
(map
(fn [instrument] [instrument {:octave 2
:tempo tempo
:volume volume}
1/4 :-d :-a 1/8 :-e :-c 1/4 :-g :e :c
1/2 :-d
1/4 :-d :-a 1/8 :-e :-c 1/4 :-g :d :-f 1/8 :e :g 1/4 :f :a 1/16 :g 1/4 :f 1/2 :c]) [:piano :violin :acoustic-bass])))
(concat
(map intro [20 40 80 100])
(map verse [100 80])
(map pre-chorus [60 80])
(map verse [100])
(map pre-chorus [60 80])
(map chorus [100 100])
(map verse [100 60])
(map chorus [40 20]))
(map intro [70 100]))

View File

@ -4,6 +4,7 @@ extends Panel
func _ready() -> void:
# gdlint: ignore=max-line-length
$MarginContainer/VSplitContainer/VSplitContainer/CenterContainer/VBoxContainer/StartButton.grab_focus()
MusicPlayer.play_theme("main")
func _on_StartButton_pressed() -> void:

View File

@ -0,0 +1,12 @@
extends Node
export var main_theme: AudioStream
onready var themes = {"main": main_theme}
onready var player: AudioStreamPlayer = $Player
func play_theme(theme: String) -> void:
player.stream = themes[theme]
player.play()

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://music/MusicPlayer.gd" type="Script" id=1]
[ext_resource path="res://assets/music/main_theme.wav" type="AudioStream" id=2]
[node name="Node" type="Node"]
script = ExtResource( 1 )
main_theme = ExtResource( 2 )
[node name="Player" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 2 )
autoplay = true
bus = "Music"

View File

@ -46,6 +46,7 @@ config/icon="res://icon.png"
[autoload]
GlobalSettings="*res://settings/GlobalSettings.gd"
MusicPlayer="*res://music/MusicPlayer.tscn"
[editor_plugins]