Tech Lesson 13-5b: Using JES to Create and Play Melodies:

Standards:
Demonstrates understanding of basic technology and telecommunication tools
Operates Basic technology tools and applications
CSTA Level I Standard 4: (3rd to 5th) Use general purpose productivity tools and peripherals to support personal productivity, remediate skill deficits, and facilitate learning throughout the curriculum.
CSTA Level I Standard 5: (3rd to 5th) Use technology tools for individual and collaborative writing, communication, and publishing activities to create presentations, and publishing activities to create presentations for audiences inside and outside the classroom.
CSTA Level I Standard 9: (3rd to 5th) Determine which technology is useful and select the appropriate tools and technology resources to address a variety of tasks and problems.

Basic Skills:
M4P5:  Students will represent mathematics in multiple ways.
M5A1: Students will represent and interpret the relationships between quantities algebraically

BCS-BP-6. Students will design solutions for simple programs using basic programming techniques and constructs.
Implement techniques such as conditional statements, iterative statements, and variables to solve simple problems.
Utilize basic mathematical expressions to solve simple problems.
Use arrays and lists where appropriate.
Comment programs to aid program readability.
Test and debug simple programs.
Analyze and explain simple programs involving fundamental programming constructs.

QCC 5th Grade General Music #18:
Topic: Artistic Skills and Knowledge: Creating, Performing, Producting
Standard: Recognizes and names frequently used musical symbols such as treble clef, notes, rests, and 3/4 and 4/4 meter signatures.

Objectives:

Identify Duration as the length of musical sounds.  
Identify the numeric relationship between 1/8, 1/4, and 1/2 and Whole notes.
Identify Pitch names on Treble Cleff Staff.
Use text programming in JES to have computer play simple melody.

Definitions:

JES:
Jython Environment for Students
Programming IDE for Python built on Java.  Used to write computer programs to manipulate pictures and sound.  Currently used at Georgia Tech to teach Introduction to Computer Science through Media Computation.

Pitch: Letter name of Note




JES Pitch Value Assignments:

C = 60
D = 62
E = 64
F = 65
G = 67
A = 69
B = 71
C = 72

Duration: Length of Note in milliseconds


Quarter Note
1 Beat
500 milliseconds
q = 500

Eighth Notes
1/2 Beat
250 milliseconds
e = 250

-or-

e = q/2

Half Note
2 Beats
1000 milliseconds
h = 1000

-or-

h = q*2

Whole Note
4 Beats
2000 milliseconds
w = 2000

-or-

w = q*4


Intensity: How loud a note is played (Usually 124)

Tempo = Speed of Beat

# Example Setting Tempo Code:

Tempo = 1000
q = Tempo
e = q/2
h = q*2
w = q*4


Comments in JES:


# This is a comment. 
# Any code after a "#" sign is not read by the program

# Comments show up as green text in JES



Play Note Command in JES:


playNote(pitch, duration, intensity)

 

Short Sample Program: (Plays 1st part of "Hot Cross Buns")

# This program plays first line of "Hot Cross Buns"

# Define Pitch Values
E = 64
D = 62
C = 60

# Define Rhythm Values
Q = 500
E = 250
H = 1000
W = 2000

# Play Melody
playNote(E, Q, 124)
playNote(D, Q, 124)
playNote(C, H, 124)


-----------------------------------------------------------------------------------------------------------------------------------

Project Description:
1. As class - write JES program to play "Hot Cross Buns" in C Major.

2. As Individuals - students pick Folk Song and Write program to play music.

Directions:

1. Pass out Keyboard Exercises Sheet - Demonstrate Labeling Hot Cross Buns.

2. Label Hot Cross Buns with letter names and pitch numbers.

3. Click JES Icon 1 time.  (You will need to wait a while for it to load.)

4. Do the "Hot Cross Buns" song program.  (Type the following into the JES Programming Window)


# This program plays "Hot Cross Buns" in C Major

# Define Pitches
E = 64
D = 62
C = 60

# Define Rhythm Values
# Value of Quarter Note, Eighth Note, and Half Note
q = 500
e = 250
h = 1000
w = 2000

#Play Song
playNote(E, h, 124)
playNote(D, h, 124)
playNote(C, w, 124)

playNote(E, h, 124)
playNote(D, h, 124)
playNote(C, w, 124)

playNote(C, q, 124)
playNote(C, q, 124)
playNote(C, q, 124)
playNote(C, q, 124)

playNote(D, q, 124)
playNote(D, q, 124)
playNote(D, q, 124)
playNote(D, q, 124)

playNote(E, h, 124)
playNote(D, h, 124)
playNote(C, w, 124)

# End of Program


5. Click File->Save and Save your program as:

Lastname Hot Cross Buns.py

6. Click "Load" and listen to your music.

7. Select from one of the following folk songs:

Twinkle Twinkle Little Star
Brother John
Jingle Bells

8. Write letter names of song in Keyboard Exercises Sheet.

9. Write a JES python program to play your song.  Save it as

Lastname Songname.py


Sample Program: Merrily We Roll Along in G Major


# Song Merrily We Roll Along in G Major
# Value of Quarter Note, Eighth Note, and Half Note
q = 1000
e = 500
h = 2000
w = 4000

# Define Pitch Values
B = 71
A = 69
G = 67

# Play Song Line 1
playNote(B, q, 124)
playNote(A, q, 124)
playNote(G, q, 124)
playNote(A, q, 124)
playNote(B, q, 124)
playNote(B, q, 124)
playNote(B, h, 124)
playNote(A, g, 124)
playNote(A, g, 124)
playNote(A, h, 124)
playNote(B, q, 124)
playNote(B, q, 124)
playNote(B, h, 124)

# Play Song Line 2
playNote(B, q, 124)
playNote(A, q, 124)
playNote(G, q, 124)
playNote(A, q, 124)
playNote(B, q, 124)
playNote(B, q, 124)
playNote(B, h, 124)
playNote(A, g, 124)
playNote(A, g, 124)
playNote(B, q, 124)
playNote(A, q, 124)
playNote(G, w, 124)

# End of Program