Welcome, Guest. Please login or register.
Did you miss your activation email?

Forum Shops

Affiliates



Become a Forum Friend and get extra permissions and DISCOUNTS from our sponsors!
plus many extra forum privileges (like 'edit post', avatars and signatures)

Author Topic: My Computer wrote this one!  (Read 5262 times)

0 Members and 1 Guest are viewing this topic.

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
My Computer wrote this one!
« on: Jan 23, 2004, 09:28:41 PM »
Hey, I got to thinking after talking with Floyd about ALL the possible combinations of 8 notes to start a song. Got me to thinking, what ARE all the combinations? There must be lots! I thought about writing a program to see them all, it would cover every combination, and be quite boring, I'd think, so I decided to just put random notes in there, heres what I got when I asked for ten four note meaures:

X:1
T:Jacks little ABC Basic Program Song
R:IBM Pentium Reel
S:JT and QuickBasic 4.1
M:4/4
L:1/8
Q:1/2=50
K:C
| B,B,e^d | dFG^A, | EG^D^A | G,C^A,A, | A^ce^A, | ^Ge^G,A | G,^CF^D | ^G,cFE |
eeDB | GcF^c |



If you care, this is the program, its in QuickBasic 4.0, and should work fine in QBasic.

CLS
PRINT "This program will attempt to putout the first several hundred "
PRINT "combinations of all the notes possible in a single 8 note measure."
PRINT "in ABC code starting with 'G,', the lowest note on fiddle and going"
PRINT "up to 'e', the open E string on fiddle"
PRINT

REM * housekeeping **

DIM note(22) AS STRING

RANDOMIZE TIMER

REM ** load up array **

note(1) = "G,"
note(2) = "^G,"
note(3) = "A,"
note(4) = "^A,"
note(5) = "B,"
note(6) = "C"
note(7) = "^C"
note(8) = "D"
note(9) = "^D"
note(10) = "E"
note(11) = "F"
note(12) = "^F"
note(13) = "G"
note(14) = "^G"
note(15) = "A"
note(16) = "^A"
note(17) = "B"
note(18) = "c"
note(19) = "^c"
note(20) = "d"
note(21) = "^d"
note(22) = "e"

REM ** kick off the song **

PRINT "X:1"
PRINT "T:Jacks little ABC Basic Program Song"
PRINT "R:IBM Pentium Reel"
PRINT "S:JT and QuickBasic 4.1"
PRINT "M:4/4"
PRINT "L:1/8"
PRINT "Q:1/2=50"
PRINT "K:C"

REM ** first measure **

PRINT "| ";

x = 0

DO
 
 FOR a = 1 TO 4
   'PRINT (INT(RND * 22 + 1));
   PRINT note(INT(RND * 22 + 1));
 NEXT

 PRINT " | ";

 x = x + 1

LOOP UNTIL x = 10

PRINT
PRINT
PRINT
PRINT "done!"






There, now someone out there top THAT! ;) (I may want to redo this without the chromatic notes.)

Jack
« Last Edit: Jan 23, 2004, 09:30:20 PM by Jack002 »

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #1 on: Jan 23, 2004, 09:37:29 PM »
Here, I removed all the chromatics and added rests, better now, huh? ;)

X:1
T:Jacks little ABC Basic Program Song
R:IBM Pentium Reel
S:JT and QuickBasic 4.1
M:4/4
L:1/8
Q:1/2=50
K:C
| eEcF | cEFF | B,G,dc | zFGA | GEcA | eAdE | BA,eG | GCA,G, | EeG,A | AB,zF |

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #2 on: Jan 23, 2004, 10:48:31 PM »
Hey jack I took the trouble to listen to both your tunes and ..... well lets just say I think we still need thw abc section in the forum. I didn't think QuickBasic was still around.

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #3 on: Jan 26, 2004, 02:21:18 PM »
 :bworm:Floyd, yeah, I know, not much of a masterpiece, huh? ;) I needs control over how far the next note can go, and some way to make it stay in key. I just thought that it was a good illustration to how most of the "all perutations of 8 notes" would sound. ;)

Mr. editor, you can remove this thread when you'd like to, I'll understand. ;) :hungo:

Jack
« Last Edit: Jan 26, 2004, 02:22:01 PM by Jack002 »

Offline Pilgrum

  • Full Member
  • ***
  • Posts: 878

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Level 5 Super Combination
Re:My Computer wrote this one!
« Reply #4 on: Jan 26, 2004, 06:13:27 PM »
Do any of these songs come with lyrics?

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #5 on: Jan 26, 2004, 06:25:21 PM »
Do any of these songs come with lyrics?
Nope, not yet. I'm sure you'll be sorry when they do too! ;) Have you heard them?

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #6 on: Jan 26, 2004, 07:35:03 PM »
Hey Jack if you continue to run this program there is a strong possibility that the same tune will be generated twice but I'm sure you will notice that when it happens.

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #7 on: Jan 26, 2004, 08:42:04 PM »
Strong? No, not even slim, like nil! And when I do hear it again, I'll know it right away! ;) Now, how long do I need to run it till it outputs the exact copy of Bethovens 5th? ;)

Mark, did you like it? ;)

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #8 on: Jan 27, 2004, 03:20:34 PM »
Well now, That tune made me cry.  :smile2:

That's cool Jack. I always thought you were a tinkerer. Thanks for sharing. qbasic? I haven't see that for years even though I used to love it.
« Last Edit: Jan 27, 2004, 11:10:50 PM by Mark Cordova »

Offline Martin

  • Full Member
  • ***
  • Posts: 578

  • Total Badges: 24
    Badges: (View All)
    Tenth year Anniversary Level 5 Super Combination
Re:My Computer wrote this one!
« Reply #9 on: Jan 31, 2004, 05:11:52 PM »
Thinking about Jack's Magical Music Maker, and te question about what makes a good tune, I got to thinking of one way to generate tunes without sweat.

Take, say, all the jigs in D that you can find, snip them up into bars, and then select from those bars at random, and paste them together. An added sophistication would be to designate the bars as 1st, 2nd, 3rd etc. in the database, so they could only be selected for the correct part of a tune.

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #10 on: Feb 02, 2004, 03:22:56 PM »
That's along the lines of what I was thinking myself Martin. Lot's of things to think about. By the same token we could simplify all of those expressions into mere patterns and apply any key to the pattern.

Let's say you started in the Key of C and your expression is an Arpeggio walkup  G,CE Gce|   So you switch keys but the pattern is the same DGB dgb| You program in patterns and let the keys translate them. More thinking, more thinking. So far we have about 10,000 lines of code to generate a good tune. Patterns can be updated by downloading the latest pattern file. Jack - the qbasic has to go. translate it into VB. ;)  

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #11 on: Feb 02, 2004, 06:16:47 PM »
I thought about doing something similar but never got around to doing it. I have a few thousand irish tunes in abc format on my computer and a few thousand scottish tunes as well.  I thought it would be neat to write a program that translates them all to the key of C and searches through them all to list all of the unique first bars, second bars etc.  Then see if you can say anything about the difference between scotish and irish music based on this.  But thats alot of work so i never did it.

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #12 on: Feb 02, 2004, 07:28:15 PM »
Floyd, You need the transpose-o-matic program. You input the ABC's and the Key then tell it what key to transpose to. Major signatures only. The same can be done for minor signatures and the base would be A minor.

For a mere $10,000 I'll write the code for you. For an additional $10,000 - $90,000, I'll make sure it works. ;)
« Last Edit: Feb 02, 2004, 10:00:13 PM by Mark Cordova »

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #13 on: Feb 02, 2004, 08:54:08 PM »
A bargin at twice the price

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #14 on: Feb 02, 2004, 10:02:32 PM »
Opps - I need to amend part of that deal.

For an additional $10,000 - $90,000, I'll make sure it works or work two calendar months on the project whichever comes SOONER. ;)

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #15 on: Feb 03, 2004, 02:15:00 AM »
I hope your programing skills are as good as your back peddling!

Offline Martin

  • Full Member
  • ***
  • Posts: 578

  • Total Badges: 24
    Badges: (View All)
    Tenth year Anniversary Level 5 Super Combination
Re:My Computer wrote this one!
« Reply #16 on: Feb 03, 2004, 11:48:19 AM »
As a statistics fan as well as a part time musician, I may do this bit of analysis, if only in a limited fashion.

Mark - how would you label the notes using an interval-only system? Use 1 as the key note, etc? e.g. C D E F  becomes 1 3 5 6? Or start with Bottom G=1 and number every note from there up?

I'll probably start using abc only because it's easier to do quickly, and doesn't need re-translating back into music afterwards.

Here's what I'm thinking of doing - using an excel spreadsheet, Column A = Tune name, B= bar 1, C= bar 2 etc. Thus the spreadsheet ends up 17 columns across.

Once I have a table of tunes (I'll start on D jigs from the Dave Townsend collection) keep that sheet as a master, and then sort the data in various ways to shake the tree and see what falls out.

Offline simon

  • Moderator
  • Sr. Member
  • *****
  • Posts: 2,248

  • Total Badges: 28
    Badges: (View All)
    Apple User Search Tenth year Anniversary
Re:My Computer wrote this one!
« Reply #17 on: Feb 03, 2004, 12:21:13 PM »
I did some machine learning stuff a few years back, looking at learning algorithms for sorting text files. The idea is you feed web pages, emails, research paper abstracts or whatever into the program and tell it how much you like each one. After you've put enough in for the program to index and weight key words, it can suggest stuff you'd be interested in.

It's taken off in the last few years (not because of anything I did or I'd be a richer man than I am ;) ), and it's used in email filtering software, web sites like Amazon and so forth.

I'm sure you could use similar techniques to make a learning algorithm for generating tunes. People are already doing it, though I haven't heard of anyone using it for traditional music. It's a little more advanced than qbasic, but I make no claims to be an expert. There's freely available code on academic sites out there for Bayesian and genetic algorithms and all sorts of exotic beasts, and it wouldn't be that hard to set something up and play about with it. In the unlikely event that I get round to trying it, I'll let you know. ;)

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #18 on: Feb 03, 2004, 03:16:58 PM »
I hope your programing skills are as good as your back peddling!

Ahh Floyd, Even though I'm the absolute best programmer in the world, although there may be a bunch of people who do some things better than me. And it really depends on the languages you choose. I'm not really the best at every single programing language, just a new program language that I devised while I have been typing this thread called back peddling 2000 for cruddy programers. Yep, I am the best except for those who are better than me.
 
If you really want to see someone back pedal - watch this. Send me a check for 10,000 and I'll start programming as soon as it clears.  :beatnik2:

Martin, you hit it on the nose the first time

Quote from: Floyd
C D E F  becomes 1 3 5 6?  
Quote



Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #19 on: Feb 04, 2004, 03:53:04 PM »
Mark, you'd make a better lawyer than a programmer! ;) I like that idea of storing lots of bars and putting them out randomly, but I'd rather have a process that makes the notes one at a time.

I think there has to be some rules about timing and how to choose notes. And what I really wonder about is the how the two are paired together. Say you're in the key of C and playing some notes in the key and a few outside too. Now, you decided to go with a 1/8th, 1/8, 1/8, 1/8 1/4 time and the 1/4 note is the one off the key. Oh my! ;) Its a twisted web of conditions when you really look at it.

(I'm sticking with QB for now too! ;))

Jack

Offline Martin

  • Full Member
  • ***
  • Posts: 578

  • Total Badges: 24
    Badges: (View All)
    Tenth year Anniversary Level 5 Super Combination
Re:My Computer wrote this one!
« Reply #20 on: Feb 04, 2004, 04:21:59 PM »
Hiya Jack,

I was thinking of the database idea as an intermediate step in understanding what makes a tune work - after all you wouldn't be creating a single new bar of music, just present bars other people wrote in a new order.

This exercise might throw up some rules, e.g. you never have an interval of 7, or something. Then if your random note generator produced such an interval, the "musical rules" part of the code could throw out that note and ask for a new one, or modify it by adding or subtracting 1 and passing it through again. Or something.

I've just come across a tune, Uncle Jim's Barn Dance, where the B part opens with the sequence:  B2 B BBB| B2 B B3 |

Maybe that's why they call it the B part?

Offline Floyd

  • Full Member
  • ***
  • Posts: 349

  • Total Badges: 28
    Badges: (View All)
    Linux User Mobile User Search
Re:My Computer wrote this one!
« Reply #21 on: Feb 04, 2004, 05:09:58 PM »
I've just come across a tune, Uncle Jim's Barn Dance, where the B part opens with the sequence:  B2 B BBB| B2 B B3 |

That's about as un-random as they come.

Offline Mark Cordova

  • Senior Moderator
  • Sr. Member
  • *****
  • Posts: 3,574
  • Gender: Male
  • I've been drinking downstream from the herd again.

  • Total Badges: 25
    Badges: (View All)
    Level 5 Super Combination Combination
Re:My Computer wrote this one!
« Reply #22 on: Feb 04, 2004, 05:15:19 PM »
Yep Unrandom as you can get. Here I just wrote the third and fourth measure. c2 c ccc| c2 c c3|

Offline Jack002

  • Sr. Member
  • ****
  • Posts: 1,671

  • Total Badges: 25
    Badges: (View All)
    Tenth year Anniversary Windows User Level 5
Re:My Computer wrote this one!
« Reply #23 on: Feb 04, 2004, 07:58:39 PM »
Oh man, is that ever BORING! ;) Here's the full code so anyone else reading along wants to hear it in Concertina:

X:1
T:Marks remarks
R:nothing
S:mark
M:4/4
L:1/8
Q:1/2=50
K:C
B2 B BBB| B2 B B3 |
c2 c ccc| c2 c c3|


Jack

Offline Martin

  • Full Member
  • ***
  • Posts: 578

  • Total Badges: 24
    Badges: (View All)
    Tenth year Anniversary Level 5 Super Combination
Re:My Computer wrote this one!
« Reply #24 on: Feb 06, 2004, 04:23:30 PM »
Here's how it really goes!


X:1
T:Uncle Jim’s Barn Dance
R:Traditional English tune
S:Dave Townsend’s English Dance Music
M:6/8
L:1/8
Q:1/2=120
K:G
d3|e2d B2 d|G3 A2G|F2A c2A|(F3 F2) d|dBd f2e|d2B cAF|
G2F G2B|d3 d3|e2d B2d|G3 A2G|F2A c2A|(F3 F2) d| d^cd f2e|
d2B cAF|G3 D3|(G3G2) A|:B2 B BBB| B2 B B3 |A2Bc2d|f3 e3|
d2e f2e|d2B cAF|1G2F G2B|d3 c3:|2GBc def|g3|

 




Get Adobe Flash player


Fiddle and Alternative Strings Forum (c) 2016 Mark Knight /
SONiC FUEL
SimplePortal 2.3.7 © 2008-2020, SimplePortal