1 of 10

EarSketch

Debugging, Commenting, and Sharing Scripts

2 of 10

Where are Errors Shown in EarSketch?

Errors are shown in the console. The line number of the error and explanation are in red.

Notes are on

The next slide

3 of 10

Notes For Previous Slide

  • A red dot appears in front of line 9
  • Line 9 is missing a variable
  • The console explains that fitMedia takes four inputs, but there are only three on the line of code
  • Line 10 does not run because of the error on line 9
  • There is an option to click for more information

4 of 10

Most Common Error

Putting two sounds on the same track with overlapping measures will cause an error.

The script will run successfully with lines 8 and 10, but line 9 will not run.

The console gives you two suggestions to fix the error – change line 8 or line 9.

You can change the track number or the measures.

5 of 10

Another Common Error

Can you figure out what the error is?

See the next slide for the answer.

What does (9:21) mean?

6 of 10

Syntax Error

There is a comma missing after the start measure. The console tells you that the syntax error is on line 9 and character 21. Simply count from left to right and the comma will go in the 21st spot.

7 of 10

Debugging Coding Errors

  • Finding and fixing an error is called debugging
  • Admiral Grace Hopper called it that because she fixed an error caused by a moth in a computer in 1947

Voice and Choice

8 of 10

Commenting the Code

It is good practice to comment your code. At the top of the script, you can add information about the creator of the code and a description of the code as well as important details throughout the code.

Use 2 forward slash (or just slash) marks to indicate a comment, This line of code will not run.

9 of 10

Mini Task Assignment

  • Make an 8 measure piece of music
    • Use at least 3 different sounds on separate tracks
    • Include a high pitch sound and a low pitch sound
    • Do not start and end the the sounds at the same measure
    • Name the script Period#_YourName_8MScript

as an example Period5_ScoobyDoo_8MScript

Share with me: csteacher1

10 of 10

Sharing Your Code and Music

  1. Do you want others to just view or have editing rights?
  2. Do you want them to see future changes to the script?
  3. You can copy the link to send in a message
  4. You can type in a username
  5. They will see a notification next to the bell on their interface
  6. They will need to import to edit