The joy of dissecting weave
Download
1 / 14

Dissecting Weave - PowerPoint PPT Presentation


  • 356 Views
  • Uploaded on

The Joy of Dissecting Weave. Dawn Finney. Creating Useful SongNodes. Introducing the SongNodes Creating the SongNodes Creating a List to Work With. Coding the SongNodes. Within the SongPhrase class: //code for a1 static public Phrase A1() { double[] phrasedata =

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Dissecting Weave' - Audrey


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Creating useful songnodes

Creating Useful SongNodes

Introducing the SongNodes

Creating the SongNodes

Creating a List to Work With


Coding the songnodes
Coding the SongNodes

Within the SongPhrase class:

//code for a1

static public Phrase A1() {

double[] phrasedata =

{JMC.A1,JMC.EN,JMC.A1,JMC.EN,JMC.A1,JMC.EN,JMC.A1,JMC.EN};

Phrase myPhrase = new Phrase();

myPhrase.addNoteList(phrasedata);

return myPhrase;

}

//code for dg5

static public Phrase DG5() {

double[] phrasedata =

{JMC.G5,JMC.EN,JMC.G5,JMC.EN,JMC.G5,JMC.EN,JMC.G5,JMC.DEN};

Phrase myPhrase = new Phrase();

myPhrase.addNoteList(phrasedata);

return myPhrase;

}

//code for c2

static public Phrase C2() {

double[] phrasedata =

{JMC.C2,JMC.EN,JMC.C2,JMC.EN,JMC.C2,JMC.EN,JMC.C2,JMC.DEN};

Phrase myPhrase = new Phrase();

myPhrase.addNoteList(phrasedata);

return myPhrase;

}


Introducing the songnodes
Introducing the SongNodes

a1

dg5

c2

Distinct SongNodes will make it easier to see how weave works.


Creating the songnodes
Creating the SongNodes

SongNode a1 = new SongNode();

a1.setPhrase(SongPhrase.A1());

SongNode dg5 = new SongNode();

dg5.setPhrase(SongPhrase.DG5());

SongNode c2 = new SongNode();

c2.setPhrase(SongPhrase.C2());


Creating a list to work with
Creating a List to Work With

a1.repeatNextInserting(dg5, 5);


Dissection

Dissection

Analyzing the Inputs

Cases



Case skip amount 0
Case: skip amount = 0

a1.weave(c2, 2, 0);


Case skip amount 1
Case: skip amount = 1

a1.weave(c2, 2, 1);

Surprisingly a1.weave(c2, 2, 0); or a1.weave(c2, 2, 1); will yield the same result.


Case skip amount 2
Case: skip amount >=2

a1.weave(c2, 2, 2);

Weave actually works fairly normally with cases with the skip amount is greater 2


Case the list is too short
Case: the list is too short

a1.weave(c2, 2, 4);

I do not think it is possible to draw any conclusions until we see another case.


Case the list is too short again
Case: the list is too short again

a1.weave(c2, 2, 8);

So when the list is too short to accommodate the amount we want to skip, it will do what it can (like in the previous case) and then insert the node at the end of list regardless of the amount we wanted to skip or the number of times we wanted to weave the node into the list.


The code
The Code

import jm.music.data.*;

import jm.JMC;

import jm.util.*;

import jm.music.tools.*;

public class tester{

public static void main(String[]args){

SongNode a1 = new SongNode();

a1.setPhrase(SongPhrase.A1());

SongNode dg5 = new SongNode();

dg5.setPhrase(SongPhrase.DG5());

SongNode c2 = new SongNode();

c2.setPhrase(SongPhrase.C2());

a1.repeatNextInserting(dg5, 5);

a1.showFromMeOn(JMC.PIANO); //show original list

//case amount to skip = 0

a1.weave(c2, 2, 0);

a1.showFromMeOn(JMC.PIANO);

//case amount to skip = 1

a1.repeatNext(dg5, 5); //resets the list to the original

a1.weave(c2, 2, 1);

a1.showFromMeOn(JMC.PIANO);

//case amount to skip >=2

a1.repeatNext(dg5, 5);

a1.weave(c2, 2, 2);

a1.showFromMeOn(JMC.PIANO);

//case list is too short

a1.repeatNext(dg5, 5);

a1.weave(c2, 2, 4);

a1.showFromMeOn(JMC.PIANO);

//case list is too short again

a1.repeatNext(dg5, 5);

a1.weave(c2, 2, 8);

a1.showFromMeOn(JMC.PIANO); }}


ad