Skip to Content

Shape Sounds With Code!

Sometimes you might want to change the type of sound you use when creating or performing music.

You can change the characteristics of a sound with code.

Think about

How can we shape sounds or music with code? (coding ADSR)

Get Ready

[listen to how sound can be changed – video of ADSR changes]

Now let’s do this by coding and programming music. 

 Get Started

Code the sound you want in Sonic Pi

Check out this video on shaping sound by coding ADSR:

1) Open Sonic Pi

2)Try tutorial 2.4 “Duration with Envelopes”






3) Try tutorial 3.4 “Enveloped Samples”


Challenge: Can you make your music sound. . .

  • like a drum?
  • like a guitar?
  • like a bassline?
  • like something someone would rap over?
  • relaxing?
  • annoying?
  • like something you could dance to?
  • scary?
  • like it’s underwater?
  • like a robot?

Go Further (optional)

  1. Create some music with Sonic Pi (try creating melody and harmony)
  2. Shape the sounds of some individual notes using the techniques from tutorials 2.4 and 3.4


  1. Use an example in the “Help” section of Sonic Pi to change the characteristics of sound you want.

Learn More

Learn more about ADSR envelopes and how they can shape sound

Learn more about the characteristics of sound

Share What you Learned

  1. Post sample code from Sonic Pi
  2. Explain what you learned about customizing sound or music by using Sonic Pi.