Pages: 1
Topic closed
Following an example from a project by The-Whiz, a sprite could *randomly* choose its x-position and then by using the variable "my-x" could say, "Set (my-x) to (x position)". So it would then remember where it had been at that particular point in case it wanted to go back there. Now, I would like to do the same thing with a randomly selected musical note. But there's no built-in "note position" expression the way there is for X and Y positions. So I can't say, "Set (my-note) to (note position)". I would like to randomly get a note and then build on it by being able to remember whatever that note had been. Is there a way to do that? Thanks for any suggestions!
Offline
Maybe use a list... the first note is the first item and so on.
As for the location analogy, that's how mouse recorders work. Each position is recorded in a list, so it would make sense if this worked...
Offline
JSO wrote:
Maybe
set [my note] to (pick random (60) to (80)
play note (my note) for (0.1) beats
???
Well, he wants like a random song, that can be played over... I think...
Offline
Following your suggestion I built a quick test: I made a List called "Note Box" (because that was where I'd store the notes I wanted to remember) and then had Cat choose to play Instrument #1 (piano) and "play note (pick random (50) to (80)".
But, now I don't know how to "pick up" that note to put it in the Note Box!! I can't guess what random note it played, and don't know how to get it to tell me!! :-/
I had built "Record a Tune" with a keyboard interface. When one pressed a black or white key the Script said "play note (55)" and then my variable "Note Played" picked it up....but I had to tell it!! The next command after the "play note" command was "Set (note played) to (55)" but I had to type "55" into the script. And then the next command added the 55 to the List.
So I don't want to record a whole song now. I just want to randomly generate a single note and have the project remember it (for whatever purpose).
A list sounds great, but I can't figure out how the List could ever know what note had been randomly chosen!!!
Is this making sense?
Last edited by Larry828 (2009-10-17 17:01:24)
Offline
Here you go:
it involves a trick with a variable, but it works very easily:
You need a randomly chosen number stored temporarily in a variable. The current value of the variable is added to the list and the note is played. the variable now picks a new value, and so on...
Here's how to play the song back:
You need a new variable for this. And don't forget to clear the list when the project starts either...
Any Questions?
Last edited by greenflash (2009-10-17 17:09:36)
Offline
greenflash wrote:
Here you go:
http://i37.tinypic.com/riwvo4.jpg
it involves a trick with a variable, but it works very easily.
Here's how to play the song back:
http://i38.tinypic.com/ic45ew.jpg
You need a new variable for this.
Any Questions?![]()
You're RIGHT, greenflash!! I built the script you described and added 7 notes to the List. Then I said that when Spacebar was pressed it should play Item 6, and right after that should play "Item 6 + (12)".
I pressed the Spacebar and it played the note and then a note one octave higher!!
That's *exactly* what I wanted! A project could remember a note, and then I could build on that particular note any way I wanted to. And return to it anytime to start again. And so on.
Thanks so much! Really great.
You're a very helpful "Scratch Friend" to have!
Thanks, Larry828
Offline
Larry828 wrote:
greenflash wrote:
Here you go:
http://i37.tinypic.com/riwvo4.jpg
it involves a trick with a variable, but it works very easily.
Here's how to play the song back:
http://i38.tinypic.com/ic45ew.jpg
You need a new variable for this.
Any Questions?![]()
You're RIGHT, greenflash!! I built the script you described and added 7 notes to the List. Then I said that when Spacebar was pressed it should play Item 6, and right after that should play "Item 6 + (12)".
I pressed the Spacebar and it played the note and then a note one octave higher!!
That's *exactly* what I wanted! A project could remember a note, and then I could build on that particular note any way I wanted to. And return to it anytime to start again. And so on.
Thanks so much! Really great.
You're a very helpful "Scratch Friend" to have!
Thanks, Larry828
No problem! I'm glad it worked
Offline
Topic closed
Pages: 1