/
world-definition.rkt
37 lines (32 loc) · 2.06 KB
/
world-definition.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-reader.ss" "lang")((modname world-definition) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; Final Project: Markov Audio Generation
;; Team "I feel like a tater tot"
;; Kellie Banzon, Alex Gravenor, Jeffery Ho, Steven Pineda
;; World Definitions
;; The world state for big-bang is a markov-chain
(define-struct gui-state [node-selected connection-selected tick-rate tick-count volume in-help])
;;A gui-state is a structure:
;; (make-gui-state Number Number Number Number Number Boolean)
;; interpretation: A Gui state has:
;; - node-selected: an integer corresponding to the index of the selected node
;; - connection-selected: the index of the currently selected connection
;; - tick-rate: the length of the current note in ticks
;; - tick-count: the current "tick-index" of the note being played
;; the tick-count starts at 0 and increments every time the clock ticks
;; when tick-count = tick-rate, the current note has finished playing, and tick-count resets to 0
;; - volume: a number between 0.0 and 1.0 that reflects the volume of the audio
;; - in-help: a boolean that represents whether the help menu should be shown or not
(define-struct markov-node [midi connections])
;; A markov-node is a structure:
;; (make-markov-node Number list-of-numbers)
;; interpretation: A markov-node has
;; - midi: a integer value that corresponds to a MIDI note number
;; - connections: a list of connection strengths, where the strengths are numbers between 0.0 and 1.0
(define-struct markov-chain [nodes current-node gui])
;; A markov-chain is a structure:
;; (make-markov-chain list-of-markov-nodes Number gui-state)
;; interpretation: A markov-chain has
;; - nodes: a list of markov-nodes in the markov-chain
;; - current-node: a integer value corresponding to the current index of the markov-chain list