Tuesday, March 31, 2015

L-System Melody Assignment

To this assignment I am using the following L-System:
Koch Curve
Example:
Vocabulary: {A, B, C}
Start: A
Productions... A-> A B A C A C A B A
B-> B
C-> C
Derivation: G0= A
G1= A B A C A C A B A
G2= A B A C A C A B A B A B A C A C A B A C A B A C A C A B A C A B A C A C A B A B A B A C A C A B A

 For my melody, I will use G1.
A B A C A C A B A
My notes:
A=FQ AQ CQ AQ DQ CQ EQ DW
B=DQ EQ DQ EQ GQ
C=DQ FW DQ DQ FQ DQ

Final melody:

Title:

"This is far from a melody"

FQ AQ CQ AQ DQ CQ EQ DW DQ EQ DQ EQ GQ FQ AQ CQ AQ DQ CQ EQ DW DQ FW DQ DQ FQ DQ FQ AQ CQ AQ DQ CQ EQ DW DQ FW DQ DQ FQ DQ FQ AQ CQ AQ DQ CQ EQ DW DQ EQ DQ EQ GQ FQ AQ CQ AQ DQ CQ EQ DW


 Song

Monday, March 23, 2015

The ND (L-Tree+ CFG) melody generation task

Steps: 
  1) Generate the L-Treedefined by the following two sproot growing processes :

A|_ a _|B      B|_ b _|A

2)      Draw the three of level 5
3)      Twice derive a string of terminals from nonterminal BAR 3 in CFG for  that we have been  using – arranging for two different sequence  to result
4)      Associate A with the result of one bar 3 derivation associate B with the other result of bar 3 derivation.
5)      Replace each instance of A and B in the level 5 of the tree.
6)      Write down the melody that is generated as a sequence of JFugue symbols
7)      Generate a sound file

Result of each step:

1-2)
3)
Bar3 => (3 p3 d3)
            => (12) (3 pitch pitch pitch d3)
            => (26) (3 f pitch pitch d3)
            => (25) (3 f e pitch d3)
            => (28) ( 3 f e a d3)
            => (16) ( 3 f e a h q  q)
 Bar3 => (3 p3 d3)
          => (12) (3 pitch pitch pitch d3)
          => (23) (3 c pitch pitch d3)
          => (24) (3 c d pitch d3)
          => (25) ( 3  c d e d3)
          => (15) ( 3 c d e q h h) 
4)
 A =     FH EQ AQ
 B =   CQ DH EH

5)
A B B A B A A B B A A B A B B A B A A B A B B A A B B A B A A B

6)
FH EQ AQ CQ DH EH CQ DH EH FH EQ AQ CQ DH EH FH EQ AQ FH EQ AQ CQ DH EH CQ DH EH FH EQ AQ FH EQ AQ CQ DH EH FH EQ AQ CQ DH EH CQ DH EH FH EQ AQ CQ DH EH FH EQ AQ FH EQ AQ CQ DH EH FH EQ AQ CQ DH EH CQ DH EH FH EQ AQ FH EQ AQ CQ DH EH CQ DH EH FH EQ AQ CQ DH EH FH EQ AQ FH EQ AQ CQ DH EH

7)

Song

Monday, March 9, 2015

Recursive Transitional Network














































Song Generated using a die and the networks:
(1 e w) (4 f g a c h q i i) (3 c d e  q h q )( 2 a b h h) (4 c d g a h i i q ) ( 3 e d g q q h)(2 b b h h) (1 a w )

EW FH GQ AI CI CQ DH EQ AH BH CH DI GI AQ EQ DQ GH BH BH AW



Wednesday, March 4, 2015

Context Free Grammar Assignment 2

Production rules:
1)      Expression -> Symbol
2)      Symbol -> { Star } | [ Star ] | ( Star )
3)      Star -> “void”
4)      Star -> *
5)      Star -> * Star
6)      Star -> Symbol Star

Terminals: * [] {} () “void”
NonTerminals: Expression Symbol Star
Start Symbol: Expression
Test 1:
{[**][](***)}
Expression=>1 Symbol
                =>2 { Star }
                =>6 { Symbol Star}
                =>2 { [ Star ] Star}
                =>5 { [ * Star] Star}
                =>4 { [ * *] Star}
                =>6 { [ * *] Symbol Star}
                =>2 { [ * *] [Star] Star}
                =>3 { [ * *] [] Star}
                =>6 { [ * *] [] Symbol Star}
                =>2 { [ * *][] (Star) Star}
                =>5 {{**}[] (* Star) Star}
                =>5 {{**}[] (* * Star) Star}
                =>5 {{**}[] (* * * Star) Star}
                =>4 {{**}[] (* * * *) Star}

                =>3{{**}[] (* * * *) }
Test 2:
{}
Expression =>1 Symbol
                  =>2 { Star }
                  =>3 {}
Test 3:
[ (*) *]
Expression =>1 Symbol
                   =>2 [ Star]
                   =>6 [ Symbol Star ]
                   =>2 [ ( Star) Star]
                   =>4 [(*)Star]
                   =>4 [(*)*]


PDF

Monday, March 2, 2015

Context Free Grammar Assignment

In this assignment I was supposed to produce a melody using a context free grammar. Based in the grammar and using a generator of random numbers( to choose the rules), I did this directly derivations : 
             Note : The number before the string is the rule number.
Melody    => (1) bar bar bar bar bar bar bar bar
                => (2) bar1 bar bar bar bar bar bar bar
                => (6) (1 p1 d1) bar bar bar bar bar bar bar
                => (10) (1 pitch d1) bar bar bar bar bar bar bar
                => (23) (1 c d1) bar bar bar bar bar bar bar
                => (14) (1 c w) bar bar bar bar bar bar bar
                => (3) (1 c w) bar2 bar bar bar bar bar bar
                => (7) (1 c w) (2 p2 d2) bar bar bar bar bar bar
                => (11) (1 c w) (2 pitch pitch d2) bar bar bar bar bar bar
                => (24) (1 c w) (2 d pitch d2) bar bar bar bar bar bar
                => (23) (1 c w) (2 d d d2) bar bar bar bar bar bar
                => (15) (1 c w) (2 d d h h) bar bar bar bar bar bar
                => (4) (1 c w) (2 d d h h) bar3 bar bar bar bar
                => (8) (1 c w) (2 d d h h) (3 p3 d3) bar bar bar bar
                => (12) (1 c w) (2 d d h h) (3 pitch pitch pitch d3 ) bar bar bar bar
                => (26) (1 c w) (2 d d h h) (3 f pitch pitch d3) bar bar bar bar
                => (25) (1 c w) (2 d d h h) (3 f e pitch d3) bar bar bar bar
                => (28) (1 c w) (2 d d h h) ( 3 f e a d3) bar bar bar bar
                => (16) (1 c w) (2 d d h h) ( 3 f e a h q  q) bar bar bar bar
                =>  (3) (1 c w) (2 d d h h) ( 3 f e a h q  q) bar2 bar bar bar
                =>  (7) (1 c w) (2 d d h h) ( 3 f e a h q  q) (2 p2 d2) bar bar bar
                =>  (11) (1 c w) (2 d d h h) ( 3 f e a h q  q) (2 pitch pitch d2) bar bar bar
                =>  (29) (1 c w) (2 d d h h) ( 3 f e a h q  q) (2 b pitch d2) bar bar bar
                =>  (28) (1 c w) (2 d d h h) ( 3 f e a h q  q) (2 b a d2) bar bar bar
                => (15) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) bar bar bar
                => (3) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) bar2 bar bar
                => (7) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 p2 d2 ) bar bar
                => (11) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 pitch pitch d2 )bar bar
                => (23) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c pitch d2 )bar bar
                => (27) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g d2 )bar bar
                => (15) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h )bar bar
                => (2) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h )bar1 bar
                => (6) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 p1 d1) bar
                => (10) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 pitch d1) bar bar
                => (25) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e d1) bar
                => (14) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) bar
                => (3) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) bar2
                => (7) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) (2 p2 d2)
                => (11) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w)(2 pitch pitch d2)
                => (24) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) (2 d pitch d2)
                => (28) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) (2 d a d2)
                => (15) (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) (2 d a h h)

 After that, I transformed the last string to a JFugue string :
Last String: (1 c w) (2 d d h h) ( 3 f e a a h q  q) (2 b a h h) (2 c g  h h ) (1 e w) (2 d a h h)

Result of the combination: cw dh dh fh eq aq bh ah ch gh ew dh ah

Finally, putting this string in the SimplePlayer it produced this song file:



Wednesday, February 25, 2015

tq- C- P- A- B- @|- Problem Set

1)      Write down the axioms schema and the three shortest axioms in the tq-system
R: xT-Qx is an axiom, whenever x is a hyphen string.
    -t-q-
    --t-q--
    ---t-q---
2)      Write down the sole rule of inference for the tq-system and apply it to the well-formed string -----t-----q-----
R: Rule: Suppose that x, y and z are all hyphen-strings. And suppose that xTyQz is an old theorem. Then, xTy-qzx a new theorem.

(1) -----t-----q----- axiom
(2) -----t------q---------- from (1) using the rule
3)      Reasoning in I-mode, argue that the string you produced in the previous item is not a theorem in the tq-system
R: It cannot be a theorem because 5x6 != 11. 

4)      Working in M-mode, show that -----t ---q --------------- is a theorem in the tq-system.
R: Use the rule to go back and find the axiom, if it is an axiom, than it is a theorem.
(1)    -----t---q---------------   theorem
(2)    -----t--q---------- from (1) using the inverse of the rule
(3)    -----t-q----- from (2) using the inverse of the rule
-----t-q------ = xT-Qx
From this we ca conclude that ------t---q--------------- is a theorem in the tq-system.

5)      What are the two rules of C-system
R: 
1) Suppose x, y and z are hyphens-strings. If x-ty-qz is a theorem then Cz is a theorem.
 2) Suppose that x, y and z are all hyphen-strings. And suppose that xTyQz is an old theorem. Then, xTy-qzx a new theorem.

6)      Working within the C-system, argue that C-------- is a theorem of the system.
R: --t-q-- axiom
(2) --t--q---- from axiom using rule 2
(3) --t---q----- from (2) using rule 2
(4) --t----q-------- from (3) using rule 2
(5) C-------- from (4) using rule 1


7)      Does adding the following rule to the C-system constitute a Post production system for determining primes? Please explaining your response. Suppose x is a hyphen-string. If Cx is not a theorem, then Px is a theorem.
R: No, because the rule does not entail a purely typographical operation.

8)      Hofstadter writes. When a figure or “positive space” (e.g., human form, or a letter, or a still life) is drawn inside a frame,an unavoidable consequence is that its complementary shape – also called the “ground” , or “background”, or “negative space” – has also been drawn.  According to this view, the quiche pan shown below that I computationally rendered would be considered negative space. Explain how this is so.
R: The drawn consist in the black space and the withe space is the ground.

9)      Consider the A-system as defined by the following axiom and theorem. Axiom A-- , Rule: suppose that x is a hyphen-string, If Ax is a theorem , so is Ax--

a)      Show that A -------- is a theorem of the A-system by working within the system
R: (1) A - - axiom
     (2) A - - - - from (1) using the rule I
      (3) A - - - - - - from (2) using the rule I
      (4) A -------- from(3) using the rule I
b)      Specify a decision procedure for determining theorem hood in the A-system
R: Suppose you have Ax, if you can use the rule to go back to A -- (The only axiom) you can say that Ax is a theorem.
c)       Provide an I-mode argument that the string A------------ is not a theorem of the A-system
R: All theorems in the A-system have an even number of hyphens.
d)      What subset of the natural numbers do you think it was my intent to capture with the A-system
R: All even numbers.
      
10)   Consider the as yet to be formally defined B-system which you should imagine is intended to capture precisely all of the natural numbers that the A-system does not capture.

a)      Propose, by analogy with the rule on page 66 of GEB, an invalid rule for producing theorems in the B-system.
R: Suppose x is a hyphen-string. If Ax is not a theorem, then Bx is a theorem.
b)      Define a (valid) Post production system for the B-system in terms of one axiom and one rule
R: Axiom: B-
 Rule I: Suppose that x is a hyphen-string. If Bx is a theorem, so is Bx--
c)       Derive B----------- within the B-system.
R: (1) B- axiom
      (2) B--- from(1) using the rule I
      (3) B----- from (2) using the rule I
      (4) B------- from (3) using the rule I
      (5) B--------- from (4) using the rule I
      (6) B----------- from(5) using the rule I
d)      What subset of the natural numbers does the B-system capture?
R: All odd numbers.

11)   Under interpretation, what does the A-system theorem A -------- say? Under interpretation, what does the B-system theorem B----------- say?
R: Say that 8 is an even number and 11 is a odd number.
12)   What does mean for a set to be “recursively enumerable”? What does it mean for a set to be “recursive”?
R: Recursively Enumerable: Means that it can be generated according to typographical rules.
     Recursive: A set is recursive if you can write a program that tells you whether the given input is in the set or not.
13)   Argue that the set of even number is recursively enumerable.
R: Using the A-system you can produce every even number. The A-system use a typographical rule
14)   Argue that the set of even number is recursive
R: It is recursively enumerable and its complement (odd numbers) is recursive because you can use B-system to get all odd numbers.

15)   Argue that the set of prime numbers is recursively enumerable.
R:You could use rule of the Px-system to get all recursive enumerable.
16)   Argue that the set of prime numbers is recursive.
R: It is recursively enumerable and its complement (odd numbers) is recursive because you can use C- system to the rest of the numbers.

17)   In a sentence or two, explain why you think that I am not asking you in this problem set to derive something lime P----- within the P-system?
R: Because the P system it is not a formal system that have a typographical rule.
18)   Consider the following Post production system, a system that we will call the @?- system:
AXIOM: @ | | - ||| -
Rules: Suppose x is a string made up of zero or more symbols drawm from the set { @ , - , |} then:
1: if you have x-||-|||, you can add –
2: if you have x-|||-||, you can add –
3: if you have x|-||-||, you can add |
4: if you have x|-|||-|, you can add |
5: if you have x||-||-|, you can add |
6: if you have x|-|||-, you can add |
7: if you have x|||-||-, you can add |
8: you can replace @ by C
9: you can replace @ by G
10: you can replace @ by D
11: you can replace C| by CD
12y you can replace C- by CV
13: you can replace V| by VW
14: you can replace V- by VD
15: you can replace D| by DE
16: you can replace D- by DW
17: you can replace W| by WF
18: you can replace W- by WE
19: you can replace E| by EX
20: you can replace E- by EF
21: you can replace F| by FG
22: you can replace F- by FX
23: you can replace X| by XY
24: you can replace X- by XG
25: you can replace G| by GA
26: you can replace G- by GY
27: you can replace Y| by YZ
28: you can replace Y- by YA
29: you can replace A| by AB
30: you can replace A- by AZ
31: you can replace Z| by ZC
32: you can replace Z- by ZB
33: you can replace B| by BV
34: you can replace B- by BC

a)      How many axioms in the system? How many rules in the system? How many theorems in the system?
R:  1 Axiom. 34 Rules. Infinite theorems.
b)      Show that @||-|||-||-|||- is a theorem of the @|- system by performing a derivation within the system.
R: @||-|||-  axiom
     (2) @||-|||-| from(1) by rule 6
     (3) @||-|||-|| from(2) by rule 4
     (4) @||-|||-||- from(3) by rule 2
     (5)@||-|||-||-| from(4) by rule 7
     (6)@||-|||-||-|| from(5) by rule 5
     (7)@||-|||-||-||| from(6) by rule 3
     (8) @||-|||-||-|||- from(7) by rule 1
c)       Show that CDEFGABC  is a theorem of the @|- system by performing a derivation within the system
R: (1) @||-|||-  axiom
     (2) C||-|||- from (1) by rule 8
     (3) CD|-|||- from (2) by rule 11
     (4) CDE-|||- from (3) by rule 15
     (5)CDEF|||- from (4) by rule 20
     (6)CDEFG||-from (5) by rule 21
     (7)CDEFGA|-from (6) by rule 25
     (8)CDEFGAB - from (7) by rule 29
      (9) CDEFGABC from (8) by rule 34

d)      Show that GABCDEXG  is a theorem of the @|-system by performing a derivation within the system
R: (1) @||-|||-  axiom
     (2) G||-|||- from (1) by rule 9
     (3) GA|-|||- from (2) by rule 25
     (4) GAB-|||- from (3) by rule 29
     (5)GABC|||- from (4) by rule 34
     (6)GABCD||-from (5) by rule 11
     (7)GABCDE|-from (6) by rule 15
     (8)GABCDEX - from (7) by rule 19
      (9) GABCDEXG from (8) by rule 24

e)      Show that DEXGABVD is a theorem of the @|-system by performing a derivation within the system
R: (1) @||-|||-  axiom
     (2) D||-|||- from (1) by rule 10
     (3) DE|-|||- from (2) by rule 15
     (4) DEX-|||- from (3) by rule 19
     (5)DEXG|||- from (4) by rule 24
     (6)DEXGA||-from (5) by rule 25
     (7)DEXGAB|-from (6) by rule 29
     (8)DEXGABV - from (7) by rule 33
      (9) DEXGABVD from (8) by rule 14

f)       What do you think I had in mind when I invented this system?
 R:Generate musical scales.


Click here to download the PDF

Tuesday, February 24, 2015

Markov song

I love you ( Barney Song )
GW EW GW GW EW GW AW GW FW EW DW EW FW EW FW GW CQ CQ CQ CQ DW EW FW GW GW DW DW FW EW DW CQ

31 Notes.
6 Different notes.
2 Times ( Q and W).


GW EW FW DW CQ AW
GW 1 2 1 1 1 1
EW 2 0 3 2 0 0
FW 2 3 0 0 0 0
DW0 2 1 1 1 0
CQ 0 0 0 1 3 0
AW 0 0 0 0 1 0


GW EW FW DW CQ AW
GW 0.142 0.288 0.142 0.142 0.142 0.142
EW2 0.288 0.428 0.288 0 0
FW 0.4 0.6 0 0 0 0
DW 0 0.4 0.2 0.2 0.2 0
CQ 0 0 0 0.25 0.75 0
AW 0 0 0 0 1 0


GW EW FW DW CQ AW
GW 0.142 0.427 0.569 0.711 0.853 1
EW 0.288 0.716 1 1 1 1
FW 0.4 1 1 1 1 1
DW 0 0.4 0.6 0.8 1 1
CQ 0 0 0 0.25 1 1
AW 0 0 0 0 1 1

I did a java code to generate the variations:

Variation 1
GW AW CQ DW EW FW EW EW FW EW FW EW FW GW CQ CQ DW DW FW EW FW EW FW GW GW AW CQ CQ DW CQ

Variation 2
GW GW DW DW EW FW GW AW CQ CQ DW EW FW GW FW GW CQ CQ CQ CQ CQ CQ CQ DW CQ CQ DW FW GW GW EW

Improvising : Original + Var1 + Original + Var2 + Original.
Code
Original
Variation 1
Variation 2
Full Song
PDF