{"id":38,"date":"2023-02-11T11:38:01","date_gmt":"2023-02-11T11:38:01","guid":{"rendered":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/?p=38"},"modified":"2023-02-12T01:59:29","modified_gmt":"2023-02-12T01:59:29","slug":"adityas-status-report-for-2-11","status":"publish","type":"post","link":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/2023\/02\/11\/adityas-status-report-for-2-11\/","title":{"rendered":"Aditya&#8217;s Status Report for 2\/11"},"content":{"rendered":"<p>This week I worked on determining how to use the Short-time Fourier transform to depict an audio signal in both the time and frequency domains at the same time. I recorded several basic audio samples using my iPhone of me playing the piano; one was a C note held for a couple seconds, another was a C scale ascending for five notes. I started by using MATLAB, as that is the system most designed for this kind of signal processing and plotting. I wanted to determine how to isolate only the relevant frequencies in a signal and determine at what point in time they are at a relevant magnitude.<\/p>\n<p>I used this method from the scipy library to generate the STFT:<\/p>\n<div>\n<pre>f, t, Zxx = stft(time_domain_sig, fs=sample_rate, window = 'hann', nperseg = sixteenth, noverlap = sixteenth \/\/ 8);<\/pre>\n<\/div>\n<div><\/div>\n<p>The key difficulty here was determining the parameters of the STFT. The functions asks us to pick a window shape, as well as the size of the window and how much the sliding window should overlap. I attempted to use a rectangular window at the size corresponding to one second of the audio clip, but I realized that a smaller-sized Hann window worked better to account for the signal&#8217;s constantly changing magnitude. I also assigned a window size of 1\/2 the sample rate, because each note of the scale I played for about 1 second, meaning I would have 2 windows applying the Fourier transform to each note. I translated this code to a python script and wrote a method that takes a file name as input and generates the STFT.<\/p>\n<p>This code resulted in the following graph:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-40\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-content\/uploads\/sites\/253\/2023\/02\/Figure_1-300x221.png\" alt=\"\" width=\"381\" height=\"281\" \/><\/p>\n<p>You can see the earlier pulses are more accurate to the start of the pulse than the later ones, suggesting a smaller window is needed to get accurate DFTs. The cost of this accuracy is a slower and more redundant process of obtaining the frequency-domain representation of the signal.<\/p>\n<p>I am on schedule for researching the frequency domain representations of the audio signals, because my goal was to have a proper back-end representation of the signal&#8217;s magnitude at relevant frequencies. My plan for the next week is to fine-tune this data to be more accurate and write code to detect which frequencies correspond to which musical note and generate a dictionary-like representation of the note, it&#8217;s magnitude, and it&#8217;s length. My deliverable will be the python code which outputs an easily comprehensible list of notes in text form.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I worked on determining how to use the Short-time Fourier transform to depict an audio signal in both the time and frequency domains at the same time. I recorded several basic audio samples using my iPhone of me playing the piano; one was a C note held for a couple seconds, another was &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/2023\/02\/11\/adityas-status-report-for-2-11\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Aditya&#8217;s Status Report for 2\/11&#8221;<\/span><\/a><\/p>\n","protected":false},"author":712,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,1],"tags":[4],"_links":{"self":[{"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/posts\/38"}],"collection":[{"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/users\/712"}],"replies":[{"embeddable":true,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":3,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":47,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/posts\/38\/revisions\/47"}],"wp:attachment":[{"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd8\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}