Be a Supporter!

Music represented through logic?

  • 2,254 Views
  • 27 Replies
New Topic Respond to this Topic
Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician

Has anyone ever tried to write a piece using computational logic?

For instance, heres a simple side-chained bass, kick, snare and hi-hat beat that covers 1 measure (I've combined some basics of a few languages to help this make a little more sense)

//Setup One Measure

beat=1
While beat < 17
     if beat = 1 || 4 || 8 || 12  //When its the 1st ,4th ,8th or 12th beat, play kick sample
          playKick; //Play Kick Sample
     end
     if beat = 4 || 12
          playSnare; //Play Snare Sample
     end
     if beat%2 == 0 //If its a on-beat, play hi-hat
          playHiHat; //Play Hi-Hat Sample
     end
     if (playKick) == True
          Stop playBass; //Kill Bass Sample
     else
          playBass; //Play Bass Sample
     end
     beat = beat + 1;
End

You could probably wrap this in another loop that reiterates the measures to make a full song...

Anybody ever look at music like this?

Lachi
Lachi
  • Member since: Sep. 29, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-10 14:13:39 Reply

Chords, basses and other elements are quite easy. Try to do that with a melody...


SUCK MY KICK

Buoy
Buoy
  • Member since: May. 18, 2006
  • Offline.
Forum Stats
Member
Level 40
Musician
Response to Music represented through logic? 2012-12-10 14:16:02 Reply

this seems terribly inefficient

Megamannt92
Megamannt92
  • Member since: Mar. 22, 2006
  • Offline.
Forum Stats
Member
Level 03
Musician
Response to Music represented through logic? 2012-12-10 14:23:22 Reply

Ugh. My brain.

I just play music.


Hey check out my music! Its guitarlicious or something.... Pirate Metal! | Rock with guest Female Vocalist

GACBassPlayer
GACBassPlayer
  • Member since: Nov. 8, 2002
  • Offline.
Forum Stats
Member
Level 23
Melancholy
Response to Music represented through logic? 2012-12-10 15:42:50 Reply

At 12/10/12 02:16 PM, Buoy wrote: this seems terribly inefficient

Inefficient was exactly the word that came to mind.

Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-10 16:40:16 Reply

The point is not its in efficiency, but its concept. I agree it does sound like a pain in the ass and not quite practical, but I'm just curious about how it all could be modeled. I don't plan to use this method for a future song, but I wanna have another method of analysis to understand music.

That being said...

Why couldn't a melody be a randomized power-of-two value that that denotes 1/x for note length. Just make it legato from note to note. Have an array holding pitch values.

Lachi
Lachi
  • Member since: Sep. 29, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-10 16:53:37 Reply

At 12/10/12 04:40 PM, Centriptic wrote: Why couldn't a melody be a randomized power-of-two value that that denotes 1/x for note length. Just make it legato from note to note. Have an array holding pitch values.

A melody is a sequence of notes, with various characteristics for each note, etc.
You could build a motif or something, and make it various throughout the time... It seems quite stupid, but I understand your point


SUCK MY KICK

Step
Step
  • Member since: Nov. 4, 2007
  • Offline.
Forum Stats
Moderator
Level 25
Musician
Response to Music represented through logic? 2012-12-10 17:06:46 Reply

On a related note, while right now it seems like a stupid idea, I do believe that one day a computer will be able to create chord progressions, melodies and sounds all on its own automatically, and eventually automatically generate a song that has a coherent structure, good melodies and sounds that fit with each other. I don't think a computer will be able to surpass the creativity and originality that a human being is capable of for a long long while, but I think this idea is very much a possibility.


Review Request Club | CHECK THIS OUT | Formerly Supersteph54 | I'm an Audio Moderator. PM me for Audio Portal help.

BBS Signature
Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-10 17:09:43 Reply

At 12/10/12 04:53 PM, Lachi wrote:
At 12/10/12 04:40 PM, Centriptic wrote: Why couldn't a melody be a randomized power-of-two value that that denotes 1/x for note length. Just make it legato from note to note. Have an array holding pitch values.
A melody is a sequence of notes, with various characteristics for each note, etc.
You could build a motif or something, and make it various throughout the time... It seems quite stupid, but I understand your point

You could make it random, as long as it played in key. It might take a 100 renders the generator, but I'd feel your bound atleast once to a get a melody out of it.

eatmeatleet
eatmeatleet
  • Member since: Nov. 8, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Music represented through logic? 2012-12-10 17:24:22 Reply

Exception thrown (uncought exception-your sound is clipping) lrn2code


BBS Signature
Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-10 17:58:43 Reply

At 12/10/12 05:24 PM, eatmeatleet wrote: Exception thrown (uncought exception-your sound is clipping) lrn2code

Nice...

Now that I think about it, you could even code a very basic delay FX.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Music represented through logic? 2012-12-10 19:13:33 Reply

You've discovered my secret plan >:(

But yeah, I'm going into computer science next semester and I want to make a video game that uses this sort of thing for the BGM. I tried doing it with midi before in C++ but my goal was randomization more than something palpable.

NinjaGuy
NinjaGuy
  • Member since: Jul. 3, 2006
  • Offline.
Forum Stats
Member
Level 20
Musician
Response to Music represented through logic? 2012-12-10 20:07:53 Reply

At 12/10/12 02:16 PM, Buoy wrote: this seems terribly inefficient

srsly, the point of code is to do a job with as little work as possible, music is feeling, and essentially, work. programming and logic are naturally the opposite of music and most forms of expressions. The only expression I can ever seem to find in coding is the method by which the solution is derived. Music is about the process, the patterns of the chord changes, the simplicity one may find in a less complex piece cannot rewrite the emotion or feeling placed in a song crafted entirely by ear.

Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Music represented through logic? 2012-12-11 00:47:03 Reply

Overtone is a Clojure library for procedurally building songs using functional constructs which explores this very idea.

Personally I've had an interest in building a synth library in Haskell or Scheme but don't have time to toy around with things like that. I did do some mathematical analysis, though.

Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-11 01:35:03 Reply

At 12/11/12 12:47 AM, Blackhole12 wrote: Overtone is a Clojure library for procedurally building songs using functional constructs which explores this very idea.

Wow, right along the lines of how I was thinking... Too cool.

Heres a guy doing a whole set with it haha... http://vimeo.com/46867490

The-iMortal
The-iMortal
  • Member since: Aug. 30, 2008
  • Offline.
Forum Stats
Member
Level 04
Musician
Response to Music represented through logic? 2012-12-11 07:01:28 Reply

At 12/11/12 06:24 AM, Thief1337 wrote: A DAW fulfill this job for you already. Your job is to write music and be an alive spirit, not a robot.

I agree with this (though, I would use the term emotion rather than spirit). And this is coming from somebody who's spent 80% of audio/music time on production tools and synthesis; all the programming aspects of music.

I love all kinds of electronic music... well, most kinds. You can always tell when there's emotion put into a track. Even if there is no live recording, but all instruments have been programmed, you can hear some form of emotion in a good track. Many tracks, you cannot hear the emotion. Though, I don't think to myself, "OMG NO EMOTION," I think "sounds boring... like nothingness."

This is one aspect among many which separates the best electronic producers from the mediocre. I think Skrillex is an amazing producer, mainly for his sound-design skills, but as well for his music. Many people may argue he puts no emotion into his productions and it's all just sound, but I strongly disagree.

However, producers such as Excision and Datsik, as popular as these Dubstep producers are, I listen to their tracks and am bored shitless. To me, their tracks really sound like something just programmed in. No emotion. Of course, I have not listened to many tracks from these artists. I stopped when I realised they didn't do much for me.

So to answer OP's question:

At 12/10/12 01:51 PM, Centriptic wrote: Anybody ever look at music like this?

The answer is no.

Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Music represented through logic? 2012-12-11 13:40:38 Reply

At 12/11/12 07:01 AM, The-iMortal wrote:
At 12/10/12 01:51 PM, Centriptic wrote: Anybody ever look at music like this?
The answer is no.

This is wrong, as many mathematicians and computer scientists have been studying musical patterns in an attempt to answer the question of what music sounds good to us and why. Seeing as our western system of tonality has a mathematical basis (to go up one octave, double the frequency), it seems obvious that there must be underlying patterns that we are identifying. One group, whom I no longer have a link to, used a genetic algorithm with human input to try and teach a computer how to create music. There have been numerous other attempts using markov chains and nondeterministic state machines at randomly generating music.

One particularly notable instance of this is the game Spore, which uses procedurally generated ambient music by randomly generating a melody based on note-compatibility in a markov chain and then assigning it to an instrument from a predesigned set of sounds. You just hit the "random" button and it'll randomly generate a melody for you.

There are other cases where a pentatonic scale is used in such a way that it eliminates dissonance between the possible notes, which allows a computer to simply randomly select notes and often come up with something that sounds good anyway. The infinitely popular tonematrix flash "game" used this to great effect. Otomata is another variation on this, except it has a whole slow of various strange scales to choose from.

So the short answer is "Yes", because a whole slew of very smart people have thought about music using logical constructs and mathematical logic. I'm sure the musicians here aren't very happy about that, of course.

Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Music represented through logic? 2012-12-11 15:54:33 Reply

At 12/11/12 02:14 PM, Thief1337 wrote:
At 12/11/12 01:23 PM, dem0lecule wrote: Music is just mathematical arrangement.
At 12/11/12 01:40 PM, Blackhole12 wrote: I'm sure the musicians here aren't very happy about that, of course.
Short answer.

See?

Music represented through logic?

The-iMortal
The-iMortal
  • Member since: Aug. 30, 2008
  • Offline.
Forum Stats
Member
Level 04
Musician
Response to Music represented through logic? 2012-12-11 16:32:47 Reply

At 12/11/12 01:40 PM, Blackhole12 wrote: So the short answer is "Yes", because a whole slew of very smart people have thought about music using logical constructs and mathematical logic. I'm sure the musicians here aren't very happy about that, of course.

You do have a point. I guess alot of the emotion in "programmed" tracks is through the actual programming aka mixing, sound design etc, as well as melody. And who hasn't discovered good melodies by accident? Maybe it's the good "programming" which brings emotion into a track.

At 12/11/12 02:14 PM, Thief1337 wrote:
At 12/11/12 01:23 PM, dem0lecule wrote:
Music is just mathematical arrangement.

Short answer.

Unnecessary.

Nav
Nav
  • Member since: Jan. 6, 2007
  • Offline.
Forum Stats
Member
Level 17
Audiophile
Response to Music represented through logic? 2012-12-12 14:18:18 Reply

At 12/11/12 01:23 PM, dem0lecule wrote: I use Chuck. I used to do live coding with friends for parties in college. Also use C++ in music for demoscene.

I was always under the impression that demoscene artists used trackers.

Writing music directly in C++ doesn't sound very convenient... Why would you choose that over trackers? I mean, sure, you'll gain a small performance and size increase, but is the increase in pain-in-the-ass really worth it? :S

Nav
Nav
  • Member since: Jan. 6, 2007
  • Offline.
Forum Stats
Member
Level 17
Audiophile
Response to Music represented through logic? 2012-12-12 14:19:27 Reply

At 12/12/12 02:18 PM, Nav wrote: size increase

Excuse me, I meant a decrease in size (which is good news).

Axel7
Axel7
  • Member since: Dec. 3, 2012
  • Offline.
Forum Stats
Member
Level 04
Musician
Response to Music represented through logic? 2012-12-12 14:59:00 Reply

At 12/10/12 07:13 PM, WizMystery wrote: You've discovered my secret plan >:(

But yeah, I'm going into computer science next semester and I want to make a video game that uses this sort of thing for the BGM. I tried doing it with midi before in C++ but my goal was randomization more than something palpable.

I was JUST thinking as I read this thread "maybe good enough to randomly generate 8 bit music for games" XD

Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Music represented through logic? 2012-12-12 15:14:08 Reply

At 12/12/12 02:18 PM, Nav wrote: I was always under the impression that demoscene artists used trackers.

This is only sometimes correct. If you are writing a 64kb demo, you usually have to either write something specifically for that demo or come up with an extremely compact tracker of your own. It probably ends up being a weird combination of both.

eatmeatleet
eatmeatleet
  • Member since: Nov. 8, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Music represented through logic? 2012-12-12 18:29:21 Reply

At 12/12/12 05:59 PM, dem0lecule wrote: Not self-advertising! Just an example for my previous post.
http://www.newgrounds.com/audio/listen/514820
Rendered and uploaded this beast just-for this conversation. I do 32k executable music too. I still have to figure out how to pack the actual exe properly to upload, because antivirus flagged it as malware >.<

autism at it's best


BBS Signature
deadlyfishes
deadlyfishes
  • Member since: May. 15, 2011
  • Offline.
Forum Stats
Member
Level 05
Musician
Response to Music represented through logic? 2012-12-12 18:51:15 Reply

At 12/10/12 01:51 PM, Centriptic wrote: Has anyone ever tried to write a piece using computational logic?

For instance, heres a simple side-chained bass, kick, snare and hi-hat beat that covers 1 measure (I've combined some basics of a few languages to help this make a little more sense)

//Setup One Measure

beat=1
While beat < 17
if beat = 1 || 4 || 8 || 12 //When its the 1st ,4th ,8th or 12th beat, play kick sample
playKick; //Play Kick Sample
end
if beat = 4 || 12
playSnare; //Play Snare Sample
end
if beat%2 == 0 //If its a on-beat, play hi-hat
playHiHat; //Play Hi-Hat Sample
end
if (playKick) == True
Stop playBass; //Kill Bass Sample
else
playBass; //Play Bass Sample
end
beat = beat + 1;
End

You could probably wrap this in another loop that reiterates the measures to make a full song...

Anybody ever look at music like this?

Yes, there is a whole genre of music based on creating music this way.

This is fixed media + piano
http://www.youtube.com/watch?v=UNcVjQUZ5VI

Also, there were some composers who would program music into a computer which then the computer would be another "instrument" in the ensemble:
http://www.youtube.com/watch?v=47BrzGW9DRg

http://www.youtube.com/watch?v=47BrzGW9DRg


<Professional Audio Specialist>
OFFICIAL MUSIC SITE!
Check out something I did for NATA 2013! Hikarian's winning NATA 2013 Entry

BBS Signature
Kajenx
Kajenx
  • Member since: Dec. 1, 2006
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to Music represented through logic? 2012-12-15 00:35:31 Reply

Haha, you guys wouldn't have survived writing for video games in the early days. Isn't this how they had to do it?


BBS Signature
Poniiboi
Poniiboi
  • Member since: Mar. 1, 2012
  • Offline.
Forum Stats
Member
Level 17
Game Developer
Response to Music represented through logic? 2012-12-18 00:26:32 Reply

At 12/10/12 01:51 PM, Centriptic wrote: Anybody ever look at music like this?

I mean, this is basically what the computer is doing when MIDI information is given to it by your input.


no, really...DON'T CLICK THE PIC

BBS Signature
Centriptic
Centriptic
  • Member since: Dec. 9, 2012
  • Offline.
Forum Stats
Member
Level 01
Musician
Response to Music represented through logic? 2012-12-18 13:38:32 Reply

At 12/18/12 12:26 AM, SenatorJohnDean wrote:
At 12/10/12 01:51 PM, Centriptic wrote: Anybody ever look at music like this?
I mean, this is basically what the computer is doing when MIDI information is given to it by your input.

Yeah the more I analyzed it, I realized that... Pretty much just tons of nested loops that fit 0:(length(measure)*4)-1