Chromatic sounds?


#1

Hi!
My son just got an mBot Ranger. He loves it! We were wondering how we can get access to more pitches in the sounds besides the C Major scale. It seems to have the capacity based on the preloaded songs, but we can’t figure out how to program them. Any help is appreciated!
Best,
– Julie :slight_smile:


#2

Hi Julie

The ‘play tone on note’ block has, as you say, only C major values as standard, however you can create a variable and put that value into the block. See below,

auriga

The value of the variable defines the frequency in Hz. Here are some values to play with. Middle C is C4

    |  0 |  1 |  2 |  3 |  4 |  5 |  6  |  7  |  8  |  9  |
    +----+----+----+----+----+----+-----+-----+-----+-----+
C	|  16|  33|  65| 131| 262| 523| 1046| 2093| 4186| 8372|
C#	|  17|  35|  69| 139| 277| 554| 1108| 2217| 4434| 8869|
D	|  18|  37|  73| 147| 294| 587| 1174| 2349| 4698| 9397|
D#	|  19|  39|  78| 156| 311| 622| 1244| 2489| 4978| 9956|
E	|  21|  41|  82| 165| 330| 659| 1318| 2637| 5274|10548|
F	|  22|  44|  87| 175| 349| 698| 1396| 2793| 5587|11175|
F#	|  23|  46|  92| 185| 370| 740| 1479| 2959| 5919|11839|
G	|  24|  49|  98| 196| 392| 784| 1567| 3135| 6271|12543|
G#	|  26|  52| 104| 208| 415| 831| 1661| 3322| 6644|13289|
A	|  28|  55| 110| 220| 440| 880| 1760| 3520| 7040|14080|
A#	|  29|  58| 117| 233| 466| 932| 1864| 3729| 7458|14917|
B	|  31|  62| 123| 247| 494| 988| 1975| 3951| 7902|15804|

#3

Thank you! I see how this can be done on the computer (I’m running mBlock 5 on my Windows machine), and was able to make the robot do this.

Do you know if there is this function on the android version of mBlock Blocky that my son uses on his tablet? He wants the mobility of controlling the robot from the tablet rather than being tethered to a computer.

Thank you! :slight_smile:


#4

The hardware is certainly capable of playing any freq.
There is 2 blocks for playing tones with the buzzer in mblock5. 1 block has preset freq of tones and the other you can do any freq u want. If you open the tab on the right then you can see what code is generated by the blocks


#5

Not that I know of. The ‘Play note’ function on Blockly doesn’t take any parameters, it’s a very much simplified interface