Yeah, I'm aware that Toady is going to eventually make musical instruments actually do something in the future. This is taking that above and beyond.
I think it would be really cool if you could actually literally have the dwarves compose and perform their own music. The fortress could generate their own drinking song with lyrics provided that the random word generator is tweaked. Also, though likely complicated, there are indeed ways for a computer to randomly create a melody and harmonize it and still have it sound decent. Of course, that would be once the game's sound becomes a higher priority.
In short, being able to hear a fortress create/play music would go great along with the artistic engravings and could be a great way to add a lot of flavor to the Dwarven culture.
code:
Pseudocode:Select Random Tonality (Major or Minor)
Select Random Key
Select Random Meter //Would favor simple meter such as 2/4 3/4 or 4/4
Select Random Tempo //Would favor mid-range numbers e.g. between 80-140
Select Random Length //Somewhere between 8-32 measures unless your dwarf is decides to create an entire symphony.
Select Random Phrase Length // 2, 4, or 8 measures for each phrase.
Select Harmonic Rhythm // Determines how many chord changes per beat.
//Once these basic parameters are set, the song can start to be generated.
//Start from the beginning and generate the song.
Loop (Until End of Song)
{
Select Case:
(Beginning of Phrase)
Select Harmony(1,5)//selects either the 1 or 5 chord to begin.
(Middle of Phrase)//Chord progression. Choose randomly from these three choices.
Select Harmony(Current Harmony-5 OR Current Harmony+4)//Drop a fifth or go up a fourth.
Select Harmony(Current Harmony-1 OR Current Harmony+1)//Progression by step.
Select Harmony(Current Harmony-3 OR Current Harmony+3)//Progression by third.
(End of Phrase)
If (!End of Period)
{
Select Harmony(5)//Half cadence
}
Else
{
Select Harmony(1)//Authentic cadence
}
End Case
//Once the chord is selected, notes can be generated until the next chord change.
int GeneratedBeats
Do Until (GeneratedBeats == HarmonicRhythm) //Determines when to stop generating notes and move on to the next chord.
{
GenerateNote(CurrentHarmony,RandomRhythm)
//Create a note of random rhythm in current chord.
//Note that the random rhythm cannot exceed the number of beats allowed by harmonic rhythm.
GeneratedBeats = GeneratedBeats + RandomRhythm
}
//Once the chord is fulfilled, loop back and pick a new chord.
}//Loop back and pick new chord.
Figured I'd add some pseudocode a proof of concept. In theory, this could create a random melodic line. Obviously it has holes, and obviously you cannot compile this, but then again, thats what pseudocode is.
[ April 14, 2008: Message edited by: Jazz ]