[squeakland] Playing musical notes

Christine Murakami cmurakami at columbusschoolforgirls.org
Thu Jul 21 07:55:20 EDT 2011


Hi Bert and all.

I tried the suggestion below with the holder and the notes. It works perfectly, and I learned a lot in the process! Always a great side benefit.

I have a follow-up question that will be helpful as we work on these projects.


Is there a way to get the holder to stop playing once the song is over? Right now, it continues back at the beginning, just like an animation would, playing continuously until you click the stop all scripts button.



As always, many thanks for the help! It took me a while to figure out, but this will help with ALL these musical projects!



Christine

From: Bert Freudenberg [mailto:bert42 at gmail.com] On Behalf Of Bert Freudenberg
Sent: Monday, July 11, 2011 10:38 AM
To: squeakland
Cc: Christine Murakami
Subject: Re: [squeakland] Playing musical notes

Hi Christine,

you can do "test counter > 5 and counter < 10" using two nested tests. The first would test for "counter > 5" and in its "yes" case there would be a test for "counter < 10". Of course that would be tedious for a whole song.

Here is a way to use the timer as suggested by Steve:

[cid:image001.png at 01CC477A.C30C30C0]

Each note is just a rectangle with an embedded text label. It has a variable for its frequency. Its width represents its duration. Many of them are put in a holder, and each can have their own frequency. The holder has a single variable, "until". This holds the timer value for the end of the currently playing note. When that time has passed, the next "until" is calculated from the width of the next note, and it is played.

It's very simple to make more notes, you just duplicate them, and if necessary change freq and width. You could make a parts bin with all the preconfigured notes.

This is similar to (though a lot simpler than) what I showed at Squeakfest. Ideas from that talk could be integrated as well - e.g., instead of playing the note right in the holder's script, each note could have a script that gets activated by the holder, and then could do more interesting things (like playing a rondo by repeating themes in ABACA form etc).

- Bert -

On 11.07.2011, at 14:34, Steve Thomas wrote:


1) You can use the timer in the playfield category (can change decimal places I believe accurate to milliseconds)

2) Use a "piano roll" and place notes on the roll and have a "needle" move across the roll (or the roll move) and when the "needle" touches the note, it will play that note.

You could have kids play a frequency based on it's y position and have them draw a score.  They could also have the note sustain based on its length.  You can also change the tempo by moving the needle at different speeds.

Stephen
On Mon, Jul 11, 2011 at 7:04 AM, Christine Murakami <cmurakami at columbusschoolforgirls.org<mailto:cmurakami at columbusschoolforgirls.org>> wrote:

Hi everyone!

I have been working with students on creating music lessons, and there is a gap in my knowledge of Etoys that is preventing them from going further in their projects.

Many of them would like a song to play (using the play frequency tile). The only way I can think to do this is to either create a variable counter that counts a beat or to use the playfield counter. Either way, it seems like Etoys ought to have a command that does something like "while counter > 5 and counter <10 play frequency 880" or even using a test in a similar way: "test counter > 5 and counter < 10".  I just can't figure out how to have a sound play for a specific amount of time - especially a few beats into the song. The first few we can fudge, but after that it gets too complicated. I need to help them find a better solution.

I've looked at both Pling and the chord game for suggestions, which helped with other issues but not this one.

Any suggestions would be most appreciated! I've been struggling with this since early May!

Thanks!

Christine
_______________________________________________


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/squeakland/attachments/20110721/b64b5d83/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 38624 bytes
Desc: image001.png
URL: <http://lists.squeakland.org/pipermail/squeakland/attachments/20110721/b64b5d83/attachment-0001.png>


More information about the squeakland mailing list