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

Similar documents
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

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

Lab P5: Synthesis of Sinusoidal Signals Music Synthesis

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

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

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

Music Alignment and Applications. Introduction

Experiment 2: Sampling and Quantization

1 Overview. 1.1 Digital Images GEORGIA INSTITUTE OF TECHNOLOGY. ECE 2026 Summer 2018 Lab #5: Sampling: A/D and D/A & Aliasing

Music Representations

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

Robert Alexandru Dobre, Cristian Negrescu

Measurement of overtone frequencies of a toy piano and perception of its pitch

1 Overview. 1.1 Digital Images GEORGIA INSTITUTE OF TECHNOLOGY. ECE 2026 Summer 2016 Lab #6: Sampling: A/D and D/A & Aliasing

Music Representations

MIE 402: WORKSHOP ON DATA ACQUISITION AND SIGNAL PROCESSING Spring 2003

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

Book: Fundamentals of Music Processing. Audio Features. Book: Fundamentals of Music Processing. Book: Fundamentals of Music Processing

Laboratory 5: DSP - Digital Signal Processing

1 Ver.mob Brief guide

Handout 1 - Introduction to plots in Matlab 7

Lab 1 Introduction to the Software Development Environment and Signal Sampling

UNIVERSITY OF BAHRAIN COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

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

Interface Practices Subcommittee SCTE STANDARD SCTE Measurement Procedure for Noise Power Ratio

LESSON 1 PITCH NOTATION AND INTERVALS

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

PCM ENCODING PREPARATION... 2 PCM the PCM ENCODER module... 4

SOUND LABORATORY LING123: SOUND AND COMMUNICATION

2. AN INTROSPECTION OF THE MORPHING PROCESS

Elements of Music David Scoggin OLLI Understanding Jazz Fall 2016

Swept-tuned spectrum analyzer. Gianfranco Miele, Ph.D

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

Getting Started with the LabVIEW Sound and Vibration Toolkit

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

AN ARTISTIC TECHNIQUE FOR AUDIO-TO-VIDEO TRANSLATION ON A MUSIC PERCEPTION STUDY

Electrical and Electronic Laboratory Faculty of Engineering Chulalongkorn University. Cathode-Ray Oscilloscope (CRO)

Spectral Sounds Summary

Spectrum Analyser Basics

Lab experience 1: Introduction to LabView

AN INTEGRATED MATLAB SUITE FOR INTRODUCTORY DSP EDUCATION. Richard Radke and Sanjeev Kulkarni

Lab 5 Linear Predictive Coding

International Journal of Computer Architecture and Mobility (ISSN ) Volume 1-Issue 7, May 2013

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

Musical Acoustics Lecture 15 Pitch & Frequency (Psycho-Acoustics)

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

UNIVERSITY OF DUBLIN TRINITY COLLEGE

Department of Communication Engineering Digital Communication Systems Lab CME 313-Lab

Algorithmic Composition: The Music of Mathematics

Investigation of Digital Signal Processing of High-speed DACs Signals for Settling Time Testing

Digital music synthesis using DSP

Music, nature and structural form

CSC475 Music Information Retrieval

PHY 103: Scales and Musical Temperament. Segev BenZvi Department of Physics and Astronomy University of Rochester

Simple Harmonic Motion: What is a Sound Spectrum?

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

Chapter 2 Signals. 2.1 Signals in the Wild One-Dimensional Continuous Time Signals

Pitch. The perceptual correlate of frequency: the perceptual dimension along which sounds can be ordered from low to high.

Calibrate, Characterize and Emulate Systems Using RFXpress in AWG Series

EE513 Audio Signals and Systems. Introduction Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

The Definition of 'db' and 'dbm'

The Measurement Tools and What They Do

Agilent DSO5014A Oscilloscope Tutorial

Music Theory: A Very Brief Introduction

Experiment 9A: Magnetism/The Oscilloscope

E Lesson Plan Day #1 Choir-Crowther

Topic 10. Multi-pitch Analysis

Experiment 9 Analog/Digital Conversion

Introduction to Data Conversion and Processing

Essential Keyboard Skills Course Level 1 Extension Activity Workbook

Evaluating Oscilloscope Mask Testing for Six Sigma Quality Standards

The BAT WAVE ANALYZER project

ZONE PLATE SIGNALS 525 Lines Standard M/NTSC

Course Web site:

Interface Practices Subcommittee SCTE STANDARD SCTE Composite Distortion Measurements (CSO & CTB)

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

ECE 5765 Modern Communication Fall 2005, UMD Experiment 10: PRBS Messages, Eye Patterns & Noise Simulation using PRBS

THE importance of music content analysis for musical

5.8 Musical analysis 195. (b) FIGURE 5.11 (a) Hanning window, λ = 1. (b) Blackman window, λ = 1.

Speaking in Minor and Major Keys

DAT335 Music Perception and Cognition Cogswell Polytechnical College Spring Week 6 Class Notes

Developing Your Musicianship Lesson 1 Study Guide

Author Index. Absolu, Brandt 165. Montecchio, Nicola 187 Mukherjee, Bhaswati 285 Müllensiefen, Daniel 365. Bay, Mert 93

5.7 Gabor transforms and spectrograms

Analysis of local and global timing and pitch change in ordinary

Part II: Dipping Your Toes Fingers into Music Basics Part IV: Moving into More-Advanced Keyboard Features

DATA COMPRESSION USING THE FFT

The Tone Height of Multiharmonic Sounds. Introduction

Analysis of WFS Measurements from first half of 2004

Scoregram: Displaying Gross Timbre Information from a Score

Lecture 1: What we hear when we hear music

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

Music 175: Pitch II. Tamara Smyth, Department of Music, University of California, San Diego (UCSD) June 2, 2015

What are Add-On Effects? Add-On Effects are software packages that install additional high-quality effects programs on digital consoles.

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

The Research of Controlling Loudness in the Timbre Subjective Perception Experiment of Sheng

Logo Music Tools by Michael Tempel

RECOMMENDATION ITU-R BT (Questions ITU-R 25/11, ITU-R 60/11 and ITU-R 61/11)

UNIVERSAL SPATIAL UP-SCALER WITH NONLINEAR EDGE ENHANCEMENT

Transcription:

DSP First, 2e Signal Processing First Lab P-6: Synthesis of Sinusoidal Signals A Music Illusion Pre-Lab: Read the Pre-Lab and do all the exercises in the Pre-Lab section prior to attending lab. Verification: The Exercise section of each lab should be completed during your assigned Lab time and the steps marked Instructor Verification signed off during the lab time. When you have completed a step that requires verification, demonstrate the result to your instructor and answer any questions about it. Turn in the completed verification sheet before you leave the lab. Lab Report: The project requires an extensive programming effort and should be documented with a complete lab report. A good report should include the following items: a cover sheet, commented MATLAB code, explanations of your approach, conclusions and any additional tweaks that you implemented for the synthesis. Since the project must be evaluated by listening to the quality of the synthesized sounds, the criteria for judging a good result are given at the end of this lab description. 1 Introduction This lab includes a project on sound synthesis with sinusoids. sinusoidal waveforms of the form The sound synthesis will be done with x.t/ D X k A k cos.! k t C k / (1) where the amplitudes can be manipulated to produce a musical illusion. The challenge of the lab is to adjust the amplitudes to improve the subjective quality for listening. 2 Pre-Lab In this lab, periodic waveforms and music signals are created with the intention of playing them out through a speaker. Therefore, it is necessary to account for the fact that a conversion is needed from the digital samples, which are numbers stored in the computer memory to the actual voltage waveform that will be amplified and heard through the speakers. In particular, the Nyquist rate condition must be obeyed samples must be created at a rate that is twice the highest frequency in the synthesized signal (see Chapter 4). 2.1 Piano Keyboard Section 4 of this lab consists of synthesizing notes in one octave of a musical scale. 1 Since these signals require sinusoidal tones to represent piano notes, a quick introduction to the layout of the piano keyboard is needed. On a piano, the keyboard is divided into octaves the notes in one octave being twice the frequency of the notes in the next lower octave. The white keys in each octave are named A through G. In order to define the frequencies of all the keys, one key must be designated as the reference. Usually, the reference note is the A above middle-c, called A-440 (or A 4 ) because its frequency is 440 Hz. (In this lab, we are using the number 40 to represent middle C. This is somewhat arbitrary; for instance, the 1 If you have little or no experience reading music, don t be intimidated. Only a little music knowledge is needed to carry out this lab. On the other hand, the experience of working in an application area where you must quickly acquire new knowledge is a valuable one. Many real-world engineering problems have this flavor, especially in signal processing which has such a broad applicability in diverse areas such as geophysics, medicine, radar, speech, etc. 1 McClellan, Schafer and Yoder, Signal Processing First.

OCTAVE 41 43 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 28 30 32 33 35 37 39 40 42 44 45 47 49 51 52 54 56 57 59 61 63 Middle-C A-440 Figure 1: Layout of a piano keyboard. Key numbers are shaded. The notation C 4 means the C-key in the fourth octave. Musical Instrument Digital Interface (MIDI) standard represents middle C with the number 60). Each octave contains 12 notes (5 black keys and 7 white) and the ratio between the frequencies of the notes is constant between successive notes. As a result, this ratio must be 2 1=12. Since middle C is 9 keys below A-440, its frequency is approximately 261 Hz. Consult the text for even more details. Musical notation shows which notes are to be played and their relative timing (half, quarter, or eighth). Figure 2 shows how the keys on the piano correspond to notes drawn in musical notation. The white keys are labeled as A, B, C, D, E, F, and G; but the black keys are denoted with sharps or flats. A sharp such as A # is one key number larger than A; a flat is one key lower, e.g., A [ 4 (A-flat) is key number 48. TREBLE F-SHARP EIGHTH NOTE 42 44 46 47 D 4 E 4 F# 4 G 4 A 4 = (A-440) 49 51 52 54 D 5 A B C 4 5 4 40 C 4 (middle-c) BASS HALF NOTE QUARTER NOTE 39 37 35 34 32 B 30 3 A3 28 G3 27 F# 3 E3 D 3 C3 B2 Figure 2: Musical notation is a time-frequency diagram where vertical position indicates which note is to be played. Notice that the shape of the note defines it as a half, quarter or eighth note, which in turn defines the duration of the sound. Another interesting relationship is the ratio of fifths and fourths as used in a chord. Strictly speaking the fifth note should be 1.5 times the frequency of the base note. For middle-c the fifth is G, but the frequency of G is 391.99 Hz which is not exactly 1.5 times 261.63. It is very close, but the slight detuning introduced by the ratio 2 1=12 gives a better sound to the piano overall. This innovation in tuning is called equallytempered or well-tempered and was introduced in Germany in the 1760 s and made famous by J. S. Bach in the Well Tempered Clavier. Thus, you can use the ratio 2 1=12 to calculate the frequency of notes anywhere on the piano keyboard. For example, the E-flat above middle-c (black key number 43) is 6 keys below A-440, so its frequency should be f 43 D 440 2 6=12 D 440= p 2 311 Hertz. 2 McClellan, Schafer and Yoder, Signal Processing First.

2.2 Gaussian Forms The Gaussian form is used in many different fields, but most often in probability where it is called the Gaussian distribution. 2 In this lab, we are going to use the Gaussian to control the amplitude weighting of sinusoids (called the envelope of the signal). The mathematical form of the Gaussian is g.v/ D e.v /2 =2 2 where v is the independent variable. Three parameters. ; ; / are needed to specify the Gaussian. The plot of a Gaussian is the well-known bell curve where determines the peak location and the width of the bell-shaped peak. The plots in Fig. 3 show the general shape for three values of. Notice that the width 1 0.8 0.6 σ=0.5 σ=1 σ=2 0.4 0.2 0 2 0 2 4 6 8 10 Figure 3: Plot of a Gaussian with parameters D 1, D 4, and D 1 2 ; 1; 2. When D 2 the 0.607 level extends from v D 2 to v D 6 giving a width of 4, i.e., the width is 2. of the bell when measured at the e 1=2 D 0:607 level is equal to 2, which confirms the role of as the width-control parameter. In our application the amplitude is scaled by soundsc when a sound is played, so we choose D 1. However, for a probability distribution would be chosen so that the total area under the Gaussian is equal to one, which leads to the value of being D 1=. p 2/. Write a few lines of MATLAB code to make a plot of 10e.v 1/2 =2.3/ 2 over the range 10 v 10. 2 Here are links for more info: https://en.wikipedia.org/wiki/normal_distribution and http://mathworld.wolfram.com/normaldistribution.html. 3 McClellan, Schafer and Yoder, Signal Processing First.

3 Warm-up In the warm-up you will generate a Gaussian and then use its values to weight the amplitude of sinusoids to play a musical note. 3.1 Gaussian Weighting When used with music synthesis, the Gaussian form must be a function of the log of frequency. Thus we need to define the following frequency-weighting function: W.f / D g.log 2.f // D e.log 2.f / log 2.f c// 2 =2 2 where f c is the center frequency of the Gaussian where the peak is located. The parameter, which is usually called the variance, determines the width (2) of the Gaussian along the log-frequency axis. (a) Write a short M-file that synthesizes a Gaussian given three inputs: center frequency, variance, and a vector of frequencies where the Gaussian is to be evaluated. (b) The MATLAB code ff=2.^(5:1/12:10) generates frequencies that are uniformly spaced on a logarithmic axis. (c) In order to demonstrate that your M-file works, make a plot of a Gaussian that is centered at 440 Hz and has a width equal to one octave. Make the plot over the following frequency range of six octaves: 55 f 1760 Hz. Use semilogx to make the horizontal axis logarithmic, i.e., log 2.f /. Note: Since the independent variable is log 2.f /, the variance controls width along the log 2.f / axis. Thus a variance of one corresponds to log 2.f =f c / D 1 which is a factor of two change in frequency. (d) Make two more plots of the Gaussian, but make these plots versus f. The first plot should use MAT- LAB s plot command. Explain why the Gaussian appears distorted. Then use MATLAB s semilogx function to make the same plot. Explain why the Gaussian once again has its expected bell shape. Instructor Verification (separate page) 3.2 Synthesize Octaves with Gaussian Weighting Create a sound that is the sum of five notes for keys spaced by octaves and amplitude weighted by the Gaussian in the previous part. In a previous lab you completed the key2note.m function which synthesizes the correct sinusoidal signal for a particular key number, so you can use that function to do this task. (a) Synthesize a signal that is 2 s long, sampled at f s D 8000 Hz. Create five sinusoids and add them together so that they are played simultaneously. The five notes should be middle-c (also called C 4 ), C 5, C 6, C 3 and C 2. The amplitudes of the five notes should be different; each note s amplitude should be obtained by sampling a Gaussian at the note s frequency. The Gaussian should be centered at f D 440 Hz, and have a width of one octave. (b) Show a spectrogram for your synthesized sound, and identify all five components. Use a long window length in the spectrogram to get good frequency resolution. Check that there are peaks at the correct frequencies, and also examine the spectrogram image to see that the peaks have different amplitudes. Instructor Verification (separate page) 4 McClellan, Schafer and Yoder, Signal Processing First.

4 Lab: A Musical Illusion The objective in this lab project is to reproduce a musical illusion called the Shepard Scale in which the tones played seem to be continually rising forever, yet seem to stay within one octave. If you are familiar with M. C. Escher s drawing of a perpetual staircase 3 called Ascending and Descending, then this audio illusion is analogous. The illusion is referred to as circularity in pitch judgement in an article on the web site of the Acoustical Society of America (http://asa.aip.org/demo27.html). You can also find a demonstration audio file at the same ASA web site. The basis of the Shepard scale is to create each note as the sum of many individual sinusoids, all separated by octaves. The use of several octaves allows the weighting to make the illusion. For example, the note A-440 might use sinusoids at the frequencies of 220 Hz, 880 Hz, 110 Hz, 1760 Hz, 55 Hz, 3520 Hz. By cleverly controlling the amplitudes of each sinusoid, the illusion is created by playing the amplitudeweighted notes in a scale (or within an octave) over and over. Specifically, the amplitude of the sinusoids would be largest at 440 Hz, a little smaller at 220 and 880 Hz, even smaller at 110 and 1760 Hz, and continually smaller for frequencies farther away from 440 Hz, i.e., the amplitudes are frequency dependent. If we followed the guide of the ASA web site, we would use a cosine amplitude weighting. However, we use a Gaussian instead, because we can get nearly the same amplitude dependence, and we can vary the parameter to control the width of the Gaussian. For the Shepard scale, the peak of the Gaussian should be centered somewhere between 260 and 500 Hz, and should be fixed to get a fixed Gaussian shape from which the amplitude weights for all notes are obtained. Since the notes on a piano are spaced on a log scale, the Gaussian used for amplitude weighting must also be a function of log 2.f /, instead of f. The following steps should help you produce a working illusion: (a) First of all, forget about the amplitude weighting. Synthesize a C-major scale, starting at middle-c, in which each note in the scale is accompanied by eight other notes separated by octaves, extending four octaves below and four octaves above. For example, to synthesize A-440, you would create the sum of nine sinusoids at the frequencies 27.5, 55, 110, 220, 440, 880, 1760, 3520 and 7040 Hz. Use a sampling frequency of 22050 Hz, so that you will have f s greater than twice the highest frequency. (b) Playing once through a scale requires that you play seven different notes, each note being the sum of nine octave-spaced keys. However, we need to play the scale over and over, so modify your code to play the C-Major scale five times (35 total notes). Adjust the length of the notes and introduce silence between the notes so that you can easily identify each one. (c) Now introduce amplitude weighting using a Gaussian form centered somewhere between 260 and 500 Hz. The trick here is that the weighting must be a function of log 2.f /, not f. Make a plot of the weighting function that you are going to use. Make the plot versus log 2.f / for the case when D 2. (d) You should now be able to produce the illusion by using the Gaussian weight function to generate the amplitudes of the nine octave-related sinusoids that are added together for each note. Experiment with the parameter to get a good sounding illusion. (e) Make a spectrogram of playing the scale three times and explain the illusion from the features that you can identify in the spectrogram. A spectrogram made by plotspec displays a linear amplitude scale, and that should make it easier to explain the illusion. (f) Variations: Play every note within the octave; all twelve of them and repeat. Does the illusion sound better in this case? (g) Listening: Prepare your MATLAB code so that it will be easy to demonstrate the illusion to your instructor at the beginning of the next lab. 3 The idea of the perpetual staircase is attributed to Roger Penrose and his father Lionel (1958). 5 McClellan, Schafer and Yoder, Signal Processing First.

Lab: Shepard Scale Instructor Verification Sheet For each verification, be prepared to explain your answer and respond to other related questions that your lab instructor might ask. Turn this page in at the end of your lab period. Name: Date of Lab: Part 3.1 Complete and demonstrate the function that synthesizes a Gaussian form versus log 2.f /. Verified: Date/Time: Part 3.2 Complete and demonstrate the synthesize of five Gaussian weighted sinusoids. Show a spectrogram and identify the frequencies and amplitudes of the five spectral components. Verified: Date/Time: Sound Evaluation Criteria Does the file play the correct notes? All Notes Most Missing octaves Wrong Amplitude Weighting Overall Impression: Good: Correct illusion; proper use of Gaussian envelope; all notes synthesized and in sync. OK: Basic sinusoidal synthesis, but the illusion is not obvious Poor: Synthesis does not work.; incorrect illusion. 6 McClellan, Schafer and Yoder, Signal Processing First.