Another Harmonic Distortion measurement/drawing tool.. for Linux & written in Perl - diyAudio
Go Back   Home > Forums > Design & Build > Software Tools
Home Forums Rules Articles diyAudio Store Gallery Wiki Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 21st November 2015, 12:15 AM   #1
diyAudio Member
 
Join Date: Jan 2015
Default Another Harmonic Distortion measurement/drawing tool.. for Linux & written in Perl

Subj. I made this script to easily perform measurements while sound interface card attached to Linux headless ARM board. It works from console, access card via alsa, requires alsa-utils, sox and gnuplot (to draw spectrums into gif files). Also it requires several additional modules to be installed into Perl with cpan: Audio::Wav, Math::FFT, Math::Trig, Math::Round.

Also it has feature - unlike most other similar software it outputs not only levels but also phases of first 3 harmonics, making possible to see different distortions kinds that are impossible to distinguish using power spectrum representation only. And difference between them really hearable - mostly due to coupling with non-linearity of acoustics. For example in attachements there're pics taken on test of emitter follower built using PNP (BD140) and NPN (BD139) transistors (other elements are same) - and clearly visible that even harmonics have opposite phasing, while almost same level.
Attached Images
File Type: gif distortions_1000_npn.gif (40.4 KB, 200 views)
File Type: gif distortions_2000_npn.gif (46.7 KB, 197 views)
File Type: gif distortions_1000_pnp.gif (46.0 KB, 196 views)
File Type: gif distortions_2000_pnp.gif (40.4 KB, 196 views)
Attached Files
File Type: zip DistortionsAnalyzer.zip (5.3 KB, 17 views)
  Reply With Quote
Old 26th November 2015, 11:19 PM   #2
diyAudio Member
 
Join Date: Jan 2015
Created project on github: https://github.com/mister-r/DistortionsAnalyzer
If anyone interested - track for changes there.
  Reply With Quote
Old 26th November 2015, 11:46 PM   #3
diyAudio Member
 
buzzforb's Avatar
 
Join Date: Oct 2010
Location: Burlington, NC
Can you show capture of harmonic phase. For me, this is what sets it apart.
__________________
...Shape the sound , Man!
  Reply With Quote
Old 27th November 2015, 08:14 AM   #4
diyAudio Member
 
Join Date: Jan 2015
See numbers on top of graphs in first message here - its harmonic phases in degrees. Also latest version shows _schematically_ (with magnified value) how does each (of 1st three) distortion harmonic phase affects sinusoidal signal. Latest pics are here.
  Reply With Quote
Old 27th November 2015, 06:13 PM   #5
diyAudio Member
 
Join Date: Jan 2015
HM. Why topic was changed? Its THD measurement/drawing tool, not HD.
And topic really changed itself - it was THD today morning, when I copied link from browser into readme, it contained thd (see Urls section here)

Last edited by misterzu; 27th November 2015 at 06:21 PM.
  Reply With Quote
Old 27th November 2015, 11:34 PM   #6
Pano is offline Pano  United States
diyAudio Moderator
 
Pano's Avatar
 
Join Date: Oct 2004
Location: SW Florida
Blog Entries: 4
That's cool! I like the display of the harmonic phase.
__________________
Take the Speaker Voltage Test!
  Reply With Quote
Old 2nd December 2015, 08:33 PM   #7
JohnPM is offline JohnPM  United Kingdom
diyAudio Member
 
Join Date: Oct 2008
For those not quite up to running headless Linux boards, I've added display of harmonic phase to the RTA in REW V5.14 beta 12. The sig gen in 5.14 beta 12 can also generate sinusoids with configurable distortion levels and phases. The 5.14 beta 12 installation files are in the installers directory.

Click the image to open in full size.

Click the image to open in full size.
  Reply With Quote
Old 2nd December 2015, 08:37 PM   #8
diyAudio Member
 
buzzforb's Avatar
 
Join Date: Oct 2010
Location: Burlington, NC
Is it possible to show it as a secondary waveform under the primary
__________________
...Shape the sound , Man!
  Reply With Quote
Old 4th December 2015, 07:25 PM   #9
diyAudio Member
 
Join Date: Jan 2015
Quote:
Originally Posted by buzzforb View Post
Is it possible to show it as a secondary waveform under the primary
What do you mean secondary and primary? Distortions 'look' waveform shown schematically on spectrum, its useful cuz its not obvious how distortion products phases got from FFT actually 'look' on waveform.
However, there is simple experiment that can perform anyone. I attached zip with 2 scripts (they also require sox). makeharm2.sh script generates sequence of two kind of mixes interleaved. Each mix contains two sine waves: one of base frequency 1KHz and another one is smaller amplitude of 2KHz. The level of enmixed 2KHz can be specified from command line or defaulted to -30db and same for both mix kinds. But phase of that 2KHz is opposite in that mixes. And when that mixes played as interleaved sequence - its possible to easily hear the difference. My experiments shows that 2nd harmonic hears 'nicer' (less noticeable) when it phased so that waveform 'blunted' at the bottom (this corresponds to 180* by my analyzer) and shurpened at upper. But if upper waveform edge is blunted - then 2md harmonic heared more noticeable. Most interesting that at some level bottom-blunted waveform sounds more clear than actually clear sine waveform. I guess that it caused by opposite phasing with 2nd harmonic that caused by non-linearity of speakers/headphones. So if phase of 2nd harm is same as speakers - them sums, but when they're opposite - then they will subtract each other and actual resulted 'in-air waveform' can be even more clean than when electrical waveform feeded to speakers is less distorted. Whet exactly 2nd harm phase will be produced by some amp highly depends on its schematic, and simple follower can produce 2nd harmonic of opposite phased depending on selected transistor and mode.
There is also script makeharm3.sh that plays combination of same mixes but with 1Khz/3Khz frequencies, but the difference between its mixes is much less noticeable, probably due to my speakers/headphones much more linear by 3rd harmonic than by 2nd. But on high volume level difference is more noticeable and it seems to me that 3rd harmonic that sharpens waveform (on both ends - cuz its 3rd harmonic) sounds better than those that blunts waveform and this is quite logical due to mechanical reasons of speakers distortions. However almost all transistors amplifiers 3rd harmonic distortion product looks as waveform rounding that is same phased as speakers' distortions so they're summed together.
PS when experimenting make sure that both base (1K) and enmixed (2K/3K) frequencies are on the same band of multiband speaker, otherwise different components of signal will be player via different speaker drivers and phase can be altered much.
Attached Files
File Type: zip makeharm.zip (725 Bytes, 2 views)

Last edited by misterzu; 4th December 2015 at 07:45 PM.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio measurement using Arta under Linux gazzagazza Software Tools 6 18th September 2014 12:02 AM
harmonic distortion vitalstates Tubes / Valves 13 15th June 2010 09:17 PM
Harmonic Distortion acoustic measurement discussion tresch Equipment & Tools 1 4th September 2009 12:29 AM
Why is distortion harmonic? dsavitsk Tubes / Valves 48 12th March 2008 03:49 AM
Non Linear Distortion testing - Harmonic Distortion JMB Multi-Way 0 20th July 2004 03:54 PM


New To Site? Need Help?

All times are GMT. The time now is 10:27 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright 1999-2017 diyAudio

Content Relevant URLs by vBSEO 3.3.2
Wiki