Assignment #3: Piezo Cake

Similar documents
1. Arduino Board and Breadboard set up from Project 2 (8 LED lights) 2. Piezo Speaker

Math and Music Developed by Megan Martinez and Alex Barnett in conjunction with Ilene Kanoff

Circuit Playground Hot Potato

Computer Architecture and Organization. Electronic Keyboard

Module 4: Traffic Signal Design Lesson 1: Traffic Signal (Arduino) Control System Laboratory Exercise Grade 6-8

8 th Grade Concert Band Learning Log Quarter 1

LESSON 1 PITCH NOTATION AND INTERVALS

HS Music Theory Music

Lesson 4 RGB LED. Overview. Component Required:

One Shot, Two Shot, Red Shot, Blue Shot. Build Instructions

The Practice Room. Learn to Sight Sing. Level 3. Rhythmic Reading Sight Singing Two Part Reading. 60 Examples

Experiment 9A: Magnetism/The Oscilloscope

Arduino Lesson 3. RGB LEDs

The Mathematics of Music and the Statistical Implications of Exposure to Music on High. Achieving Teens. Kelsey Mongeau

Make It Sound. Created by Mike Barela. Last updated on :10:45 PM UTC

ENGR 40M Project 3b: Programming the LED cube

Keys: identifying 'DO' Letter names can be determined using "Face" or "AceG"

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

Objectives: Learn how LED displays work Be able to output your name on the display

Northeast High School AP Music Theory Summer Work Answer Sheet

La Salle University. I. Listening Answer the following questions about the various works we have listened to in the course so far.

First Name Last Name November 10, 2009 CS-343 Exam 2

The Physics Of Sound. Why do we hear what we hear? (Turn on your speakers)

Laboratory 8. Digital Circuits - Counter and LED Display

Lab experience 1: Introduction to LabView

OCTAVE C 3 D 3 E 3 F 3 G 3 A 3 B 3 C 4 D 4 E 4 F 4 G 4 A 4 B 4 C 5 D 5 E 5 F 5 G 5 A 5 B 5. Middle-C A-440

Music Representations

Note Names and Values, and the story of The Great Stave

TV Synchronism Generation with PIC Microcontroller

Central Valley School District Music 1 st Grade August September Standards August September Standards

Instructions and answers for teachers

Interfacing Analog to Digital Data Converters. A/D D/A Converter 1

Kindergarten: Peer Gynt- Grieg Babes in Toyland- Herbert The King and I- Rodgers Carnival of the Animals- Saint Säens. 1 st Grade

DSP First Lab 04: Synthesis of Sinusoidal Signals - Music Synthesis

The Practice Room. Learn to Sight Sing. Level 2. Rhythmic Reading Sight Singing Two Part Reading. 60 Examples

PRIMARY MUSIC CURRICULUM MAP

Developing Your Musicianship Lesson 1 Study Guide

Marion BANDS STUDENT RESOURCE BOOK

INTERMEDIATE STUDY GUIDE

Technology Control Technology

Digital (5hz to 500 Khz) Frequency-Meter

Intermediate Concert Band

Sounds of Music. Definitions 1 Hz = 1 hertz = 1 cycle/second wave speed c (or v) = f f = (k/m) 1/2 / 2

Elements of Music. How can we tell music from other sounds?

Elements of Music David Scoggin OLLI Understanding Jazz Fall 2016

Lecture 5: Frequency Musicians describe sustained, musical tones in terms of three quantities:

Measure the value of water flow using water flow sensor and DC water pump 12 V interfacing with Arduino uno

Model Railway Animation: Part 1, LEDs - Expanded By David King

Chapter 2: Beat, Meter and Rhythm: Simple Meters

Lecture (04) Arduino Microcontroller Programming and interfacing. By: Dr. Ahmed ElShafee

Music Representations

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

The Basics of Reading Music by Kevin Meixner

Music Appreciation, Dual Enrollment

OBOE METHOD. a classical method for beginners. Elaine Reid

Informatics Enlightened Station 1 Sunflower

(12) Patent Application Publication (10) Pub. No.: US 2004/ A1. Kusumoto (43) Pub. Date: Oct. 7, 2004

Lab P-6: Synthesis of Sinusoidal Signals A Music Illusion. A k cos.! k t C k / (1)

Simple Harmonic Motion: What is a Sound Spectrum?

Robert Alexandru Dobre, Cristian Negrescu

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

EP486 Microcontroller Applications

Simple Way To Brighten Up A 17 Computer Monitor Picture Tube

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

Please fax your students rhythms from p.7 to us AT LEAST THREE DAYS BEFORE the video conference. Our fax number is

Laboratory Assignment 3. Digital Music Synthesis: Beethoven s Fifth Symphony Using MATLAB

Chapter 4. It Began with a Dripping Faucet

NEW HAMPSHIRE TECHNICAL INSTITUTE

Integrated Circuit for Musical Instrument Tuners

Rote to Note Beginning Note Reading for Viola Unit Study Pages

8/5/17. Good Morning/Afternoon! AUGUST 21, 2017

Essential Keyboard Skills Course Level 1 Extension Activity Workbook

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

CARLISLE AREA SCHOOL DISTRICT Carlisle, PA Elementary Classroom Music K-5

Informatics Enlightened Station 2 Park distance control system

COMP sequential logic 1 Jan. 25, 2016

Music Theory. Fine Arts Curriculum Framework. Revised 2008

Assignment 3: 68HC11 Beep Lab

MUSIC TRANSCRIBER. Overall System Description. Alessandro Yamhure 11/04/2005

Plainfield Music Department Middle School Instrumental Band Curriculum

Mathematics in Contemporary Society Chapter 11

Secrets To Better Composing & Improvising

RHYTHM. Simple Meters; The Beat and Its Division into Two Parts

NEW HAMPSHIRE TECHNICAL INSTITUTE. After successfully completing the course, the student will be able to:

Homework Booklet. Name: Date:

Intermediate Midpoint Level 3

I. LISTENING. For most people, sound is background only. To the sound designer/producer, sound is everything.!tc 243 2

Study Guide. Solutions to Selected Exercises. Foundations of Music and Musicianship with CD-ROM. 2nd Edition. David Damschroder

Choir Scope and Sequence Grade 6-12

PITCH & INTONATION. Baritone T.C. The American Band College of Sam Houston State University. By Kendra R. Schwartz. A Beginner s Guide to:

Musical Signal Processing with LabVIEW Introduction to Audio and Musical Signals. By: Ed Doering

The Keyboard. An Introduction to. 1 j9soundadvice 2013 KS3 Keyboard. Relevant KS3 Level descriptors; The Tasks. Level 4

LESSON ONE. New Terms. a key change within a composition. Key Signature Review

Course Overview. Assessments What are the essential elements and. aptitude and aural acuity? meaning and expression in music?

Mathematics in Contemporary Society - Chapter 11 (Spring 2018)

Preface. Ken Davies March 20, 2002 Gautier, Mississippi iii

This module senses temperature and humidity. Output: Temperature and humidity display on serial monitor.

The computer speakers can be loud. So, you may want to adjust the volume. For example, on the Mac keyboard you can use the F11 and F12 keys.

Vending Machine. Keywords FSM, Vending Machine, FPGA, VHDL

Grade Level Expectations for the Sunshine State Standards

Transcription:

Assignment #3: Piezo Cake Computer Science: 7 th Grade 7-CS: Introduction to Computer Science I Background In this assignment, we will learn how to make sounds by pulsing current through a piezo circuit. We will use a lookup table built using one-dimensional arrays to find the right note to play on our Arduino. Beats will be used on the tempo so that we could make a recognizable song from our experiment. Sound waves are vibrations in the air pressure. The speed of the vibrations (cycles per second or Hertz) is what makes the pitch of the sound. The higher the frequency of the vibration, the higher the pitch will be. Middle C is usually defined as a frequency of 261 Hz. If you turn a digital output on and off again 261 times every second then that output will be middle C. To hear the output, we need to attach something that will convert the electrical signal into sound waves. This can be done with a loudspeaker or, as we have used here, a piezo sounder. Piezo sounders use a special crystal that expands and contracts as an electrical signal passes through it. This will generate a tone that we can hear. Assignment #3: Piezo Cake Computer Science: 7 th Grade Page 1

Assignment Create a melody from one of your favorite songs that uses several different notes. These notes can include flats and sharps. Remember to include a proper tempo in your composition. If your song has half notes, quarter notes or even eighth notes, remember to have the proper beats for the tempo that you choose. Here are some suggestions: Star Trek theme (TOS) Star Wars theme (the original trilogy) Sound of Music (Julie Andrews, et al.) Holiday songs Children s nursery rhymes Anything with Mozart, Bach, Beethoven, Vivaldi, Schumann, Mendelssohn, Chopin, Rossini, Verdi, Donizetti, Puccini, Morricone Computer Program Requirements 1. Use an array to hold the notes of your song, in frequency values (Hz) 2. Use an array to hold the number of beats each note is to be played 3. Use LEDs to light up as your song plays, but make sure the correct LED sequence lights up 4. Use a push button to start and stop your Arduino project 5. Use at following functions in your code: i. int gettonevalue() Calculates the tone to generate based on the formula in Additional Resources ii. void playnote() Plays the tone that you just calculated for a given duration 6. Use loops and if-statements 7. Use variables Expectations When you are finished your composition, you will need to hand in the following: Your finished sketch with proper commenting and good programming style A written report, including the sheet music that you used. This can be taken from anywhere (Internet, book, copied or even hand written). If you didn t use any sheet music but sounded out the melody, write down the notes on a sheet of music paper A circuit diagram of your Arduino project showing all the circuits you used (i.e, piezo circuit, LEDs, wires, pin assignments, etc.). Label all pins and resistor values. Assignment #3: Piezo Cake Computer Science: 7 th Grade Page 2

Prerequisites To successfully complete this assignment, you will need to have completed the prior two assignments. Additional Resources Below is an Octave Chart that shows all the frequencies of the notes (Hz). Notice the sharps and flats too. As a reference, the red box shows the Middle C octave. Formulas to use: Period, P = (1 / f) * 1000000 Time high, TH = P / 2 where, f = frequency of the note in Hz, TH = the tone value to use in your sketch Hint: Pay attention to the use of double, float and int variables. Remember that these variables don t like each other! Assignment #3: Piezo Cake Computer Science: 7 th Grade Page 3

Code Template int notec4 = 261; // middle C, frequency in Hertz (Hz) int notecs4 = 277; // C sharp int noted4 = 293; int notee4 = 329; int notef4 = 349; int noteg4 = 391; int notea4 = 440; int noteb4 = 493; int notes[] = { notec4, noted4, notee4, notef4, noteg4, notea4, noteb4; int beats[] = { 1, 1, 1, 1, 1, 1, 2 ; int tempo = 500; // tempo of the notes, in milliseconds int speakerpin = 2; int pushbuttonpin = 13; void setup() { // initialize your pins pinmode(pushbuttonpin, INPUT); // Push button on pin 13 pinmode(speakerpin, OUTPUT); // piezo speaker pin is on pin 2 // Initialize the rest of the LED pins void loop() { if (digitalread(pushbuttonpin) == LOW) { // Use a for-loop to go through the notes[] array // Loop for 7 times because this is how many notes are in our array for ( int i = 0; i < 8; i++ ) { playnote(notes[i], beats[i] * tempo); // ************************* Functions are defined below ***************************** void playnote(int hertz, int duration) { int tone = gettonevalue(hertz); // tone value is stored in an int data type // Turn on the LEDs // You can use if statements here to turn on the correct LED for each note // The following for-loop will pulse the piezo speaker to create // an approximation of the proper note for (long i = 0; i < duration * 1000L; i += tone * 2) { // The piezo speaker will vibrate at a certain frequency, depending on how fast // we pulse the current. The faster the pulse, the higher the frequency. The higher the // frequency, the higher pitch sound digitalwrite(speakerpin, HIGH); delaymicroseconds(tone); digitalwrite(speakerpin, LOW); delaymicroseconds(tone); // Turn off the LED // Use the same if statements as before but turn off the LEDs this time double gettonevalue(int hertz) { double P = <put your equation here, see above> double TH = <put your equation here, see above> return TH; Assignment #3: Piezo Cake Computer Science: 7 th Grade Page 4

Grading Plan Grades are calculated using the following rubric: Finished working sketch 50% Proper creation and use of the functions: void playnote(), void gettonevalue() 10% Proper comments where needed 10% Good programming style 20% Written report, including sheet music to follow the melody 5% Accurate and labeled circuit diagram 5% Total marks possible: 100% Assignment #3: Piezo Cake Computer Science: 7 th Grade Page 5