Scratch can do several things at the same time (in parallel), if the scripts are triggered by the same event. In this projects both melodies are triggered by the same message. You're welcome to download it, look at the code and reuse it for you own polyphonic projects.
As kevin_karplus observed elsewhere I failed to notice that <tempo> is now a global, therefore I should have assigned the 'rest'-waits directly using <wait <60 / <tempo>>>, instead of assigning a <beatlength> variable.
Yeah right. I found it surprisingly hard to code such a short and simple polyphonic piece of music in Scratch. At first I did a musical analysis and coded threads for each "theme", which I scheduled in a "main" thread (it's some sort a fuge after all). It was a very short an beautiful script. However, the music got severely out of synch, until I finally gave in, explicitly coded each note and cut it up in (short) measures, which goes to show that good music and good programming are not always the same. I Also wanted to use the 'broadcast and wait' block, which didn't work correctly as some notes are kept into the following measure. Lastly I ran into troubles when I tried to come up with tempo-consistent rests (see project notes) and an independent dynamics thread (but that's another story). I originaly wanted to show in this project how easy it is to code polyphonic music in Scratch and how you can use Scratch code to demonstraste the muscical structure of a fuge. I had to find out, though, that Scratch and 'real' music are not always friends...
forest: yes, you can make midi play any note - even ones which are too high/low for the piano keyboard. Depending on which instrument you choose it might not get played, though.
Download "Menuet"(one sprite and 60 scripts) and open it in Scratch
Project Notes
this project tries to play Bach's Menuet No. 1 using the new musical command blocks of Scratch 1.2. It just repeats itself until you press the red sign.
It is just a quick excercise for me to become familiar with some of the new notation features (and a superb example of how *not* to use dynamics and tempo variations in Baroque music).
Also, when I tried to notate the music in Scratch the absence of a 'rest'-block struck me, and it occured to me that there probably should be a beat interval that fits into the 'wait' block.
Update: There now is a rest for _ beats block in the new Scratch (1.2.1) version, so there's no need for the workaround shown in this project.
Comments
You need to be logged in to post comments
Add a Comment
I can play this melody on the piano. ^^
(view all replies)Comment Reply
very good, I can't (that's why I need Scratch, lol!)
(view all replies)Comment Reply
How did you do this?!!? there playing at the same time! i can only make the right hand play alone! no left! hOW DID YOU DO THIS!!!!!!
(view all replies)Comment Reply
Scratch can do several things at the same time (in parallel), if the scripts are triggered by the same event. In this projects both melodies are triggered by the same message. You're welcome to download it, look at the code and reuse it for you own polyphonic projects.
(view all replies)Comment Reply
I can play the minuet on the piano but not the menuet!
(view all replies)Comment Reply
Wonderful! I like it.
(view all replies)Comment Reply
I play piano! probably not this though
(view all replies)Comment Reply
This is a wonderful example! I loved reading the comments on things you tried that didn't work; that is an education right there.
(view all replies)Comment Reply
Jens, this is so beautiful! Thank you!
(view all replies)Comment Reply
Sehr nett! Ich mag wirklich das Lied. Ich auch mag wirklich Musik Bachs, also ist dieses Projekt zu meinem Mögen.
(view all replies)Comment Reply
wow!!!!!
(view all replies)Comment Reply
I LOVE IT !!!
(view all replies)Comment Reply
This is so very helpfull! Thanks!
(view all replies)Comment Reply
I try to make a programme on scratch that would playa note according to it's Y posision, I tried to make that play fleur alise but it failed horribly
(view all replies)Comment Reply
lol, sdfg481! I'm not a native English speaker, maybe some 57 years old professors aren't either <grin>.
(view all replies)Comment Reply
you sound like your a college professor hmmm judging by the way you talk 57 years old am i right
(view all replies)Comment Reply
very interesting!
(view all replies)Comment Reply
this is amazing!
(view all replies)Comment Reply
Hi Jens: That's beautiful! Thank you for contributing very useful innovations to the musical blocks of Scratch by your experiments and suggestions !
(view all replies)Comment Reply
Wow! Nice job and the sound is excelent.Bach is a great composer isn't he.
(view all replies)Comment Reply
The Scratch team added the <rest for __ beats> block in the new version (1.2.1), so this project now has only 'historical' relevance...
(view all replies)Comment Reply
This is beautiful music!
(view all replies)Comment Reply
As kevin_karplus observed elsewhere I failed to notice that <tempo> is now a global, therefore I should have assigned the 'rest'-waits directly using <wait <60 / <tempo>>>, instead of assigning a <beatlength> variable.
(view all replies)Comment Reply
Ahh... I love this piece...
(view all replies)Comment Reply
Wow. Sounds great. I agree that it would have been a good idea to include some form of "rest" block in 1.2.
(view all replies)Comment Reply
Yeah right. I found it surprisingly hard to code such a short and simple polyphonic piece of music in Scratch. At first I did a musical analysis and coded threads for each "theme", which I scheduled in a "main" thread (it's some sort a fuge after all). It was a very short an beautiful script. However, the music got severely out of synch, until I finally gave in, explicitly coded each note and cut it up in (short) measures, which goes to show that good music and good programming are not always the same. I Also wanted to use the 'broadcast and wait' block, which didn't work correctly as some notes are kept into the following measure. Lastly I ran into troubles when I tried to come up with tempo-consistent rests (see project notes) and an independent dynamics thread (but that's another story). I originaly wanted to show in this project how easy it is to code polyphonic music in Scratch and how you can use Scratch code to demonstraste the muscical structure of a fuge. I had to find out, though, that Scratch and 'real' music are not always friends...
(view all replies)Comment Reply
Cool. 60 Scripts for 1 sprite?! Ach Lieber!
(view all replies)Comment Reply
forest: yes, you can make midi play any note - even ones which are too high/low for the piano keyboard. Depending on which instrument you choose it might not get played, though.
(view all replies)Comment Reply
Does the midi note numbering system equate to the whole range of the piano keyboard?
(view all replies)Comment Reply