What would it take to program a "rap song generator"?

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

What would it take to program a "rap song generator"?

Postby LSK » Sat Sep 17, 2011 5:52 pm UTC

I'm thinking of a program that does the following:

- User specifies various stylistic circumstances and constraints.
- Program generates a rap beat.
- Program uses Markov chains to write a rap song to fit the beat.
- Speech synthesis is used to perform the song; the program automatically incorporates inflection.
- The final result is spat out as an mp3.

What would it take to make this program? (More importantly, why doesn't it exist already?)
User avatar
LSK
 
Posts: 573
Joined: Fri Oct 06, 2006 12:25 am UTC
Location: 60645

Re: What would it take to program a "rap song generator"?

Postby BotoBoto » Sat Sep 17, 2011 7:03 pm UTC

Mostly intonation and the correct use of it is hard to achieve. Computer voices are easy to separate from human voices.
User avatar
BotoBoto
 
Posts: 194
Joined: Mon Mar 09, 2009 9:31 pm UTC

Re: What would it take to program a "rap song generator"?

Postby gorcee » Mon Sep 19, 2011 6:18 pm UTC

They've done it before, but with pop music. I'm pretty sure the result was called "Coldplay."

But seriously, it's not been done because it's a lot of work for something that would ultimately be only marginally interesting.

Rap isn't about making words rhyme to a beat. It's about context and culture. You've got like 170k+ words in the English language, not counting conjugations, participles, vernacular and slang. Now you have to fit them into context, or you're going to end up with verses like "I got bitches and blow all up in my room / Yo, I be runnin' hoes all up in this cwm / Y'all have had enough of this economic discord / Let's just rock a beat on my pimpin' harpsichord".

IBM's Watson had some of the best engineers in the world working on it, and it still failed to understand the context of questions like, "Its largest airport was named for a World War II hero; its second largest, for a World War II battle."

So making something make actual music, or even an approximation, would be really hard. Hell, even dealing with rhyming and intonation dynamically is a really difficult project. And in the end, you'll do a lot of work for what amounts to a chuckle.
gorcee
 
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC
Location: Charlottesville, VA

Re: What would it take to program a "rap song generator"?

Postby cemper93 » Wed Sep 21, 2011 8:08 pm UTC

Slightly related:
http://www.youtube.com/watch?v=RmtRju2FfiI
http://en.wikipedia.org/wiki/Hatsune_Miku

No, it's not generated. But... after listening to this for hours, you can't help but start to think it could be ;)
cemper93
 
Posts: 128
Joined: Sun Feb 20, 2011 2:35 pm UTC

Re: What would it take to program a "rap song generator"?

Postby TheShadowFog1 » Mon Sep 26, 2011 4:24 pm UTC

Why would you even want something like this? o_o
User avatar
TheShadowFog1
 
Posts: 6
Joined: Mon Sep 26, 2011 4:17 pm UTC

Re: What would it take to program a "rap song generator"?

Postby Dason » Tue Sep 27, 2011 4:06 am UTC

TheShadowFog1 wrote:Why would you even want something like this? o_o

Cause why the hell not?
double epsilon = -.0000001;
User avatar
Dason
 
Posts: 1264
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: What would it take to program a "rap song generator"?

Postby RoadieRich » Tue Sep 27, 2011 7:00 am UTC

TheShadowFog1 wrote:Why would you even want something like this? o_o

Because if there's the slightest chance of anyone ever producing "good" rap, letting geeks control its genesis is probably one of the few ways it can happen.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: What would it take to program a "rap song generator"?

Postby TheShadowFog1 » Tue Sep 27, 2011 11:13 am UTC

RoadieRich wrote:
TheShadowFog1 wrote:Why would you even want something like this? o_o

Because if there's the slightest chance of anyone ever producing "good" rap, letting geeks control its genesis is probably one of the few ways it can happen.

I guess that makes sense. :|
User avatar
TheShadowFog1
 
Posts: 6
Joined: Mon Sep 26, 2011 4:17 pm UTC

Re: What would it take to program a "rap song generator"?

Postby gorcee » Tue Sep 27, 2011 9:07 pm UTC

RoadieRich wrote:
TheShadowFog1 wrote:Why would you even want something like this? o_o

Because if there's the slightest chance of anyone ever producing "good" rap, letting geeks control its genesis is probably one of the few ways it can happen.


There is plenty of good rap out there. Rap is a genre that has to be appreciated in the context of its audience, however. And geeks tend to have few things in common with its intended audience.

There is also plenty of bad rap out there which makes money just by sounding like rap.
gorcee
 
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC
Location: Charlottesville, VA

Re: What would it take to program a "rap song generator"?

Postby RoadieRich » Wed Sep 28, 2011 6:26 am UTC

gorcee wrote:
RoadieRich wrote:
TheShadowFog1 wrote:Why would you even want something like this? o_o

Because if there's the slightest chance of anyone ever producing "good" rap, letting geeks control its genesis is probably one of the few ways it can happen.


There is plenty of good rap out there. Rap is a genre that has to be appreciated in the context of its audience, however. And geeks tend to have few things in common with its intended audience.

There is also plenty of bad rap out there which makes money just by sounding like rap.

I was being flippant... I just forgot to add the smiley.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: What would it take to program a "rap song generator"?

Postby gorcee » Wed Sep 28, 2011 2:58 pm UTC

RoadieRich wrote:
gorcee wrote:
RoadieRich wrote:
TheShadowFog1 wrote:Why would you even want something like this? o_o

Because if there's the slightest chance of anyone ever producing "good" rap, letting geeks control its genesis is probably one of the few ways it can happen.


There is plenty of good rap out there. Rap is a genre that has to be appreciated in the context of its audience, however. And geeks tend to have few things in common with its intended audience.

There is also plenty of bad rap out there which makes money just by sounding like rap.

I was being flippant... I just forgot to add the smiley.


That... would make a difference ;)
gorcee
 
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC
Location: Charlottesville, VA

Re: What would it take to program a "rap song generator"?

Postby freakish777 » Thu Sep 29, 2011 7:38 pm UTC

LSK wrote:I'm thinking of a program that does the following:

- User specifies various stylistic circumstances and constraints.
- Program generates a rap beat.
- Program uses Markov chains to write a rap song to fit the beat.
- Speech synthesis is used to perform the song; the program automatically incorporates inflection.
- The final result is spat out as an mp3.

What would it take to make this program? (More importantly, why doesn't it exist already?)


It doesn't exist yet because it's really hard.

There's DAW (Digital Audio Workstation) programs out there, they are all intended for humans to use. So you have two options:

A) Write your own DAW first (this is fairly tough to begin with, and requires several hard working Software Engineers familiar with audio engineering, potentially you strip it down to just a drum machine for the first revision and add other features of a DAW later)

B) Write a program that allows a bot to control a DAW (in which case it would need to "learn" how to use the program).

Once you do this... now you need to generate a "rap beat." Are all rap beats the same? No. Which one do we use? Do you have a library of rap beats that you choose one from random at? Probably not (there's a potentially limitless combination). Do you try to randomly create one? This is probably also no (because then you need to screen out bad beats). Do you use some type of constraint satisfaction to ensure "head-noddic" or "danceable" beats? If so, how do you define that? Keep in mind that if you go with a programmatic approach instead of a randomized approach, your program is likely to churn out similar sounding beats over and over again (which gets boring) and if you use a randomized approach, you run the risk of churning out stuff that's is unlistenable over and over.

Use a Markov Chain to write lyrics. This is mind-bogglingly difficult to generate anything "good." I mean, again, you can try random words that fit various constraints (for instance, each line must be in iambic quadrameter, each two lines must be a rhyming couplet, each two lines must be grammatically correct sentences). Get the lyrics to fit the beat. If you just say "It's all in 4/4, the lyrics just need to be in quadrameter" you're probably fine. But if you listen to any big name rapper out there, they care about where the beats actually occur, which means now you have another consideration to add to your constraints. Once you have some random words created that fit the beat, now you need to answer:

What's the point of this song?
What emotion does it evoke?
Does it tell a coherent story?
Is there tension, climax, and relief?

If you go with a base of "generate words randomly" and then proceed to screen out things that are unintelligible and uninteresting I think you're going to run into a couple problems not just on the things that computers have trouble with (how does a computer know what words aren't interesting, what isn't a good story, what constitutes as tension, what constitutes as emtional, etc), but also on things that computers do decently (randomization and speed) due to the fact that you will have so much that needs to be screened out.


Speech synthesis isn't tough. Inflection is.


Bonus round: Here's some things your hypothetical program is missing, melody, song progression (the same beat over and over for 3 minuets? boooooooooring), mixing and mastering (should the voice be left panned here? how about the kick drum?).
User avatar
freakish777
 
Posts: 328
Joined: Wed Jul 13, 2011 2:14 pm UTC

Re: What would it take to program a "rap song generator"?

Postby RoadieRich » Thu Sep 29, 2011 8:07 pm UTC

freakish777 wrote:B) Write a program that allows a bot to control a DAW (in which case it would need to "learn" how to use the program).

Not actually all that difficult: most packages (I'm thinking specifically of Propellorhead's Reason, but it applies to most pro-level ones) can be entirely midi controlled.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: What would it take to program a "rap song generator"?

Postby bigglesworth » Thu Sep 29, 2011 10:34 pm UTC

Instead of generating beats, the bot could search a library of popular music to sample from.
Generation Y. I don't remember the First Gulf War, but do remember floppy disks.
User avatar
bigglesworth
 
Posts: 6595
Joined: Sat Apr 07, 2007 9:29 pm UTC
Location: The British Empire

Re: What would it take to program a "rap song generator"?

Postby freakish777 » Fri Sep 30, 2011 4:22 pm UTC

RoadieRich wrote:
freakish777 wrote:B) Write a program that allows a bot to control a DAW (in which case it would need to "learn" how to use the program).

Not actually all that difficult: most packages (I'm thinking specifically of Propellorhead's Reason, but it applies to most pro-level ones) can be entirely midi controlled.



The hard part isn't the control. The hard part is the learning. I'm less familiar with Reason and Cakewalk than with Pro Tools and FL Studio, there are hundreds if not thousands or tens of thousands of potential commands that those programs have (I haven't touched Reaper or Cubase yet, but I imagine they're equally complex).

So, for instance, with FLStudio, you'd want your "Beat Creation Bot" to first load some preset template for just making a beat (all your instruments are percussion/drums). Then open up a pattern (let's restrict our bot to filling out one pattern, or one loop if you will, it can always call this functionality more times when, as software engineers, we get around to the next iteration in our dev cycle). Next it'll randomly pick how many beats that pattern should have. Let's assume 4/4 time signature, and that we want to limit it to between 1 and 16 measures (between 4 and 64 beats, and we'll also assume no half measures to keep things "clean" sounding), and we weight heavier for shorter measures (let's say 50% 1-4 measures, 25% 5-8 measures, 25% 9-16 measures). Next we fill in notes/beats for our measures on a piano roll/midi in for the first instrument (let's assume kick drum, and than we have our template set up in such a way that we prioritize instruments, so a "more important" instrument, like Kick Drums, Snares, Hi Hats, etc, are near the top, Tom Drums, Claps, Tambourines, etc are in the middle, and Kettle Drums, Gongs, Shakers, etc are at the bottom, or whatever most pleasing to least pleasing sound definition you want to use). If we're doing random notes, again, we probably want to do something where we weight notes centered on beat as being higher (if you've ever been to a concert and hear the drummer count 1, 2, 3, 4 before a song, on beat notes are on the 1s, 2s, 3s and 4s), off beat notes to be lower (if you've heard someone count 1 an 2 an 3 an 4 an, these are on the ans), and off off beats to be lower still (these would be between 1 and an, you typically don't place drum notes there, with some exceptions, like Hats, Tambourines, or a build). Then repeat for each instrument (you may need some special rules surrounding each instrument, like Hats and Tambourines should be more filled in then snares and kicks), and possibly follow some constraint rules after each instrument is done (for instance, if you've made a 4 on the floor beat with the kick drum coming down on 1, 2, 3, 4 of almost every measure, you probably don't want a whole lot of other instruments having notes on those beats also).

bigglesworth wrote:Instead of generating beats, the bot could search a library of popular music to sample from.


This sounds like the way to go. Except instead I think you would want your system to perform some EQing to try and isolate the beat for the entire song, then cut it into the various looped sections. Once it had the song cut up that way, it could store the pattern (say it's a simple step beat, alternating kicks on 1 and 3, and snares on 2 and 4, it stores this pattern as "INSTRUMENT A: X _ X _. INSTRUMENT B: _ X _ X." or whatever and then when it decides on this pattern at a later time, it can decide on drums to put in for INSTRUMENT A and INSTRUMENT B. So you'd have a gigantic library of beats in loop form (including builds, tension relief, etc), and then you could maybe do something where these beats are genre tagged and "part of song" tagged, and try to put them together in a way that would make sense (you probably don't want to start a song with a climatic drum loop, and you probably don't want to a Jazz beat in your Rap song, maybe in your hip hop song though).
User avatar
freakish777
 
Posts: 328
Joined: Wed Jul 13, 2011 2:14 pm UTC

Re: What would it take to program a "rap song generator"?

Postby gorcee » Fri Sep 30, 2011 6:20 pm UTC

I think it would be more interesting to take a thematic approach, and then write the code to generate that.

For instance, rap songs tell a story. Good stories have ups and downs and climaxes. Good songs have those, too. Different beats convey different emotions: anger, rage, remorse, love, etc. Perhaps if you can create a generic storyline (ie, Eminem's recent song with Rihanna, "Love the way you lie" or whatever, would go something like Frustration -> love -> anger -> (remorse) -> rage, possibly with multiple simultaneous layers, etc [it's actually quite a complex song, with multiple dichotomies, etc. Love him or hate him, Eminem is a talented songwriter that doesn't really get enough credit for his craftsmanship]), and then identify modes of beats/instruments/movements that associate strongly with those emotions.
gorcee
 
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC
Location: Charlottesville, VA

Re: What would it take to program a "rap song generator"?

Postby freakish777 » Wed Oct 05, 2011 7:26 pm UTC

gorcee wrote:Love him or hate him, Eminem is a talented songwriter that doesn't really get enough credit for his craftsmanship]), and then identify modes of beats/instruments/movements that associate strongly with those emotions.


Let's agree that Eminem is a talented lyricist with exceptional execution that doesn't get enough credit (according to Wikipedia, he is not the sole writer of his songs on, well, basically any of his albums, The Marshall Mathers EP and Encore conveniently don't have Writers sections like the other album entries do). How much of the beat, bass line, and other instrumentation he writes is anyone's guess (mine would be not a whole lot, but definitely some of it).
User avatar
freakish777
 
Posts: 328
Joined: Wed Jul 13, 2011 2:14 pm UTC

Re: What would it take to program a "rap song generator"?

Postby Afif_D » Fri Oct 07, 2011 5:34 pm UTC

Rap is all about rage. A computer program can never understand that. Take a look at eminem.
Image
User avatar
Afif_D
 
Posts: 172
Joined: Wed Oct 06, 2010 2:56 pm UTC


Return to Coding

Who is online

Users browsing this forum: No registered users and 8 guests