Changing notes on the speaker


#1

Hi,

I’m trying to suss out how to change the value of the note in the play tone on note block programmatically using a list of values rather than having to put a bunch of blocks into the program. Ideally I could set up a list of notes as a variable and then step through the list in a loop, feeding the value each time to the play tone on note block. Is this even possible in the mBlock environment or do I need to do this through the Arduino environment?

Thanks!

Charles


#2

you can feed numeric values to the "play tone on note"
You can see that the value for c2 = 65 and e2 = 82 and a6 = 1760
Here is a tone ramp program to show an example.

tone_ramp.sb2 (73.3 KB)


#3

Thanks! I did find that I need to set up a list with the note names, not values:

From there I used the following program based on yours:

Thanks for pointing me in the right direction! :smile:

Charles


#4

So I wanted to use an array in my example but I couldn’t figure out how to make that in scratch, I see there must be a way since you just did it there. I learned something new! Thanks.


#5

That’s community in action! Everyone gets to learn something new! :slight_smile: