This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-02 18:36:42

hockeynut1989
New Scratcher
Registered: 2012-04-02
Posts: 2

help with class project

These are the guidelines for my class project that I need help on.
Encode a song into a list (or set of lists) as we will have done in class.  This may be an original composition or a song you like, but it should be encoded using deltas rather than absolute notes.
 
Write the Scratch code to read your list(s) and play the song they encode.  Do this in such a way that allows you to transpose the song into any key simply by changing the starting note.
 
Devise a way for the user to change the starting note without having to explicitly change it in the code.
 
I've decided to do mary had a little lamb but something with my code is not working right. I would greatly appreciate if someone with more experience could take a look and see what I did wrong. I've attached screenshots of my project below. Thanks

http://imageshack.us/photo/my-images/3/littlelamb1.png/
http://imageshack.us/photo/my-images/821/littlelamb2.png/

Offline

 

#2 2012-04-02 20:04:43

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: help with class project

In the second picture, it shows the top script:

when I receive [play pattern v]
repeat (# of notes)
  broadcast [lead note v] and wait
  change [lead note v] by (item (lead note delta list index) of [lead note delta list v])
  change [lead note delta list index v] by (1)
end
Instead I think it should be:
when I receive [play pattern v]
repeat (# of notes)
  broadcast [lead note v] and wait
  set [lead note v] to ((starting note) + (item (lead note delta list index) of [lead note delta list v]))
  change [lead note delta list index v] by (1)
end

Last edited by AtomicBawm3 (2012-04-02 20:05:18)


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-04-02 20:28:36

hockeynut1989
New Scratcher
Registered: 2012-04-02
Posts: 2

Re: help with class project

I tried that and it didn't seem to make a difference. Do you have any other ideas on how I can improve this or any ideas about how I should go about doing the project?

Offline

 

#4 2012-04-03 10:10:48

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: help with class project

Here's how I would go about it: encode a song like this in a list:

Code:

<note>
<length>
<note>
<length>
...

the when reading, use the following script:

when gf clicked
set [n v] to [-2]
forever
change [n v] by [2]
play note ((item ((n) + (1)) of [notes v]) + (key-transpose)) for (item ((n) + (1)) of [notes v]) beats
set [n v] to ((n) mod (length of [notes v])
You can make "key-transpose" a slider on the stage monitor.

Hope it helps!  smile

Last edited by Hardmath123 (2012-04-03 10:12:34)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

Board footer