ENGIN 100: Music Signal Processing. PROJECT #1: Tone Synthesizer/Transcriber

Similar documents
Developing Your Musicianship Lesson 1 Study Guide

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

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

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

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

PHYSICS OF MUSIC. 1.) Charles Taylor, Exploring Music (Music Library ML3805 T )

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

Keyboard Version. Instruction Manual

Robert Alexandru Dobre, Cristian Negrescu

Experiment P32: Sound Waves (Sound Sensor)

Music Representations

Lab P5: Synthesis of Sinusoidal Signals Music Synthesis

Music Theory. Solfege Scales and The Piano

DSP First Lab 04: Synthesis of Sinusoidal Signals Music Synthesis. A k cos(ω k t + φ k ) (1)

GEORGIA INSTITUTE OF TECHNOLOGY SCHOOL of ELECTRICAL and COMPUTER ENGINEERING

Doubletalk Detection

Spectrum Analyser Basics

Development of an Optical Music Recognizer (O.M.R.).

Section V: Technique Building V - 1

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

Introduction to capella 8

CSC475 Music Information Retrieval

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

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

Part 1: Introduction to Computer Graphics

Lab experience 1: Introduction to LabView

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

xlsx AKM-16 - How to Read Key Maps - Advanced 1 For Music Educators and Others Who are Able to Read Traditional Notation

Computer Graphics: Overview of Graphics Systems

CHAPTER CHAPTER CHAPTER CHAPTER CHAPTER CHAPTER CHAPTER CHAPTER CHAPTER 9...

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

E X P E R I M E N T 1

Speaking in Minor and Major Keys

Student Guide for SOLO-TUNED HARMONICA (Part II Chromatic)

MUSIC THEORY CURRICULUM STANDARDS GRADES Students will sing, alone and with others, a varied repertoire of music.

Algorithmic Composition: The Music of Mathematics

1 Ver.mob Brief guide

Activity P42: Sound Waves (Power Output, Sound Sensor)

Getting started with music theory

1 Introduction to Pitch

Musica Visualis: On the Sonification of the Visual and the Visualisation of Sound

The. finale. Projects. The New Approach to Learning. finale. Tom Carruth

Piano Safari Sight Reading & Rhythm Cards for Book 2

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

Overview. Teacher s Manual and reproductions of student worksheets to support the following lesson objective:

Homework Booklet. Name: Date:

CURIE Day 3: Frequency Domain Images

Introduction To LabVIEW and the DSP Board

2014A Cappella Harmonv Academv Handout #2 Page 1. Sweet Adelines International Balance & Blend Joan Boutilier

Blueline, Linefree, Accuracy Ratio, & Moving Absolute Mean Ratio Charts

PHY221 Lab 1 Discovering Motion: Introduction to Logger Pro and the Motion Detector; Motion with Constant Velocity

Music Theory: A Very Brief Introduction

Week. Intervals Major, Minor, Augmented, Diminished 4 Articulation, Dynamics, and Accidentals 14 Triads Major & Minor. 17 Triad Inversions

Lab Determining the Screen Resolution of a Computer

Creating a Lead Sheet Using Logic Pro X and Sibelius

Music Theory For Pianists. David Hicken

Student Performance Q&A:

2018 MUSIC Total marks : 70 Time : 3 hours

Credo Theory of Music Training Programme GRADE 5 By S.J. Cloete

Handout 1 - Introduction to plots in Matlab 7

Ultimate Music Theory Basic Rudiments

LESSON 1 PITCH NOTATION AND INTERVALS

Music Representations

Articulation Clarity and distinct rendition in musical performance.

Task-based Activity Cover Sheet

SOUND LABORATORY LING123: SOUND AND COMMUNICATION

Musical Literacy - Contents!

Student Performance Q&A:

How to Read Just Enough Music Notation. to Get by in Pop Music

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

MUSIC100 Rudiments of Music

CHAPTER I BASIC CONCEPTS

Circle of Fifths - Introduction:

A Matlab toolbox for. Characterisation Of Recorded Underwater Sound (CHORUS) USER S GUIDE

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

and Bass Clef AND the other chords in the Key of C: Dm or ii, Em or iii, Am or vi, and Bdim or viidim. Check it out and see that the rule works!

Proceedings of the 7th WSEAS International Conference on Acoustics & Music: Theory & Applications, Cavtat, Croatia, June 13-15, 2006 (pp54-59)

BBN ANG 141 Foundations of phonology Phonetics 3: Acoustic phonetics 1

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

Classroom. Chapter 4: Lesson 22

Student Performance Q&A:

Understanding basic tonic chord structure and how the singer can find her note from the pitch blown

AP Music Theory Westhampton Beach High School Summer 2017 Review Sheet and Exercises

Lesson Week: August 17-19, 2016 Grade Level: 11 th & 12 th Subject: Advanced Placement Music Theory Prepared by: Aaron Williams Overview & Purpose:

Bridges and Arches. Authors: André Holleman (Bonhoeffer college, teacher in research at the AMSTEL Institute) André Heck (AMSTEL Institute)

ALGEBRAIC PURE TONE COMPOSITIONS CONSTRUCTED VIA SIMILARITY

Primo Theory. Level 5 Revised Edition. by Robert Centeno

USING MATLAB CODE FOR RADAR SIGNAL PROCESSING. EEC 134B Winter 2016 Amanda Williams Team Hertz

ECE438 - Laboratory 4: Sampling and Reconstruction of Continuous-Time Signals

Written Piano Music and Rhythm

A Review of Fundamentals

Property of HR# This packet will be your theory textbook. Please bring to each class.

Pitch and Keyboard. Can you think of some examples of pitched sound in music? Can you think some examples of non-pitched sound in music?

7th Grade Beginning Band Music

The Basics of Reading Music by Kevin Meixner

DATA COMPRESSION USING THE FFT

COURSE OUTLINE. Corequisites: None

6.111 Final Project: Digital Debussy- A Hardware Music Composition Tool. Jordan Addison and Erin Ibarra November 6, 2014

Getting Your Feet Wet with Music Theory

Getting started with music theory

Transcription:

ENGIN 100: Music Signal Processing 1 PROJECT #1: Tone Synthesizer/Transcriber Professor Andrew E. Yagle Dept. of EECS, The University of Michigan, Ann Arbor, MI 48109-2122 I. ABSTRACT This project teaches you the Matlab Graphical User Interface (GUI) tools you will be using in the other two projects. It also demonstrates some issues you will face during the projects. The goals of this project are: (1) To write a Matlab program for a tone synthesizer with an on-screen mouse-activated keypad; (2) To write a Matlab program for a tone transcriber that produces a Matlab stem plot similar to musical staff notation from a pure tonal signal. The second project will do the same thing for telephone touch-tones; the third project will do the same thing for synthesized musical instruments. This project will help you do both. II. BACKGROUND In Lab #2 you learned the frequencies used in a pure tonal version of The Victors. In this lab you will apply that knowledge to build a tone synthesizer and transcriber. You need to know some musical notation and nomenclature, and some graphical Matlab commands. These are covered in the next two sections. III. BASICS OF MUSICAL STAFF NOTATION A. Results from Lab #2 In Lab #2 you learned that the musical tones used in The Victors had the following frequencies: 392, 440, 494, 523, 587, 659 Hertz(rounded to the nearest integer). You also inferred that there were missing frequencies: 415, 466, 554, 622 Hertz. You also deduced that these notes are related to each other not by common differences, but by a common ratio of 1.06 (actually 1.0595). In fact 1.0595 is the 12 th root of 2 (2 1/12 ). That immediately suggests that there is a basic set of 12 notes, which repeat with their frequencies multiplied by integer powers (positive and negative) of two. This is indeed the case. This is the modern 12-tone or chromatic musical scale; most Western music is based on it. The repetitions of the 12 frequencies are called octaves, since a span of 8 whole tones doubles the frequency. So 880 Hertzis one octave above 440 Hertz, and 220 Hertzis one octave below 440 Hertz. We will focus on the octave spanned by the frequencies in The Victors, since many musical compositions use this octave. However, the 88 keys of a piano keyboard span 8 octaves: Rightmost key: 4186 Hertzis 3 octaves above 523 Hertz(4186/2 3 523) Leftmost key: 27.5 Hertzis 4 octaves below 440 Hertz(0440/2 4 27.5).

2 B. MIDI Frequency Notation This information is enough to create a notation for most Western music, The Musical Instrument Digital Interface (MIDI) notation represents musical frequencies with integers from 0 to 127 using the formula MIDI =69+12log 2 (F/440) where F is frequency in Hertz. In MIDI notation, frequencies of The Victors are represented as 71,67,69,71,67,69,71,72,69,71,72,69,71,72,74,76,71,71,72,67,69,71,74,71,69,67 MIDI also includes information about amplitude, duration, and some other things. C. Musical Staff Notation Musical staff notation (the musical notation you usually see) is more complicated. The reason is that the frequencies used in The Victors are much more commonly used in Western music than the missing frequencies from Lab #2 (that s why they were missing). The 7 tones in The Victors are called whole tones anddesignatedwithletters:a,b,c,d,e,f,g. The 5 missing tones are called accidentals or sharps and flats, and they are designated by # and b A#=Bb, C#=Db, D#=Eb, F#=Gb, G#=Ab (pronounced A-sharp and B-flat, etc.). Bb is below B (between A and B) and C# is above C (between C and D); A# is the same as Bb, etc. The entire group of 12 tones (which can be represented using either listing below) {A,A#,B,C,C#,D,D#,E,F,F#,G,G#} same as {A,Bb,B,C,Db,D,Eb,E,F,Gb,G,Ab} are called semitones because they include both whole tones and their halfway-between accidentals. Ona piano keyboard, the whole tones are the white keys and the accidentals (sharps and flats) are the black keys. Why are the whole tones used much more than the accidentals? Because they sound better! The reason they sound better is that the ratios between their frequencies are very close to ratios of small integers. For example, A is 440 Hertzand E is 659 Hertz, almost exactly a 3:2 ratio. Indeed, Western music was first based on using these ratios of small integers, rather than the equally-spaced logarithms of frequencies used today. The change occurred when J.S. Bach composed The Well-Tempered Clavicord using the 12-tone scale. It sounded better than using the frequencies based on small integer ratios ( The Ill-Tempered Clavicord?). This can all be summarized in the following table: NOTES A A# B C C# D D# E F F# G G# FREQS 440 Hz 2 0/12 2 1/12 2 2/12 2 3/12 2 4/12 2 5/12 2 6/12 2 7/12 2 8/12 2 9/12 2 10/12 2 11/12 Hertz 440 466 494 523 554 587 622 659 698 740 784 830 Ratio 1:1 none 9:8 6:5 5:4 4:3 none 3:2 none 5:3 16:9 15:8

3 The ratios are only approximate; changing from these ratios to a constant ratio of 2 1/12 between notes gave the well-tempered 12-tone scale. Then different keys can be used without affecting frequency ratios. There is no reason to start with A. Starting with G,C and A and looking mostly at whole tones, we have G A B C D E F# G 1:1 9:8 5:4 4:3 3:2 5:3 15:8 2:1 DO RE MI FA SO LA TI DO WHOLE CMAJOR: C,D,E,F,G,A,B,C NOTES INTERVAL: 1,1, 1 2,1,1,1, 1 2 ONLY AMINOR: A,B,C,D,E,F,G,A Here DO-RE-MI-FA-SO-LA-TI-DO will be familar to anyone who has seen the movie The Sound of Music. A musical staff consists of 5 parallel horizontal lines with circles (notes) on it. Horizontal position is time (read left to right) and vertical position is note frequency. Both the lines themselves, and the spaces between lines, are used to represent whole notes only; accidentals (sharps and flats) have a # or b in front of the note, respectively. This seems messier than MIDI notation, but since accidental notes occur so less often, it actually simplifies reading the notation while playing an instrument, they tell me (sight-reading). Below left: Musical staff representation of whole notes. Below right: Notes on a piano keyboard. E F G A B C D E F C D # # F G A # # # C D E F G A B The thing that looks like a script G in front (not shown) is called a treble clef. The small circular lower end encircles the line representing note G; usually this is the second line from the bottom, as shown above (this is the worst notation I ve ever seen). Lines that look like flag staffs and flags extend from the circles to represent the duration of that note. I won t get into bass clefs and the rest (including rests) here. A musical transcription of the chorus of The Victors, without the staffs, then looks like this: Actual sheet music for the chorus of The Victors (obtained from the UM web site) is on the next page.

4 IV. MATLAB GRAPHICS USED IN THIS PROJECT You will need to use three new Matlab commands in this project. Each one is discussed below. >> uicontrol( Style, Pushbutton, Position,[200 400 50 100], String, A, Callback, sound(cos(2*pi*440*[1:3000]/8192)) ); (all of this command must be on one line) Creates an on-screen rectangular pushbutton of size 100 50 screen pixels, with lower left corner 200 pixels from the left border and 400 pixels above the bottom border, and puts an A in the middle of it. So the pushbutton corners are at Cartesian coordinates {(200, 400), (250, 400), (200, 500), (250, 500)},wherethe origin is the lower-left corner of the screen, and distance is measured in pixels. When the button is pushed by putting the mouse cursor over it and left-clicking, it executes the Matlab command shown. Here, that sounds a 440 Hertztone for 3000 8192 seconds. The role of each part of the command should be evident here. You should be able to use a sequence of commands like this to create an on-screen keyboard, labelled with all of the various notes, and with the accidental notes (sharps and flats) in a row above the whole notes, just like an actual piano keyboard. You can even color the pushbuttons black and white, or you can label them. The command for each pushbutton must both sound the tone and concatenate it with previous ones: Z=cos(2*pi*440*[1:L]/FS);X=[X Z];sound(Z,FS); for length of L samples and sampling rate FS. >> subplot(311),stem(x, filled ),axis([0 length(x) 0 4]) Produces a stem plot of the numbers in vector X with axes as shown. Try >> stem([3 1 4 1 5 9]) to see a stem plot. You can fill in the circles using stem(x, filled ), and even change the stem lines. >> set(gca, YGrid, on, YTick,[0 1 2 3 4]) Changes the graph so that it looks like the musical staff notation shown above. If you want solid lines, you can add GridLineStyle, - to this command. You can also add labels, titles, and other things. 4 3 2 1 0 0 61

5 >> save proj1.mat X Y and >> load proj1.mat Saves the variables X and Y to a file proj1.mat; recovers all of the variables saved in proj1.mat. V. PROJECT #1: WHAT YOU HAVE TO DO The results of this project are two.m files, one implementing a synthesizer and one implementing a transcriber. You also have to demonstrate to the lab IA that they work, as described below. Remember throughout that sharps and flats complicate things; MIDI transcription would be easier. This lab would be much easier if they didn t exist, but life isn t like that (engineers must remember this). A. Musical Tone Synthesizer: On-screen Keyboard Write a Matlab program (and store it as an.m file) that: Creates an on-screen keyboard, using a sequence of uicontrol commands, that resembles the one octave of a keyboard on which the chorus of The Victors is played. Keys should be tall and thin, like a piano; The keyboard should run from G to G and include, in a row above, accidentals in between; Produces the appropriate tone when pressed by left-clicking the mouse on it; Includes an end key that plays back the notes in order, and writes the signal to proj1.mat; Makes each tone last 2000 7999 seconds at a sampling rate of 7999 SAMPLE SECOND ; Using a sampling rate of 8192 SAMPLE SECOND makes some values of the tonal signal zero, so that the frequency estimation algorithm would be dividing by zero! See if you can figure out why; Show you can play The Victors and Taps on it. You may need to practice to get the notes right; This program is almost entirely a sequence of uicontrol commands, one for each piano key. B. Musical Tone Transcriber Write another Matlab program (and store it as an.m file) that: Loads the file proj1.mat generated by your synthesizer above; Prints out on the screen a musical transcription of the tones in musical staff notation using Matlab s stem; Uses the frequency estimation algorithm used in Lab #2, and assumes each tone lasts 2000 7999 seconds; Uses load( proj1.mat );Y=reshape(x,2000,length(x)/2000); where x is your synthesizer output; Uses F=7999/2/pi*acos(mean((Y(3:2000,:)+Y(1:1998,:))./Y(2:1999,:)/2)); to get frequencies; Only has to work for the octave in which the chorus of The Victors is played; On translating the frequency estimates into notes: Let K=12*log2(F/440)+6. Explain the +6 Then stem S(I) where S=[0.5.75 1 1.25 1.5 1.75 2 2.5 2.75 3 3.25 3.5 4]; plots correctly. C. Project Report Your team will present the results of this project in an oral presentation to the entire class. Send the two.m files, named yourteamname1.m and yourteamname2.m, to your lab instructor. Also address these issues: Should you be able to copyright any sequence of tones you can create? If we can write tonal signal as a mathematical expression, can music legitimately be copyrighted?