{"id":47,"date":"2021-11-19T02:57:08","date_gmt":"2021-11-19T02:57:08","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/mccludav\/?p=47"},"modified":"2021-11-19T02:57:08","modified_gmt":"2021-11-19T02:57:08","slug":"audio-loop-station-6th-entry","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/mccludav\/2021\/11\/19\/audio-loop-station-6th-entry\/","title":{"rendered":"Audio Loop Station, 6th Entry"},"content":{"rendered":"\n<p class=\"has-text-color has-extra-large-font-size\" style=\"color:#a200a3\"><strong>Time-Stretching<\/strong><\/p>\n\n\n\n<p>This week I was able to implement Time-Stretching.  The implementation technique was not what I thought it would be when I first started this project.  <\/p>\n\n\n\n<p>I was convinced time-stretching would involve Fourier Transformations from Time-Space to Frequency-Space.  In Frequency-Space, some manipulation would be done, then a final transformation back to Time-Space would need to be done.<\/p>\n\n\n\n<p>An actual simple solution involves <em><strong>stuttering <\/strong><\/em>at a high frequency rate.  To illustrate this, suppose we have the function below, and we want to stretch it out by a factor of 2.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-1.png\" alt=\"\" class=\"wp-image-48\" width=\"610\" height=\"243\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-1.png 694w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-1-300x120.png 300w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><figcaption>An original audio signal that gets time-shifted.<\/figcaption><\/figure>\n\n\n\n<p>The first step is to add zeroed out audio signals at fixed intervals.  Suppose we select 1 second as the fixed interval.  A new function would look as follows.  What was the signal from 1 to 2 seconds has been shifted over to 2 to 3 seconds.  What was the signal from 2 to 3 seconds is now 4 to 5 seconds, etc..<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-2.png\" alt=\"\" class=\"wp-image-49\" width=\"610\" height=\"194\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-2.png 860w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-2-300x96.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-2-768x245.png 768w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><figcaption>Original with zeroed fixed spaces &#8211; here we begin to time-stretch the signal.<\/figcaption><\/figure>\n\n\n\n<p>After this, we replace the zeroed out segments with the previous segment.  The signal would now look like that below.  Notice the signal from 0 to 1 seconds is the same as that from 1 to 2 seconds.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"275\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-3.png\" alt=\"\" class=\"wp-image-50\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-3.png 857w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-3-300x96.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/4756\/files\/2021\/11\/Blog-8-Pic-3-768x246.png 768w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><figcaption>Zeroed signal is filled in with the previous audio segment.  We begin to stutter.<\/figcaption><\/figure>\n\n\n\n<p class=\"has-text-color has-extra-large-font-size\" style=\"color:#a200a3\"><strong>What Frequency Do We Stutter At?<\/strong><\/p>\n\n\n\n<p>It was found through trial and error that intervals of 0.050 seconds, which translates to 20 Hz works well to produce audio smooth transitions.  An interval of 0.025 seconds is too fast.  An interval of 0.100 seconds is too slow.<\/p>\n\n\n\n<p>I believe this is because our hearing range is from 20 Hz to 20,000 Hz.  We are using a stuttering frequency of 20 Hz &#8211; the limits of our ability to hear at low frequencies.<\/p>\n\n\n\n<p>It seems our brain is just not able to recognize stuttering at this frequency as stuttering.  It just sounds like time-stretching.<\/p>\n\n\n\n<p>If the time interval is 0.5 seconds, then it sounds like echoes for sure.  But at one-tenth that rate, 0.05 seconds, we just cant really tell.<\/p>\n\n\n\n<p class=\"has-text-color has-extra-large-font-size\" style=\"color:#a200a3\"><strong>Strategy for Pitch-Shifting <\/strong><\/p>\n\n\n\n<p>For pitch-shifting, if I want to double the frequency of the audio track, I will just toss every other time-based audio point.  This will double the frequency.  Then I will just send this through the time-stretching routine to slow it down.<\/p>\n\n\n\n<p>If I pitch shift by a factor of 2, then I increase the frequency by a factor of 2, and time stretch by a factor of 2.  <\/p>\n\n\n\n<p>If I pitch shift by a factor of 1.5, then I increase the frequency by a factor of 1.5 (toss every 3rd data point), and time stretch by a factor of 1.5.<\/p>\n\n\n\n<p>This is what I will work on now&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time-Stretching This week I was able to implement Time-Stretching. The implementation technique was not what I thought it would be when I first started this project. I was convinced time-stretching would involve Fourier Transformations from Time-Space to Frequency-Space. In Frequency-Space, some manipulation would be done, then a final transformation back to Time-Space would need to&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.oregonstate.edu\/mccludav\/2021\/11\/19\/audio-loop-station-6th-entry\/\">Continue reading <span class=\"screen-reader-text\">Audio Loop Station, 6th Entry<\/span><\/a><\/p>\n","protected":false},"author":11630,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-47","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/posts\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/users\/11630"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":51,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/posts\/47\/revisions\/51"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mccludav\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}