FOURIER TRANSFORM BASED SIMPLE CHORD ANALYSIS. UIUC Physics 193 POM



Similar documents
Auto-Tuning Using Fourier Coefficients

Mathematical Harmonies Mark Petersen

Trigonometric functions and sound

Tonal Analysis of Different Materials for Trumpet Mouthpieces

The Tuning CD Using Drones to Improve Intonation By Tom Ball

The Sonometer The Resonant String and Timbre Change after plucking

B3. Short Time Fourier Transform (STFT)

The Fourier Analysis Tool in Microsoft Excel

For full instructions on how to install Simsound please see the Technical Guide at the end of this document.

Copyright 2008 Pearson Education, Inc., publishing as Pearson Addison-Wesley.

Musical Analysis and Synthesis in Matlab

How To Improvise a Solo A Workshop for Beginners

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Basics of Digital Recording

This document is downloaded from DR-NTU, Nanyang Technological University Library, Singapore.

Music Theory: Explanation and Basic Principles

Lecture 1-6: Noise and Filters

Bass Guitar Investigation. Physics 498, Physics of Music Sean G. Ely Randall Fassbinder

DIGITAL MUSIC DAY 1 WHAT IS SOUND? ANALOG AND DIGITAL EARLY RECORDING WAX FOR YOUR EARS ROUND BUT FLAT WIRE AND TAPE PURE SOUND

The Physics of Music: Brass Instruments. James Bernhard

A Sound Analysis and Synthesis System for Generating an Instrumental Piri Song

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

Analysis of an Acoustic Guitar

Doppler Effect Plug-in in Music Production and Engineering

Renaissance Bass. software audio processor. User s Guide

Modulation to Any Key

Introduction to Digital Audio

Speech Signal Processing: An Overview

Aircraft cabin noise synthesis for noise subjective analysis

7. Beats. sin( + λ) + sin( λ) = 2 cos(λ) sin( )

Drum-Set Tuning Guide

Lab 1. The Fourier Transform

Analysis/resynthesis with the short time Fourier transform

MUSIC OFFICE - SONGWRITING SESSIONS SESSION 1 HARMONY

Guitar Rubric. Technical Exercises Guitar. Debut. Group A: Scales. Group B: Chords. Group C: Riff

Monophonic Music Recognition

Curriculum Mapping Electronic Music (L) Semester class (18 weeks)

Matlab GUI for WFB spectral analysis

Music Theory Unplugged By Dr. David Salisbury Functional Harmony Introduction

Performing the Fast Fourier Transform with Microchip s dspic30f Series Digital Signal Controllers

The continuous and discrete Fourier transforms

Mathematics of Music

How to compute Random acceleration, velocity, and displacement values from a breakpoint table.

AP1 Waves. (A) frequency (B) wavelength (C) speed (D) intensity. Answer: (A) and (D) frequency and intensity.

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

RMS Power. The Meaning of Average

Final Project: Enhanced Music Synthesizer and Display Introduction

Modelling musical chords using sine waves

Lecture 4: Jan 12, 2005

Analog and Digital Signals, Time and Frequency Representation of Signals

Waveforms and the Speed of Sound

Acoustics for Musicians

Doppler. Doppler. Doppler shift. Doppler Frequency. Doppler shift. Doppler shift. Chapter 19

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

f x a 0 n 1 a 0 a 1 cos x a 2 cos 2x a 3 cos 3x b 1 sin x b 2 sin 2x b 3 sin 3x a n cos nx b n sin nx n 1 f x dx y

Bi- Tonal Quartal Harmony in Theory and Practice 1 Bruce P. Mahin, Professor of Music Radford University

physics 1/12/2016 Chapter 20 Lecture Chapter 20 Traveling Waves

The Fundamentals of Signal Analysis. Application Note 243

Grade Level Year Total Points Core Points % At Standard %

AN-007 APPLICATION NOTE MEASURING MAXIMUM SUBWOOFER OUTPUT ACCORDING ANSI/CEA-2010 STANDARD INTRODUCTION CEA-2010 (ANSI) TEST PROCEDURE

Dirac Live & the RS20i

RightMark Audio Analyzer 6.0. User s Guide

Introduction to Chords For Jazz Band

PeakVue Analysis for Antifriction Bearing Fault Detection

Timing Errors and Jitter

The abstract, universal, or essential class of a pitch. The thing about that pitch that different particular instances of it share in common.

Problem of the Month: Fair Games

FAST Fourier Transform (FFT) and Digital Filtering Using LabVIEW

Teaching Fourier Analysis and Wave Physics with the Bass Guitar

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

As Example 2 demonstrates, minor keys have their own pattern of major, minor, and diminished triads:

Study Kit No 9. Aura Lee (Love Me Tender)

Filter Comparison. Match #1: Analog vs. Digital Filters

The Phase Modulator In NBFM Voice Communication Systems

The Chord Book - for 3 string guitar

Lecture 2, Human cognition

The Calculation of G rms

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

ARTICLE. Sound in surveillance Adding audio to your IP video solution

Sound and stringed instruments

San José State University Department of Electrical Engineering EE 112, Linear Systems, Spring 2010

COMS 4115 Programming Languages and Translators Fall 2013 Professor Edwards. Lullabyte

Little LFO. Little LFO. User Manual. by Little IO Co.

A: zero everywhere. B: positive everywhere. C: negative everywhere. D: depends on position.

Chords and More Chords for DGdg Tenor Banjo By Mirek Patek

An Introduction to Chords

Magnetic Field Modeling of Halbach Permanent Magnet Array

SR2000 FREQUENCY MONITOR

Sound and Music. Drum. Drum. Guitar. Flute. Guitar. Trumpet. Flute. Trumpet

Lesson DDD: Figured Bass. Introduction:

FTIR Instrumentation

Computing Fourier Series and Power Spectrum with MATLAB

Quarterly Progress and Status Report. Measuring inharmonicity through pitch extraction

GOSPELKEYS TM 202 MASTERING WORSHIP CHORDS TRANSCRIPTS SIDENOTES. Minister Jermaine A.

GSnap Manual. Welcome to GSnap. Installation. Hints

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

employed to ensure the continuing reliability of critical systems.

10EaZy SW White Paper Choosing the right hardware

Transcription:

FOURIER TRANSFORM BASED SIMPLE CHORD ANALYSIS Fanbo Xiang UIUC Physics 193 POM Professor Steven M. Errede Fall 2014 1

Introduction Chords, an essential part of music, have long been analyzed. Different chords and different combinations of chords arouse different emotions. The analysis of chords is a topic which has been researching for hundreds of years. Many people are trained to recognize different chords. However, they have to devote much time before they are skillful enough to actually recognize chords with high precision. And each person can only analyze chords in a music piece with a relatively slow speed. So the idea to analyze chord by computer algorithm came up. My project mostly focuses on the analysis of musical chords within short pieces of music in digital forms with Matlab. In real world, music or sound is a kind of wave produced by vibration. The musical quality comes from the proper combination of different frequencies of sound. Wave in nature is continuous, but data stored has to be discrete. So in digital format, music is stored as discrete points, each corresponding to a state in the natural vibration (as shown below). More points sampled means closer data compared to the original vibration. With a great number of points, music can be reproduced with minor flaws undetectable by human ears. The most basic component of music is notes. Each note has a unique frequency. 2

Normally, people use 440Hz as the standard note A, although it really doesn t matter which note is chosen as A. In this project, to make analysis simpler, I assume all music I analyzed is based on the standard frequency (440Hz as A ). Combinations of different tones are chords, the most important part of this project. Chords are important because they are the essential part of the emotion of music. Almost everyone can feel the bright major chords and dim minor chords. I will give further explanation of chord analysis. The crucial point here is that all frequencies are mixed together in a wave form. We have to convert them from the wave form, which is called time domain, to frequency domain to do further analysis. This I apply the well-known math method Fourier Transform. Matlab provided a Fourier Transform toolbox, so I can obtain the results of this computation without writing the programming code for it. After obtaining the frequencies, I analyze the possible chord by chord models I established mostly based on empirical formula. Definition of Chords A chord is a harmonic unit with at least three different tones sounding simultaneously. [1] It is a definition of chord accepted by most people. Here tone simply means notes with a unique name (e.g. C). Major Chord A typical major chord is composed of a root tone with another tone 4 semitones above the root and a third one 7 semitones above the root. The root tone is the most important of a chord. A major chord with root C is called C major. Sometimes the 3

other two tones can be omitted but the root cannot, otherwise the chord changes its name. Minor Chord A minor chord is similar to a major chord, but the note 4 semitones higher is altered to 3 semitones higher. Seventh Chord A seventh chord is a more complex chord, with 4 notes sounded together. Frequency Domain and Time Domain Frequency Domain means what frequencies are contained in a sound piece. The picture is an example of frequency domain. There are 3 frequencies: note C, note E, note G. Time Domain of these notes is shown in the picture on the left. It shows us the vibration amplitude versus time. We can see clearly from the frequency domain that it is a C major chord. In contrast, it is hard to seee this chord from the messy wave form of time domain. Unfortunately, music is sampled in the latter way, so it has to be converted into frequency domain before analyzed. The method for it is known as Fourier Transform. 4

Fourier Transform The harmonic content of a periodic waveform - one which repeats itself in time or in space, can be obtained using the mathematical formalism known as Fourier analysis (also known as harmonic analysis), named after the French mathematician, Joseph Fourier (1768-1830) [2] In short, this method is used to convert signal between time domain and frequency domain. However, this method can only be applied to periodical signals. DFT, FFT and STFT DFT, or Discrete Fourier Transform, is the discrete version of Fourier Transform. This method can transform signals composed of discrete points from time domain to frequency domain. So by DFT, we can convert a piece of sound, which is sampled by discrete points, to frequency domain. FFT, or Fast Fourier Transform, is merely an improved version of DFT. Since Matlab has FFT toolbox, I don t study further into this algorithm. The short-time Fourier transform (STFT), or alternatively short-term Fourier transform, is a Fourier-related transform used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. [3] Here I repeatedly intercept short times of signals and perform FFT with each of them. However, the time, or signal length, cannot be too long or too short: Long signals make the time positions of notes imprecise while short ones make the frequencies imprecise. STFT is what I use to analyze the harmonic content of music pieces. 5

Matlab Code Implementation: The FFT and STFT part is shown as follows. FFT function [freq,amp]=timetofreq(data,fs,maxfreq) N=length(data);%the length of the data n=0:n-1;%create an array 0, 1, 2, 3... length-1 y=data;%the data points Y=(fft(y,N))';%the built in method to perform FFT, return complex numbers including information of the phase value=abs(y)*2/n;%get the absolute value(amplitude) of each frequency f=n*fs/n;%get the frequencies i=1; if (f(ceil(n/2))>maxfreq) while f(i)<maxfreq i=i+1; else i=ceil(n/2); %only left half of the data can be used freq=f(1:i); amp=value(1:i); %return freq and amp STFT function [t,f,a]=stft(size,data,fs,maxfreq) p=0; l=length(data); t=[]; f=[]; a=[]; while (p+size<=l) [freq,amp]=fft(data(p+1:p+size),fs,maxfreq); times=zeros(1,length(freq)); times(:)=((p+(size+1)/2)/fs); t=[t;times]; f=[f;freq]; a=[a;amp]; p=p+size; %divide data %do FFT on every small piece of data 6

These 2 blocks of code returns the harmonic content of every small time piece. I then intercept the frequencies of specific notes according to the standard note frequencies. This step gives me the amplitude of every single note. Estimation of chords I applied experience method to determine chords. (This method can be improved further by other statistical model of chords.) Assuming lower frequencies contribute more to the properties of a chord. I take the weighed average of the note energy in the same tone to represent the tone energy, and sum up the tones of every single triad to obtain the energy of every single triad ( chord energy ). I take the triad with the largest energy as the most probable triad. I then search all 7 th chords to see if any of them contain this triad and compare the energy of the other tone with the energy of the triad to see if the extra tone is loud enough to be heard. If it is, the chord is displayed as a 7 th chord instead of a triad. Outcomes I make a graphical interface for chord analysis (shown below). Open button opens an audio clip and read the wave form into a graph. Track Tones button enables the real time track of all tones. I provide 2 modes for Track Tones : one is to treat every note equally; the other is to weigh bass notes more. After start and points are designated, Cut and Chord Estimate are enabled. Cut simply take out the designated piece to show it at higher precision. Chord Estimate will show the tone energy of the whole time interval and estimate the chord. 7

Analysis There are several problems with this program. 1) The real time track of tones requires a significant computational power. When the audio clip gets too long, the real time track may become too slow. 2) The chord estimation is not accurate. Several short notes which don t belong to the chord can interfere with the chord estimation easily. Even some overtones can cause this error. For example, an F major chord with a loud C note may be estimated as FM7 since the E note, which is a overtone of C, is treated as part of the chord. Also the perception of sound by humans is very complicated, so a lot other situations cannot be handled by this algorithm. 3) The real time tone display runs slow when the music file gets large. This problem may get less obvious when better computers are used and may be fixed by using dynamic computational algorithms. 8

Summary In this project, I use Fourier Transform to analyze harmonic content in real time and estimate chords given a time period by Matlab programming. The obtainment of frequencies from a wave form is successful. The harmonic content in real time is quite accurate. Users of this program can clear see which tone is being played. However, the estimate of chords is not precise because of the versatility of music structures, complexity of human hearing and oversimplification of chord models. These may be improved by applying better models or using more advanced algorithms. In sum, this program is capable of revealing some part of the harmonic content and providing a estimation of the notes, tones and chords played. References [1] Benward & Saker (2003). Music: In Theory and Practice, Vol. I, p. 67&359. Seventh Edition. ISBN 978-0-07-294262-0."A chord is a harmonic unit with at least three different tones sounding simultaneously." "A combination of three or more pitches sounding at the same time." http://en.wikipedia.org/wiki/chord_(music) [2] Errede P406 POM Lecture Notes: Fourier Analysis I https://courses.physics.illinois.edu/phys406/lecture_notes/fourier_analysis/pdf _FIles/Fourier_Analysis1.pdf [3] Unknown author http://en.wikipedia.org/wiki/short-time_fourier_transform 9