Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: A musical bloat.  (Read 1486 times)

Jazz

  • Bay Watcher
    • View Profile
A musical bloat.
« on: April 14, 2008, 09:40:00 pm »

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 ]

Logged
he Spicy Shrine.
Fellowship of Lunches?
Humans who worship food?
We need more DF religion in real life.

Derakon

  • Bay Watcher
    • View Profile
Re: A musical bloat.
« Reply #1 on: April 14, 2008, 10:19:00 pm »

Heh, I like it. Naturally some of the parameters should be culturally determined, and some by the dwarf in question; perhaps B-flat minor is the traditional key of dwarven dirges, and this particular dwarf wants to make a dirge on a piccolo.

However, I suspect that if this is ever to see the light of day, it'll have to be by a free music-generation system that has a sufficiently permissive license that Toady would be willing to insert it into his own program. Something like the BSD or MIT license, say. Your pseudocode abstracts a lot of what is needed to make a pleasant-sounding piece of music, which in turn requires a fairly strong grasp of musical theory, which, statistically speaking, Toady probably doesn't have.

Logged
Jetblade - an open-source Metroid/Castlevania game with procedurally-generated levels

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: A musical bloat.
« Reply #2 on: April 14, 2008, 10:51:00 pm »

I think Toady was working on a music generator for another project (Star Team DX).    I think it worked mostly by mixing samples and clips, but obviously DF would need something more refined and versatile.
Logged

Jazz

  • Bay Watcher
    • View Profile
Re: A musical bloat.
« Reply #3 on: April 15, 2008, 12:08:00 am »

Yeah, I know I left a bunch of stuff out. Whats currently here will will not only randomly jump around chords by 4th/5th/3rd or step, the rhythms will be completely random too. Only guarantee is that the middle of the phrase ends on 5 and the end of the phrase ends on one.

But, yeah. I figured this would be something that would be really cool, but had no chance of inclusion. But, the future may yet surprise us.

Logged
he Spicy Shrine.
Fellowship of Lunches?
Humans who worship food?
We need more DF religion in real life.

Yourself

  • Bay Watcher
    • View Profile
Re: A musical bloat.
« Reply #4 on: April 15, 2008, 12:16:00 am »

http://tones.wolfram.com

Computers can do it.  Sometimes they can do a pretty decent job.

Logged

joss

  • Bay Watcher
    • View Profile
Re: A musical bloat.
« Reply #5 on: April 15, 2008, 02:36:00 am »

So far this topic has been about composition of the music itself,  but I'd like point more to the gamemechanics part of the music in DF.

* Music will be played by dwarves, so dwarves should have skills (trumpet playing, piano playing etc.), which reflect their ability to play the instruments

* Dwarves should have a stat (like we have now agility, toughness and strength) which should be named "musicality", with proper levels ranging from unmusical to musical genius

* Dwarves should be able to play alone or in bands and orchestras, which should be formed like military squads, and instruments should be applied to dwarves the same way as weapons. Maybe even you could set how often dwarves rehearse their instruments.

*Dwarves should be able to hold concerts and dwarves should have different musical tastes by instrument or by style.

constructive critics always allowed. And hello to the DF community

Logged

Mel_Vixen

  • Bay Watcher
  • Hobby: accidently thread derailment
    • View Profile
Re: A musical bloat.
« Reply #6 on: April 15, 2008, 06:39:00 am »

Nice idea but this could very (CPU)time consuming if our Dwarfes create Music while they playing the instruments so a piece of Music should be created like an Artefact - over an long time.
Logged
[sarcasm] You know what? I love grammar Nazis! They give me that warm and fuzzy feeling. I am so ashamed of my bad english and that my first language is German. [/sarcasm]

Proud to be a Furry.

Cthulhu

  • Bay Watcher
  • A squid
    • View Profile
Re: A musical bloat.
« Reply #7 on: April 15, 2008, 06:55:00 am »

*Suddenly spits out his drink*

Two Words:  Random lyrics.

Logged
Shoes...

Neskiairti

  • Bay Watcher
    • View Profile
    • Trust me, dont look.
Re: A musical bloat.
« Reply #8 on: April 15, 2008, 08:04:00 am »

its the random lyrics that must win over everyone..

-pictures a dwarf singing about how substantial the goat-mascaraing tentacle monster who dalliances icicles upon the stone wrought mountains of gore fed golden hill hairs-

>.>

must have.. must... have.. something like dozens of 'line' types.. each one a mad lib of sorts.. with random generation to pick what its filled with.. and so a song might have 2-8 different lines.. each one randomly generated..

man..

Logged
The New Moo!

Jazz

  • Bay Watcher
    • View Profile
Re: A musical bloat.
« Reply #9 on: April 15, 2008, 08:16:00 am »

quote:
Originally posted by Heph:
<STRONG>Nice idea but this could very (CPU)time consuming if our Dwarfes create Music while they playing the instruments so a piece of Music should be created like an Artefact - over an long time.</STRONG>

Unless your dwarves are playing jazz  :), most of their music would obviously be written beforehand, just like an artifact. Composers could be a low-level noble would need an office, and would write music as they "come up with it." As the music is written, other musical dwarves can borrow it to play it, or make a copy. In case you lose the first copy in a fire or something.

Moody composers would write an entire symphony instead of a shorter song.

Performing dwarves could either be a musician by trade, or only enjoy playing or singing music during their spare time. 8 dwarves on break + booze = random lyric drinking song?

Logged
he Spicy Shrine.
Fellowship of Lunches?
Humans who worship food?
We need more DF religion in real life.

Heavy Flak

  • Bay Watcher
  • Olsmo Lives
    • View Profile
Re: A musical bloat.
« Reply #10 on: April 15, 2008, 09:50:00 am »

I think once the economy / trading gets renovated, you could do some really fun things.  Concerts?  Sure - you have to pay to get into the concert hall, and the revenue could be taxed before the performers ever see their cut.

Dwarf musicians could sit in the hallway panhandling, since they'd recently been evicted from their rooms for doing nothing but picking away at their guitar.

The Elf caravan proves itself useful for once - bringing some new and obscure instrument to the fortress has revolutionized the way the Composer Noble can compose his music.

Logged