# Music Analyser

• View
25

0

Tags:

• #### wave file analyser2

Embed Size (px)

DESCRIPTION

Music Analyser. MSc in Information Engineering. Jean-Marie Froux MSc Information Engineering 2003. Abstract. Transcription of music : from the sound to the paper through computer. The technologies used to develop : C#, C++, DirectX. Contents. Introduction 1: Theory - PowerPoint PPT Presentation

### Text of Music Analyser

• Music AnalyserMSc in Information Engineering

Jean-Marie Froux MSc Information Engineering 2003

Music Analyser - JM Froux City University - 2003

• Abstract

Transcription of music : from the sound to the paper through computer.

The technologies used to develop : C#, C++, DirectX

Music Analyser - JM Froux City University - 2003

• Contents Introduction1: Theory2: Wave file analyser (in C#)3: Music analyser (in C++)ConclusionQuestions

Music Analyser - JM Froux City University - 2003

• IntroductionWhat is music transcription?Music and computers Why is it interesting ?The programs developed

Music Analyser - JM Froux City University - 2003

• 1/ Musical Theory1.1 The physic of sound

1.2 The Fourier Analysis

Music Analyser - JM Froux City University - 2003

• 1.1 The physic of soundThere are 4 parameters to describe a sound: Duration, (s).Intensity, (dB).Height, (Hz).

Music Analyser - JM Froux City University - 2003

• Frequency and notes (1)Ear sensibility : 20 Hz to 20 kHzrepresents 10 octavesA flute can play between 130.81 Hz and 1046.5 HzChange octave by doubling frequency1.1 The physic of sound

Music Analyser - JM Froux City University - 2003

• Frequency and notes (2)12 intervals in an octave Tone is an interval of T = 62 Semitone is an interval of T = 122 (=1.0594)

We obtain thus the scale for Major C:

1.1 The physic of sound

Music Analyser - JM Froux City University - 2003

• Frequency and notes (3)All change possible with sharps and flats.

The basic (reference) note is A3 440Hz.Other are deduced by multiplication with T= 122 1.1 The physic of sound

Music Analyser - JM Froux City University - 2003

• The physic of sound There are 4 parameters to describe a sound: Duration, (s).Intensity, (dB).Height, (Hz).Tone

Music Analyser - JM Froux City University - 2003

• The tone (1)A sound is made of many frequencies :

The fundamental

Harmonics (multiples of the fundamental)1.1 The physic of sound

Music Analyser - JM Froux City University - 2003

• The tone (2)Each instrument produces a specific spectrum :A sound played by a clarinet The same sound played by a oboe 1.1 The physic of sound

Music Analyser - JM Froux City University - 2003

• 1.2 Fourier transformAny pseudoperiodic signal can be broken up into an infinite sum of sinusoidal signals of frequency multiple of a basic frequency.

Music Analyser - JM Froux City University - 2003

• InterestThe FFT allows us to see the frequencies and magnitudes of sinusoidal signals.

1.2 Fourier transformfrequencyMagnitudetimeFrequency

Music Analyser - JM Froux City University - 2003

• 2/ Wave file Analyser2.1 Design

2.2 Implementation

2.3 Testing

Music Analyser - JM Froux City University - 2003

• 2.1 DesignRecord data2.1 Wave Analyser DesignAnalyse dataWrite score

Music Analyser - JM Froux City University - 2003

• Record dataSelect capture device2.1 Wave Analyser DesignCreate capture bufferWave format tag (compression)Average bytes per secondSamples per secondBits per sampleBlock AlignChannel(s)Start

Music Analyser - JM Froux City University - 2003

• AnalysisOpen the file2.1 Wave Analyser DesignGet the file sizeCreate an array of the same sizeCopy the data in the arrayDecode the header chunkAnalyse the data chunk

Music Analyser - JM Froux City University - 2003

• Analysis (2)The program the should analyse the sample with an FFT and find the notes.

We will see the algorithm with the second program.

Once the notes found, they are stored in a file.2.1 Wave Analyser Design

Music Analyser - JM Froux City University - 2003

• Write notesOpen file2.1 Wave Analyser DesignRead filetitlesignaturenotesDraw the score

Music Analyser - JM Froux City University - 2003

• The .notes fileRules :First line: Title: TitleSecond line : Signature1: IntThird line : Signature: IntThen the notes described by letters A to G.3 octaves lower (add: l), medium (m=default), and higher (h)Sharp (s) and flat (f)Timing: 16th (add x), 8th (add e), quarter is default, half (a), three-quarter (t), whole (w). 2.1 Wave Analyser Design

Music Analyser - JM Froux City University - 2003

• Testing The software:

2.2 Wave Analyser Testing

Music Analyser - JM Froux City University - 2003

• Testing Capture devices and record:

2.2 Wave Analyser Testing

Music Analyser - JM Froux City University - 2003

• Testing Analysis

2.2 Wave Analyser Testing

Music Analyser - JM Froux City University - 2003

• Testing The score:

2.2 Wave Analyser Testing

Music Analyser - JM Froux City University - 2003

• ConclusionC# is a very good programming language, but it needs the latest version of DirectX9. As it is very new, the help is poor.

Thats why I have decided to change my way, and I passed to C++. 2.Wave Analyser

Music Analyser - JM Froux City University - 2003

• 3/ The sound analyser in real time 3.1 Sampling. 3.2 FFT.3.3 Search for the note. 3.4 Display. 3.5 Save. 3.6 The recognition of rhythm.

Music Analyser - JM Froux City University - 2003

• 3.1 Samplingtell the soundcard to start sampling the input from the microphone store the samples in a client buffer The client creates a separate thread which is suspended waiting on an eventOnce the buffer is full, notifies the client The client thread does the necessary work and waits for the next event.

3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.2 FFTThe FFT buffer is filled with samples in bit-reversed order The bit reversal is done, converts real samples into complex numbers (with the imaginary part set to zero) Then the FFT calculation is organized into bunches. 3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.3 Find the noteFor each FFT Recover the frequency and magnitude of the highest peakif magnitude is above the noise, seek if there is a peak at frequency divided by 2.

3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.3 Find the note (2)If yes:The peak of higher magnitude isnt the fundamental (but the first harmonic)3/ The sound analyser in real time Example with a guitar: spectrum of an A2:In this case, the highest peak is the first harmonic, we obtain the fundamental by dividing by 2 this frequency

Music Analyser - JM Froux City University - 2003

• 3.3 Find the note (3)If not: seek a peak at frequency multiplied by 2 (the first harmonic). If there is one, the fundamental is the peak of higher magnitude.

Then find the note with the table of frequencies

3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.3 Display the note (1)Problem: not display several times the same note played once.If for 2 consecutive FFTThe note found is the sameThe magnitude of the second is not higherIt is the same note.If the magnitude changes, it means that the note is played again.3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.3 Display the note (2)The notes are represented by an o and a # if needed. To help the position of the note, I have adapted it to the octave:

3/ The sound analyser in real time The notes go from the "G" of octave 1 until "A" of octave 3 For the too high or too low notes the octave is modified in order to display the note on the scale.

Music Analyser - JM Froux City University - 2003

• 3.3 Save the notes (1)Important to allow musician to recover their work in another software.

First step to MIDI file, write the data in a .txt file

3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.3 Save the notes (2)Example:

MThd | Format=0 | # of Tracks=1 | Division=96Track #0 **************************************** Time Event1: 1: 0 |On Note | chan= 1 | pitch=D 1 | vol=127 2: 0 |Off Note | chan= 1 | pitch=d 1 | vol=100 | On Note | chan= 1 | pitch=A 2 | vol=127 3: 0 |Off Note | chan= 1 | pitch=a 2 | vol=100 |End of track|3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• 3.4 Rhythm recognitionMetronomeHelp the musician when recordingCan give the tempo of the piece Trace.txt: Save the tempo, the note, the value of the timer and the amplitude.E.g.:3/ The sound analyser in real time 60.C. 0. 608.C#. 47. 1407.D. 94. 1212.D. 141. 1675.D. 188. 1880.

Next step is the analysis of this file.

Music Analyser - JM Froux City University - 2003

• TestingThe software:3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• TestingThe software:3/ The sound analyser in real time

Music Analyser - JM Froux City University - 2003

• ConclusionWith C++ I found complete help on the InternetIt gives a program which works well.Some improvements can be done to continue this work.

3/ The sound analyser in real time

Music Analyser -

Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
##### LOGIC ANALYSER, ARBITARY WAVE GENERATOR AND WAVE ANALYSER
Devices & Hardware
Documents
Documents
Education
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Healthcare
Documents
Documents
Documents
Documents
Documents
Documents