View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

Christopher Michaud

Greetings! I will post links to Beginning Programming Assignments here:

Assignment #1: Dancing Myro Activity
http://nebomusic.net/MyroDance.html

Assignment #2: We all come from Red, Green, and Blue!: Pixels and Arrays in Python
http://nebomusic.net/JESPicsRGB.html

Quick Tip for Using "repaint" to show progress of Changing Picture:

def decreaseTopHalfRed(pic):
  show(pic)
  for x in range(1, getWidth(pic)):
    for y in range (1, getHeight(pic)/2):
      p = getPixel(pic,x,y)
      value = getRed(p)
      setRed(p, value * .5)
      repaint(pic)


Collage Pictures:

Code can by found at: http://nebomusic.net/MichaudCollage.txt









Flying!

ChristopherGalaxy.jpg

Chromakey code:
#---------------------------------------------#

# Chromakey Function with ability to select
# Where you want subjet to go
# Mr. Michaud
# www.nebomusic.net

def chromakey(chroma, bg, bgx, bgy):
  bgtargetX = bgx
  for chromaX in range(1, getWidth(chroma)):
    bgtargetY = bgy
    for chromaY in range(1, getHeight(chroma)):
      px = getPixel(chroma, chromaX, chromaY)
      tx = getPixel(bg, bgtargetX, bgtargetY)
      if getRed(px) + getBlue(px) < getGreen(px):
        setColor(tx, getColor(tx))
      else:
        setColor(tx, getColor(px))
      bgtargetY = bgtargetY + 1
    bgtargetX = bgtargetX + 1
  return bg

#---------------------------------------------#


Assignment #3: Palindromes in JES

Teacher instructions: http://nebomusic.net/PalindromesemordinlaP.html
Student Worksheet: http://nebomusic.net/PalindromesemordnilaP.pdf
Youtube Link to Mozart Palindrome Duet: http://www.youtube.com/watch?v=6r9ftDH6PYk
Sheetmusic to Mozart Palindrome Duet: http://nebomusic.net/Mozartspiegeli.pdf
Palindrome Sound Sample: http://www.nebomusic.net/palindrome.wav

Assignment #4 Idea: Warhol Effect

warholJoshua.jpg
warholChristopher.jpg

Code Sample for Warhol Effect:

#---------------------------------------------------#
# Warhol Effect
# Mr. Michaud
# www.nebomusic.net

# Function to Scale down picure by 1/2

def scalePicDown(pic):
  canvas = makeEmptyPicture(getWidth(pic)/2, getHeight(pic)/2)
  picX = 1
  for targetX in range(1, getWidth(canvas)):
    picY = 1
    for targetY in range(1, getHeight(canvas)):
      color = getColor(getPixel(pic, picX, picY))
      setColor(getPixel(canvas, targetX, targetY), color)
      picY = picY + 2
    picX = picX + 2
  return canvas

# Picture Chooser

def pickAndMakePicture():     
  Pic1 = pickAFile()
  Pic1 = makePicture(Pic1)
  return Pic1

# Warhol Effect

def warholEffect(pic):
  dest = scalePicDown(pic)
  dest = scalePicDown(dest)
  canvas = makeEmptyPicture(getWidth(dest)*8, getHeight(dest)*8)
  
  # Start copying in pictures
  for y in range(8):
    for x in range(8):
      canvas = copy(dest, canvas, (getWidth(dest)*x + 1), (getHeight(dest)*y)+1)
  return canvas

# General Copy Function

def copy(source, target, targX, targY):
  targetX = targX
  for sourceX in range(1, getWidth(source)):
    targetY = targY
    for sourceY in range(1, getHeight(source)):
      px = getPixel(source, sourceX, sourceY)
      tx = getPixel(target, targetX, targetY)
      setColor(tx, getColor(px))
      targetY = targetY + 1
    targetX = targetX + 1
  return target
#---------------------------------------------------#


More Assignments in Python and JES: (These are designed for Elementary and Middle School students)
(Could be used for introduction to programming at High School)

1. Turtle Simple Shape Drawing in Python (for IDLE or any Python IDE):
http://nebomusic.net/techlesson11-5.html

2. More Advanced Turtle Designs: (for IDLE or any Python IDE)
http://nebomusic.net/python_designs.html

3. Using MIDI and playNote() function in JES to make music:
http://nebomusic.net/techlesson13-5b.html

More resources for teaching technology can be found at:
http://nebomusic.net/computerhelp.html




Links to this Page