Code a Hip Hop Hit

Hey there music fans!

Chris at Kano here - bringing you the freshest beats, and dopest sounds, straight out of... Kano code? Word!

Just add the speaker part to any of your Kano Code, Pixel Kit, or Motion Sensor creations, to drop sweet beats, strings, loops, and sounds in your code creations.

Getting my Hip Hop head on, I've been working on a music and motion based, code creation, that combines the most sampled loop in music history...

...a horn that's hyped up Hip Hop audiences from New York to Tokyo, via the dancehalls of Jamaica...

...and the affordable and fun Kano Motion Sensor Kit...

...to create my own Kano Code Hip Hop Hit!

Now admittedly, this does not look like a hit record, but once you press play, you'll hear a familiar loop and sound effect, and see the audio waveform scroll (and change colour) on the screen.

So you've seen it, you've heard it, how does it work?

Let's take a look at the code!

There's a lot going on, (but don't worry!) we're going to go through the code together, section by section, and find out what all these blocks mean.

Let's start with the long string of code blocks on the left, which is playing, receiving, and then drawing sound on the canvas (you can use this without a Kano Motion Sensor Kit).

Section 1

  • The Speaker function starts looping the built in Amen Break loop

  • The background color is set to black

  • A start point of x:0, y:250 is set for the draw function

  • The draw fill color is set to green

This section of code starts, and plays a loop, then gets ready to draw something in green from the center of the left hand side on the canvas.

Section 2

Every 65 milliseconds, the draw function:

  • Moves along the x axis by 5

  • Draws an ellipse with a width of 1, and a height of the volume registered by the microphone in your computer

This section draws a waveform of what is being played by the speaker, and received by the microphone.

Section 3

  • Every 1 second, the draw color is set to green

This section resets the color of the waveform to green.

Section 4

Every 6.8 seconds:

  • The background color is set to black

  • A start point of x:0, y:250 is set for the draw function

  • The draw fill color is set to green

This section wipes the canvas clean, and makes it look like the waveform is cycling from left to right.

Next let's look at the short string of code blocks on the left, which plays a sound, and changes the draw color when the motion sensor detects your hand.

When motion is detected at position 3 (about 1 thumb length above the motion sensor)

  • The speaker plays the "Air Horn" sound

  • The draw colour is changed to orange

This code string plays the air horn sound, and changes the waveform to orange whilst your hand is over the motion sensor.

So that's how you make a Hip Hop Hit in Kano Code - check out this creation on Kano World, play with it, remix it, make it your own!

Peace Out!

Chris
a.k.a TyrantLizardRex

More from Chris Mann