If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:2:14

Video transcript

when we wire blocks together we will often run into a problem and it's a range mismatch for example if we had the light intensity value being plugged into the pitch input of the speaker let's see what would happen our light intensity value will send it a number between 1 and our 0 and 100 however the pitch input varies from zero to a thousand because it is a different measure so these are all the different tones if we think of it as a piano this is the whole width of a piano so if we plug these in directly we actually would only hit 10% of all the values here and this means this number would need to be scaled by some amount and that is when we can use our math block to help us the math block is very simple it takes two inputs a and B which you can plug into just like I've shown you and it spits out an output so what you could do is multiply things together or scale a number or say take whatever it a is and add 5 to it and spit that as your output so in this case I have a light sensor and a sound sensor and instead of plugging them together I'm going to drop a math Block in between them and now provide the light intensity value to a that's the first input and I'm not going to give it another input B because I just want to either add multiply or do something to this number a and I'll take the result of whatever operation we come up with and plug it in to tone frequency so the math block just to be clear the operations are addition subtraction multiplication division absolute value in square root so you should select the correct operation here and fill in B so let's say we wanted to divide it by 5 I would put 5 in the box for B so if I provided the number 50 it would be divided by 5 which is 10 and 10 would spit out the other end so fix this so that after the math block the value ranges from zero to a thousand