Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW4-Spring2006

You got questions about repeating and weaving?
We got answers!

Post your questions, then check back here. We'll be here soon!


The code we have for SongPart has a strange comment... At the declaration of public SongNode myREMOVEDst, it says:
"SongPart has a SongNode that is the beginng of its"
So, um, at the beginning of its what?

list – I'll fix that. Mark Guzdial

What's the difference between a note and a riff?
A note is one note. A "riff" is just my word for a Phrase. Mark Guzdial

How can I use the MIDI Program numbers exactly? I understand JMC.PIANO and all, buy what if I want to use MIDI Program 81 or something?
JMC.PIANO is actually a constant, whose value is zero, which is the MIDI Program for a piano. You can replace that number with an 81 and it'll work. (Remember that I did this in class once – just took notes from the class and used them as the instrument number. Mark Guzdial

"You will create a class (with some cunning name like MyWovenSong) with a main that will assemble your song, then open it with showFromMeOn."
I'm just assuming that we're using a score and either calling notate, or playing the file...
Is that correct, or are we to devise something else? > cringes <

I think - that when you are using Song... and like SongPart and stuff, you would simply use .show() If you're not doing multiple parts, then you would do nodeThatYourSongStartsWith.showFromMeOn() and it will come up. :) You won't use a score or notate... or play... that I know of...
Student252
It will notate. Mark Guzdial

Hmm, I'm using SongPart, which holds SongNodes. SongPart.show() notates all the SongNodes in that part (compiled into a local Score)... So if I have 2 parts... I need to notate a score with both parts... Otherwise, I get a separate window for each SongPart... Have I missed something? This is kinda tough!
~Jim
You should end up with one notate window. Mark Guzdial

Is a node and a riff the same thing?

Nope. A riff is a bunch of notes. In Java, it's a Phrase. A Node has a phrase.

Hey folks, I've discovered that if you're using weave and you want the last woven Node at the end of your piece, it won't work. I've finally found a way around it:
In SongNode, there's a pair of lines that say:
if (current.next() == null) // Did we actually get to the end early?
  break; // Leave the loop

You can go ahead and remove or comment out those lines, but then if you weave one time too many, Java will throw a null pointer exception at you.
To fix that, go to where it says:
oldNext = current.next(); // Save its next
current.insertAfter(copy); // Insert the copy after this one
current = oldNext; // Continue on with the rest

And add 2 very similar lines after it:
oldNext = current.next(); // Save its next
current.insertAfter(copy); // Insert the copy after this one
current = oldNext; // Continue on with the rest
if (current == null) // Did we actually get to the end early?
  break; // Leave the loop

Yay.
~Jim
Tres bien! Well done, Jim! Thanks for catching that bug! Mark Guzdial

Ahhh! I'm confused. So, we're spposed to have 4 unique phrases, but 10 nodes? I guess I don't really understand the difference between a node and a phrase. I thought that a node was part of a linked list that held the phrase information? I'm not sure how to accomplish this without making 10 phrases and making them all into nodes. Unless every time a phrase is repeated in the list, it counts as a node...

Can someone help me to better understand what a node is?

A node is just an element of a linked list.
We're using SongNodes, which have a special variable in them that holds a musical phrase. So, you can make a bunch of SongNodes, and call setPhrase on them to make them hold some music, and then you use setNext to link them all in whatever order you want.
The same linked list structure applies, but each node knows about a phrase.
SongNode
w/Phrase 1
—> SongNode
w/Phrase 2
—> SongNode
w/Phrase 3
Furthermore, SongNode has a collect function that traces through the list for you and compiles all of the Phrases in order starting with the root node.
So, the linked list structure allows you to very easily insert and remove (weave and repeat!) nodes –which are basically musical Phrases for this case. And by making each node –"thing in a linked list that points to the next thing"–also hold a phrase, we can piece together music in whatever order we have settled on. It's giving the Phrase object the ability to know what phrase comes after it. ... Is that the answer you were looking for?
~Student248
REMOVEDke Jim says. Think of a verse-chorus-verse-chorus pattern has having four "nodes" but only two "unique phrases," okay? Now, give me 10 nodes with at least 4 unique phrases. Mark Guzdial

Is there a way that I can have Java make and save an image of my song, as my art skills would not be able to make anything that looks close to it.
You're not handing in an image of the score, but a sketch of the nodes. Mark Guzdial

What is the "pitch and rythm array"? I keep getting an error about the valus being wrong, but I don't remember changing any values in this array. Is it within the MyWovenSong class that I wrote?
No, there are arrays used in the SongPhrase riffs. Isn't a line number given to you where the error is? Mark Guzdial



Link to this Page