Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Procedurally Generated Music and Poetry  (Read 7206 times)

stolide

  • Bay Watcher
    • View Profile
Procedurally Generated Music and Poetry
« on: March 19, 2015, 10:37:37 pm »

I hope I'm not the only one that would love to see actual music and poetry come out of DF! Especially on the music side, writing a program to spew out some music given all the parameters of the document doesn't seem impossible.

I know that there already exist procedural music generators, and it sounds like a lot of the cultures will be using microtonal music (which I love), so having things that sound a little odd or strange will not really be out of place.

I can just imagine it now, strolling into a castle to hear the kingdom's anthem, consistently, or perhaps being able to identify the nation of a passing group of soldiers just from their music!

As for the poetry, I do hope that it tells a little more about what the poetry describes, since right now it seems to be focused almost exclusively on form.
« Last Edit: March 20, 2015, 03:34:40 pm by stolide »
Logged
Under the somber sleep of stones, a star is snuffed by a candle.

As Urist McKant Said, "I must act according to the maxim such that I can will that maxim to destroy everything beloved to me at the flip of a lever."

Pencil_Art

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #1 on: March 20, 2015, 12:49:28 am »

Have you been on the website recently? They have been working on it for like the past 2 months.
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: Procedurally Generated Music and Poetry
« Reply #2 on: March 20, 2015, 02:53:36 am »

AFAIK Toady doesn't want to get into generating actual poetry (at least not yet), but I'm pretty sure individual poems will be given detailed descriptions based on the forms.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Inarius

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #3 on: March 20, 2015, 03:11:35 am »

I can only speak of what I know (music), but procedural music is very very hard to create. Something you can actually listen, i mean.
Logged

Pencil_Art

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #4 on: March 20, 2015, 03:46:26 am »

AFAIK Toady doesn't want to get into generating actual poetry (at least not yet), but I'm pretty sure individual poems will be given detailed descriptions based on the forms.
Yeah, generating the actual words of poetry is very hard.
Logged

utunnels

  • Bay Watcher
  • Axedwarf
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #5 on: March 20, 2015, 03:47:07 am »

Yeah, something you don't need to frequently reroll the RNG to get it right.
Logged
The troglodyte head shakes The Troglodyte around by the head, tearing apart the head's muscle!

Risen Asteshdakas, Ghostly Recruit has risen and is haunting the fortress!

stolide

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #6 on: March 20, 2015, 03:31:57 pm »

Have you been on the website recently? They have been working on it for like the past 2 months.

Clearly I have, since I'm suggesting that the data Toady's currently outputting be used to generate actual music that we can physically hear.

I can only speak of what I know (music), but procedural music is very very hard to create. Something you can actually listen, i mean.

It really depends on how conventional and complicated you want it to be.

Writing a computer program to generate twelve tone rows, and layer them in certain ways is not terribly difficult. I wrote a twelve tone fugue by just deciding what features I wanted two different rows to have in relation to each other, and it practically wrote itself.

Writing a program that uses already existing phrases to generate a generic I-IV-V blues song wouldn't be too hard, although it would be predictable. Writing a computer program to generate original music that sounds like a Beethoven symphony would be difficult indeed.

For me, even having a single voice melody with the appropriate tonal and rhythmic qualities play when you come near musicians would just be amazing.

If the program only spits out music with a single voice and percussion, it really would be within reach. If you aren't hard set upon only having a pleasing western sound (which most of the sample descriptions do not describe), then you could easily have it generate a handful of default musical phrases or gestures for a culture or style, that it then overlays.

I have written music that is constructed primarily by layering phrases using a microtonal instrument I built.

Not to get all self promotional, but here are three tracks that use that method of overlaying phrases made with that microtonal stringed instrument.

This one's fairly full sounding with weird samples, https://soundcloud.com/nethodsod/rhainodaises

And this one is much more subtle than most of my music, being meant to evoke wandering desert people: https://soundcloud.com/nethodsod/arid-porch

Both of those are fairly heavily mixed, but if you don't do any editing at all, you get something like this, which was made with a random tuning: https://soundcloud.com/nethodsod/nocturne-in-q

...

So from all that, I do think that it is feasible to generate a random melody in an arbitrary tuning system, and have the melody fit into an arbitrary rhythmic pattern. Much avant garde music is written in this way, deciding upon available tones and rhythmic qualities prior to any consideration for end product. With only one voice (one note at a time) the music would still sound strange, but notes wouldn't not be clashing with each other.
« Last Edit: March 20, 2015, 05:05:54 pm by stolide »
Logged
Under the somber sleep of stones, a star is snuffed by a candle.

As Urist McKant Said, "I must act according to the maxim such that I can will that maxim to destroy everything beloved to me at the flip of a lever."

Pencil_Art

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #7 on: March 20, 2015, 05:04:08 pm »

Oh, sorry :-[. I thought you were talking about the stuff they were working on.

CLEAN SLATE:

Yeah, generating decent music you could physically hear is something not easily accomplished. It would be interesting to, say, have the song  generate a specific tune based on what the music style, what the song is about, and other factors that are included in the description.

eg.
Quote
A devotional form of music directed toward the worship of Enure Deerlizard originating in The Wind of Moths. The rules of the form are applied by composers of individual songs. One to two chanters recite the words of a (name of poetic form here). It is performed using the aweme scale and in the alo rhythm. Throughout, when possible, composers and performers are to make trills.

Each chanter always does the main melody.

The form has a well-defined multi-passage structure: a brief verse and a brief chorus all repeated one times and a brief coda.

The verse is moderately fast, and it is to be moderately soft.

The chorus slows and broadens, and it is to be moderately loud.

The coda is very fast, and it is to be very soft.

Scales are conceived of as two chords built using a division of the perfect fourth interval into eight notes. The tonic note is fixed only at the time of performance.

As always, the aweme hexatonic scale is thought of as two disjoint chords drawn from the fundamental division of the perfect fourth. These chords are named eyo and datha.

The eyo tetrachord is the 1st, the 3rd, the 5th and the 8th degrees of the fundamental perfect fourth division.

The datha trichord is the 1st, the 2nd and the 8th degrees of the fundamental perfect fourth division.

The alo rhythm is made from two patterns: the amama (considered the primary) and the otoga. The patterns are to be played over the same period of time, concluding together regardless of beat number.

The amama rhythm is a single line with four beats divided into two bars in a 2-2 pattern. The beats are named thafatha (spoken tha) and etini (et). The beat is stressed as follows:
| - x | - x |
where x is a beat, - is silent and | indicates a bar.

The otoga rhythm is a single line with three beats. The beats are named dinade (spoken di), cenopu (ce) and ele (el). The beat is stressed as follows:
| - x x |
where x is a beat, - is silent and | indicates a bar.
----------
A form of music used for entertainment originating in The Grasping Oaks. The form guides musicians during improvised performances. A chanter recites the words of a (name of poetic form here) while the music is played on a rofela. The entire performance slows and broadens. It is performed using the tarathe scale and in the bulifo rhythm. Throughout, when possible, performers are to use grace notes, alternate tension and repose and play arpeggios.

The chanter always does the main melody, should be passionate and is to be loud.

The rofela always does the main melody, should be melancholic and is to be soft.

The form has a well-defined multi-passage structure: a theme, a brief exposition of the theme and a brief recapitulation of the theme.

Scales are constructed from twenty-four notes spaced evenly throughout the octave. The tonic note is a fixed tone passed from teacher to student. After a scale is constructed, the root note of chords are named. The names are cuthefi (spoken cu) and cede (ce).

The tarathe pentatonic scale is thought of as joined chords spanning a perfect fifth and a perfect fourth. These chords are named aratha and fathinu.

The aratha tetrachord is the 1st, the 4th, the 9th and the 15th degrees of the quartertone octave scale.

The fathinu trichord is the 15th, the 19th and the 25th (completing the octave) degrees of the quartertone octave scale.

The bulifo rhythm is made from two patterns: the emu (considered the primary) and the otoga. The patterns are to be played in the same beat, allowing one to repeat before the other is concluded.

The emu rhythm is a single line with twenty-seven beats divided into five bars in a 7-6-4-6-4 pattern. The beat is stressed as follows:
| - - x x - - x | - - x x - x | - - x - | - - - x x - | x x x x |
where x is a beat, - is silent and | indicates a bar.

The otoga rhythm is a single line with eighteen beats divided into two bars in a 11-7 pattern. The beat is stressed as follows:
| x - - x x x - - x - - | x - x - - - - |
where x is a beat, - is silent and | indicates a bar.
----------
A form of music used to commemorate important events originating in The Bald Vessel. The form guides musicians during improvised performances. A singer recites the words of a (name of poetic form here), while the music is played on a koshmot and a cenath. The entire performance should be melancholic. It is performed without preference for a scale and in free rhythm.

The singer always does the main melody.

The koshmot always always does the counterpoint melody.

The cenath always does the main melody and makes trills.

The form has a simple structure: a brief passage.

The simple passage is consistently slowing, and it is to become softer and softer.

You can already imagine what that sounds like. What needs to happen is that the generator needs to have all of these factors, and you have your music. However, this is still no mean feat. Thanks for letting me know, stolide.
Logged

stolide

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #8 on: March 20, 2015, 05:19:33 pm »

Yeah, sorry if I wasn't clear at first.    :D

While you can imagine it, I do think that fairly simple music could be generated without too much effort. I'm no programmer, but here's what you'd need to do.

1. RNG for the culture's rhythms.
2. RNG for culture's tonal divisions.
3. RNG to choose 10 arbitrary sequences of notes in the given tonal system.
4. Make those notes last lengths of time based on the rhythm being used. Save this as a phrase.
5. Make a percussive track for each rhythm. Give it low mid and high percussive sounds (or RNG to decide which of those, if any, the culture uses). Low and mid hit once or twice per rhythmic sequence. High hit more often, or not all.
6. Play one or more phrases at the same time as percussive track. Perhaps alternate them.

I'm pretty sure that's all that needs to be done to generate the music. You probably won't get anything outstanding, but it would be procedurally generated music. It wouldn't be those specific songs that you pasted the descriptions of into. They'd be more like random jam sessions at the tavern you walk into. Many folk songs just have a structure of repeating one or two sections until everyone gets tired of playing, so you don't need anything too complicated there.

The first two are done, the third is trivial. The fourth should be simple as well. The fifth can be made easy if you assign each kind of percussive sound to a random beat in each rhythmic pattern, or if you say they always hit at the beginning, half way, and so on. The sixth, playing audio tracks simultaneously, is no real task either.
Logged
Under the somber sleep of stones, a star is snuffed by a candle.

As Urist McKant Said, "I must act according to the maxim such that I can will that maxim to destroy everything beloved to me at the flip of a lever."

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #9 on: March 21, 2015, 02:54:58 am »

So, are you saying that with the information provided (based on the WIP posted by Toady), you can produce some kind of sample of music being played without extra human input? If so, I'm sure a lot of people would love to hear an example! Choose a form, explain what's going on and show us how it would sound. Otherwise to the non-musical, non-technical minded of us it all seems far too theoretical to get excited about.

It'd be great in-game just to get a 5-10 second sample when you select a band and bring up details on what they're up to.
Logged

Timeless Bob

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #10 on: March 21, 2015, 05:25:57 am »

Perhaps work with the people who put together the 'soundsense' utility to produce these procedural works of art - mixable music "genes" that correspond to each value in the generated style might end up with some pretty interesting "songs".
Logged
L33tsp34k does to English what Picasso did to faces.

Dwarfopoly
The Luckiest Tourist EVER
Bloodlines of the Forii

stolide

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #11 on: March 21, 2015, 12:38:59 pm »

So, are you saying that with the information provided (based on the WIP posted by Toady), you can produce some kind of sample of music being played without extra human input? If so, I'm sure a lot of people would love to hear an example! Choose a form, explain what's going on and show us how it would sound. Otherwise to the non-musical, non-technical minded of us it all seems far too theoretical to get excited about.

It'd be great in-game just to get a 5-10 second sample when you select a band and bring up details on what they're up to.

Yes!

https://soundcloud.com/nethodsod/the-grasping-oaks

So here are two approaches using The Grasping Oaks from the quote in a previous post.

The first method takes random notes from the appropriate chords. This will sound better. I decided to put the melody into the emu meter since it came first. I rolled dice to determine note, and if I rolled higher than the number of notes in the chord, no note was played.

The second method takes random notes from anywhere in the scale, this will be less predictable, but sound a little dissonant. It can't really get that dissonant, since only one note is playing at a time. If people want, I could go ahead and make another version of this same song using two or more voices.

The song is composed according to the rules, with meters rolling out past each other, not coinciding. The hand clapping is emu, myself knocking on a desk is otoga.

Until the 1:45 mark (right when the two meters coincide), it just follows the chords that were generated by Toady. Then, the melody stops briefly. It is picked up between 1:50 and 2:20 with a sequence of any notes from the scale that repeats four times, following the otoga meter. There is a brief rest from the melody, and it returns to the original two chords at 2:30.

The only problem with this music, is that it is a little repetitive. This could be solved by having more chords in the music, or by having more voices, whose layering in slightly different ways would provide much variation from little content. I also did not use the techniques that are typical of the form. such as arpeggios, but that would have been extremely dull without the choral elements that are typically present.
Logged
Under the somber sleep of stones, a star is snuffed by a candle.

As Urist McKant Said, "I must act according to the maxim such that I can will that maxim to destroy everything beloved to me at the flip of a lever."

Deboche

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #12 on: March 21, 2015, 04:06:58 pm »

I'm no music or coding expert but some time ago I found - haven't managed to find it again yet, I'll keep looking - a music generator that used the pentatonic scale. You could tell it to play certain notes, whichever ones you wanted, and it always sounded good. It might be possible to elaborate on that.

EDIT:
Apparently a music generator already exists or is this a trick?
http://codeminion.com/blogs/maciek/2008/05/cgmusic-computers-create-music/
« Last Edit: March 21, 2015, 04:11:22 pm by Deboche »
Logged

Inarius

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #13 on: March 21, 2015, 05:32:20 pm »

It exists, for sure. What i said is that it was quite hard to make if you wanted it to be good.
If Toady wanted it for real, he would have to work on it for several weeks, or perhaps months. Does it worth his time ? I'm not sure.

A soundsense would be a good idea.
EDIT : You asked him directly in FotF. It's a good idea.
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Procedurally Generated Music and Poetry
« Reply #14 on: March 21, 2015, 06:47:25 pm »


Yes!

https://soundcloud.com/nethodsod/the-grasping-oaks

Brilliant! OK, consider me excited for procedurally generated music.
Logged
Pages: [1] 2