Key Detection In Musical Signals - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Key Detection In Musical Signals

Description:

Keys are groups of musical notes that comprise most of the notes in a piece of music ... FFT: Spectral Data with uniform Frequency Resolution ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 26
Provided by: bro81
Category:

less

Transcript and Presenter's Notes

Title: Key Detection In Musical Signals


1
Key Detection In Musical Signals
  • Philip Brown, 07
  • Advisor Dr. Shane Cotter

2
Goals
  • Develop a Key Detection Algorithm
  • Implement Algorithm in Real Time
  • Create Stand-Alone Device to Perform Desired
    Calculations

3
Background
  • There are twelve musical notes
  • Each note is a frequency f and all other
    frequencies of 2f, 4f, 8f 2xf
  • Keys are groups of musical notes that comprise
    most of the notes in a piece of music

4
Key Detection
Spectrum Analysis Function
Peak Finding
Signal
Window
Data Storage
Data Summation
Note Identification
Data Manipulation
Logic Statements
Key Identification
5
Spectral Analysis
  • FFT vs. Constant Q
  • FFT Spectral Data with uniform Frequency
    Resolution
  • Constant Q Spectral Data with Exponential
    Frequency Resolution, Frequencies fall on Musical
    Notes

6
Problems With FFT
FFT 0.2s Window 44100 Samples/second
60 Hz
90-94.5 Hz
150Hz
Intended Frequencies 61.74 Hz, 92.5 Hz, 146.83Hz
7
Constant Q
Constant Q b 24 fo 27.5 fmax 3520 44100
Samples/second
62.5Hz
92.5Hz
146.83Hz
Intended Frequencies 61.74 Hz, 92.5 Hz, 146.83Hz
8
Problem!
  • Lower frequencies take longer amounts of time to
    calculate
  • In order to use Constant Q, these frequencies
    must be cut out
  • Key Detection Still possible in most cases

9
Key Detection
Spectrum Analysis Function
Peak Finding
Signal
Window
Data Storage
Data Summation
Note Identification
Data Manipulation
Logic Statements
Key Identification
10
Peak Finding
  • Use for loops to find relative maxima of spectral
    content

11
Peak Find
frequency, amplitude Peakfind(signal,b,fk,mina
mp) Will find all peaks above minimum
amplitude. For signal constant q of 308.7,
617.4, and 1648.1Hz sine waves. frequency,amplitu
de Peakfind(signal,24,fk,minamp)
outputs frequency 311.8 623.6
1664.9 amplitude 0.1229 0.1225
0.0742 Which corresponds to the peak on the
constant q plot.
12
Key Detection
Spectrum Analysis Function
Peak Finding
Signal
Window
Data Storage
Data Summation
Note Identification
Data Manipulation
Logic Statements
Key Identification
13
Note Identification
  • Peak Finder outputs array of frequencies
  • Sorts through array of musical frequencies and
    find closest one
  • Takes amplitude of that note and add it to
    corresponding note in note matrix
  • A Bb B C C D Eb E F F G G

14
Note Identification
notestrengths noteid(frequency,amplitude) Take
previous example Will output notestrengths
0 0 0 0 0 0 0.2455 0 0 0 0 0.0742
15
Key Detection
Spectrum Analysis Function
Music Signal
Peak Finding
Window
Data Storage
Data Summation
Note Identification
Data Manipulation
Logic Statements
Key Identification
16
Data
  • Each Note Matrix stored Separately
  • Every time new matrix is added to data, oldest
    matrix is deleted
  • To calculate key, all Note Matrices in data are
    added
  • Logic Statements determine key by looking at
    notes with greatest amplitude

17
Key Detection
Start with output of summation of note
strengths 12 1 6 2 10 9 3 11 4 7 5
8 Set the 5 lowest to 0 12 0 6 0 10 9 0
11 0 7 0 8 Set the rest to 1 1 0 1 0
1 1 0 1 0 1 0 1 See if this matches
any stored keys YES! Key is A.
18
Putting It All Together
  • MATLAB Program Implements All of these processes
    together to output Key vs. Time

19
Sample Data
Key vs. Time Numbers Correspond to Different
Keys Expected Keys A, Key Change to Dm Keys
Approximated A,D,Dm
20
Problems
  • Key isnt always correct
  • In some pop pieces, key is arguable
  • However, incorrect keys are generally 5ths of the
    expected key (as close as possible)
  • Some pieces have too many accidentals (notes
    outside of key)

21
Successes
  • Key changes are noticeable
  • Generally, one can determine the key from the
    output graph
  • In most cases, if the entire piece is examined,
    the findkey will output the correct overall key

22
Real Time
  • A 3 minute song takes 10 minutes to output key
    vs. time
  • Constant Q is very much like DFT
  • In order to process Constant Q in real time, need
    to relate it to FFT (possible future project)

23
More Accurate Key Approximation
  • Right now, key approximation takes into account 7
    strongest notes, regardless of order
  • Attempts to account for fewer notes unsuccessful
  • More complicated logic statements could more
    accurately calculate key (possible future project)

24
Whats Next
  • Transfer code to C
  • Implement code on TI TMS320C6713 DSP Chipset
  • Tempo?

25
Acknowledgements and Questions
  • Thanks to Prof. Catravas for help on music theory
  • Any Questions?
Write a Comment
User Comments (0)
About PowerShow.com