22
JAAA Audio Measurements using JAAA Fons Adriaensen 2nd Linux Audio Developers Conference ZKM Karlsruhe 28 April - 2 May 2004 JAAA – 1 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved – c 2004 F.Adriaensen

Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

JAAA

Audio Measurements using JAAA

Fons Adriaensen

2nd Linux Audio Developers ConferenceZKM Karlsruhe 28 April - 2 May 2004

JAAA – 1 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 2: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

JAAA - Overview

What is it ?

FFT based spectrum analysis

Measuring noise

Internals

Demo

Things to do

Questions ?

JAAA – 2 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 3: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

What is it ?

• A signal generator and spectrum analyser.

• Checking performance of audio HW en SW.

• JAAA is a technical, not a musical tool.

– Linear frequency scales

– Designed for accurate measurements

– Requires some technical knowledge

JAAA – 3 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 4: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

• FT : Fourier Transform. Transforms function of time f (t) (a signal) into a function offrequency F(ω) (a spectrum).

– Operates on continuous (not sampled) functions.

– Can be reversed : no information is lost in the transform.

• DFT : Discrete Fourier Transform. Same as FT, but operating on discrete (sampled)signals,and producing a discrete (sampled) spectrum.

• FFT : Fast Fourier Transform. Optimized version of the DFT.

• FFTW3 : A very nice open source FFT library, used in many Linux applications.

JAAA – 4 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 5: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

• An N-point FFT replaces N/2 bandpass filters.

• Frequency step ∆F = Fsamp/N.

• Fsamp= 44.1 kHz, 1024 point FFT→ filters at 0, 43, 86, 129 . . . 22007 Hz.

Could it be so simple ? . . .

JAAA – 5 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 6: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

FFT Powercalc

N samples

Audio

N / 2 complex outputs N / 2 specturm points

A simple analyser

JAAA – 6 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 7: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

What’s going wrong ?

Filter shape is the FT of the input window.

JAAA – 7 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 8: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

Rectangular window

JAAA – 8 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 9: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

Raised cosine window

JAAA – 9 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 10: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

Raised cosine JAAA window

JAAA – 10 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 11: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

N samples

FFT Powercalc

AudioWindow

N samples

Display

N / 2 complex outputs N / 2 spectrum points

Analyser with windowing

Multiplication before FFT is equivalent to convolution after FFT.A short convolution can be done by an FIR fiter, so. . .

JAAA – 11 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 12: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

N samples

FFTAudio

DisplayPowercalc

Polyphase FIR

N spectrum pointsN complex outputs

N / 2 complex outputs

JAAA analyser

Polyphase FIR replaces windowing, and interpolates the spectrum.Feedback path added for averaging power over time.

JAAA – 12 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 13: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

FFT based spectrum analysis

Filter responses spaced ∆/2→ maximum error = 0.25 dB.More accurate measurements are possible by interpolation.

JAAA – 13 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 14: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Measuring noise

How can we measure noise ? Let’s try. . .

JAAA – 14 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 15: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Measuring noise

How can we measure noise ? Let’s try. . .

Apparent noise level depends on FFT length, or bandwidth.

JAAA – 15 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 16: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Measuring noise

How can we measure noise ? Let’s try. . .

Apparent noise level depends on FFT length, or bandwidth.

A spectrum analyser can be used to measure noise density, N0.

N0 is noise power per 1 Hz of bandwidth.

Total noise power = N0×B.

The unit of N0 is 1 / Hz, or dB / Hz.

Noise level = -10 dB, Fsample= 44.1 kHz→ B = 22.05 kHz = 43.43 dBHz→ N0 = -53.43 dB/Hz

Noise level = -10 dB, Fsample= 48.0 kHz→ B = 24.00 kHz = 43.80 dBHz→ N0 = -53.80 dB/Hz

JAAA – 16 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 17: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Internals

ALSAJACK

Analyser Displaymapper

GUI

Generator

Events and commands

X eventsAudio thread Main thread

Circularbuffer

Markers

JAAA program architecture

JAAA – 17 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 18: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Internals

Spectrum points

Pixels

More pixels than spectrum points, the easy case.

Spectrum points

Pixels

More spectrum points than pixels.

Correct signal level display requires peak valueCorrect noise level display requires average value

JAAA displays two traces in this case.

JAAA – 18 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 19: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Internals

P

F

Peak markers are calculated using 2nd order interpolation.

JAAA – 19 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 20: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Demo

AMS

JAAAPCM in PCM out

JACK

Demo signal routing.

JAAA – 20 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 21: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

Things to do

• Clean up the code

• Documentation

• More signal generators

• Integrated noise calculation

• Trace memories

• JACK transport

JAAA – 21 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen

Page 22: Audio Measurements using JAAA - Linuxaudio.org · What is it ? • A signal generator and spectrum analyser. • Checking performance of audio HW en SW. • JAAA is a technical, not

JAAA

Audio Measurements using JAAA

Question time !

JAAA – 22 2nd LAD Conference, Karlsruhe, 28 April — 2 May 2004 All rights reserved –c© 2004 F.Adriaensen