GithubHelp home page GithubHelp logo

toronz / audio_distortion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hamsternz/audio_distortion

0.0 1.0 0.0 92 KB

Measure the THD+Noise for your default audio device.

License: MIT License

Makefile 0.49% C 99.51%

audio_distortion's Introduction

audio_distortion

A basic utility to measure the THD+Noise for your default audio device with a 1kHz tone. By default it generates and cptures 12000 samples @ 48kS/s (0.25s)

Creates a PPM image of the captured spectrum.

Example

NOTE - only meausures the LEFT channel of the DEFAULT ALSA audio device.

WARNING: IF YOU SEND THE OUTPUT OF THIS PROGRAM TO YOUR SPEAKERS OR HEADPHONES YOU MIGHT DAMGAGE EITHER YOUR SPEAKERS OUR YOUR EARS

Prerequeists

You will need to have the ALSA dev libraries installed.

Using this program

  1. Build with "make".

  2. Attach a cable between line out to line in. Use a stereo cable.

  3. Run ../audio_distortion <master volume %> <capture volume %>

  4. On my system I get the best numbers from "./audio_destortion 90 9".

NOTE: Something is up with the capture volume - the driver reports different max an d min values than it seems to use. This may also be a bug.

  1. Numbers will be displayed, and "graph.ppm" will be written.

Look in main() to change the test frequency

Optimizing the result for best numbers

If you have very high THD numbers (> 1%) you are either overdriving the output or input. Try reducing the capture volume, and if that doesn't help, also try reducing the master volume. A reasonable sound card should easily get well below 0.1%

Example output:

$ /audio_distortion 95 9
Audio playback device opened successfully.
Audio device parameters have been set successfully.
Init: Buffer size = 16384 frames.
Init: Significant bits for linear samples = 16
Audio device has been prepared for use.
Audio playback device opened successfully.
Audio capture device parameters have been set successfully.
Init: Buffer size = 16384 frames.
Init: Significant bits for linear samples = 16
Audio capture device has been prepared for use.
Setting playback volume to 62259 in range 65536 0
Setting capture level to 5898 in range 65536 0
Audio devices has been uninitialized.

Analysing captured data...

signal =   23365.16
dc     =      -0.05
thd+n  =       1.15  (  0.005%)
s:n    =      86.13 dB

audio_distortion's People

Contributors

hamsternz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.