{"id":276,"date":"2020-07-24T11:36:04","date_gmt":"2020-07-24T18:36:04","guid":{"rendered":"https:\/\/boom-tracker.com\/tracker\/?p=276"},"modified":"2020-07-26T10:31:18","modified_gmt":"2020-07-26T17:31:18","slug":"the-good-the-bad-and-the-skewed","status":"publish","type":"post","link":"https:\/\/boom-tracker.com\/tracker\/blog\/the-good-the-bad-and-the-skewed\/","title":{"rendered":"The good, the bad, and the skewed"},"content":{"rendered":"\n<p>One of the technical challenges in this project is to figure out the exact time offset of two waveforms.  I think I&#8217;ve solved that sufficiently.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>The Good<\/strong><\/p>\n\n\n\n<p>My algorithm correctly detects the time skew of two waveforms.  Here&#8217;s the raw data from two mics:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-1024x548.png\" alt=\"\" class=\"wp-image-275\" width=\"794\" height=\"425\" srcset=\"https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-1024x548.png 1024w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-300x160.png 300w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-768x411.png 768w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-250x134.png 250w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-550x294.png 550w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-800x428.png 800w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-337x180.png 337w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-561x300.png 561w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859-935x500.png 935w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859.png 1253w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><figcaption>Without correction, the two waveforms look disjoint<\/figcaption><\/figure>\n\n\n\n<p>And here&#8217;s after the skew is corrected for:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-1024x548.png\" alt=\"\" class=\"wp-image-274\" width=\"796\" height=\"426\" srcset=\"https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-1024x548.png 1024w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-300x160.png 300w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-768x411.png 768w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-250x134.png 250w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-550x294.png 550w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-800x428.png 800w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-337x180.png 337w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-561x300.png 561w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed-935x500.png 935w, https:\/\/boom-tracker.com\/tracker\/wp-content\/uploads\/2020\/07\/mic_001_004_1595605859_skewed.png 1253w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><figcaption>With the curve from Mic 004 skewed forward by 2.44 milliseconds<\/figcaption><\/figure>\n\n\n\n<p>The two waveforms are a very good match.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>The Bad<\/strong><\/p>\n\n\n\n<p>The algorithm is very computationally intensive.  My first pass at the code, finding the skew took 10-20 minutes for two 50 millisecond waveforms.  With a little optimization from caching interpolation results and discarding excess precision, I got it down to 1-2 minutes (much better, but still pretty slow.   I may be able to get another factor of 2 or 3 my switching to C++ from Python, but getting the code right will be more difficult.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>The Skewed<\/strong><\/p>\n\n\n\n<p>It has occasionally detected skews in the range I&#8217;d expect for two microphones next to each other (a few hundred microseconds), but most of the skews have been in the 2-2.5 millisecond range, which is about 10 times what I&#8217;m hoping for.  More work on time sync is needed apparently.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the technical challenges in this project is to figure out the exact time offset of two waveforms. I think I&#8217;ve solved that sufficiently. The Good My algorithm correctly detects the time skew of two waveforms. Here&#8217;s the raw data from two mics: And here&#8217;s after the skew is corrected for: The two waveforms&hellip; <a class=\"more-link\" href=\"https:\/\/boom-tracker.com\/tracker\/blog\/the-good-the-bad-and-the-skewed\/\">Continue reading <span class=\"screen-reader-text\">The good, the bad, and the skewed<\/span> <span class=\"meta-nav\" aria-hidden=\"true\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"bgseo_title":"","bgseo_description":"","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[3,8],"tags":[],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-blog","category-implementation"],"_links":{"self":[{"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":3,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":295,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/posts\/276\/revisions\/295"}],"wp:attachment":[{"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boom-tracker.com\/tracker\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}