<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chuck-jee Chau 周卓之 on Medium]]></title>
        <description><![CDATA[Stories by Chuck-jee Chau 周卓之 on Medium]]></description>
        <link>https://medium.com/@chuckjee?source=rss-c427fcb5e85b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Cpp3H9ZhfFdwl1r_uZ7-GA.png</url>
            <title>Stories by Chuck-jee Chau 周卓之 on Medium</title>
            <link>https://medium.com/@chuckjee?source=rss-c427fcb5e85b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:54:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chuckjee/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A quick course on music programming…]]></title>
            <link>https://medium.com/@chuckjee/a-quick-course-on-music-programming-adc8a4336612?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/adc8a4336612</guid>
            <category><![CDATA[programming-music]]></category>
            <category><![CDATA[puredata]]></category>
            <category><![CDATA[computer-music]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 08:40:53 GMT</pubDate>
            <atom:updated>2022-08-26T08:40:53.157Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>I have recently wrote and taught a short course on music programming using <strong><em>Pure Data</em></strong>, together with mobile platform enhancement using <strong><em>MobMuPlat</em></strong>. I’ll try to write something about the contents later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p3aAZw3Z_zLMyFWj5s6GJQ.png" /></figure><p>Before I have time to do that, feel free to enjoy the course materials at this link:</p><blockquote><a href="https://www.cse.cuhk.edu.hk/~chuckjee/musicpro2022/">https://www.cse.cuhk.edu.hk/~chuckjee/musicpro2022/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adc8a4336612" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[純音手工特調：用 Python 做聲音加法合成]]></title>
            <link>https://medium.com/computer-music-research-notes/blending-pure-tones-additive-synthesis-from-scratch-with-python-code-61b2892a281f?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/61b2892a281f</guid>
            <category><![CDATA[合成]]></category>
            <category><![CDATA[computer-music]]></category>
            <category><![CDATA[聲音]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[電腦音樂]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Fri, 15 Jul 2022 07:58:07 GMT</pubDate>
            <atom:updated>2022-07-15T07:58:07.536Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>類比合成器上常可見到幾款基本波形，用以構成更複雜的聲音。事實上，只要<strong>秘方</strong>在手，全部基本波形都可以用 sine wave 純音組合而成。</p><p><a href="https://medium.com/@chuckjee/blending-pure-tones-additive-synthesis-from-scratch-with-python-code-b6930e08d9b5">Blending pure tones: Additive Synthesis from scratch with Python code</a></p><p>之前提過一個單頻率可以產生某一個音高的聲音。其實大部份樂器發出的聲音都用<strong>一組特定頻率</strong>構成每個音高，而用上不同的組合秘方就可以產生不同音色（<strong><em>timbre</em></strong>）。</p><blockquote>Timbre /ˈtambə/: The character or quality of a musical or vocal sound (<a href="https://www.oed.com/view/Entry/202089">Oxford English Dictionary</a>)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ikK6nv_k96bGiEiC" /><figcaption>Photo by <a href="https://unsplash.com/@nature_zen?utm_source=medium&amp;utm_medium=referral">Nature Zen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>泛音（harmonics）的比例是音色變化的重要一環。我們要找到基音/基頻（fundamental frequency）及其<strong>整數倍數</strong>頻率之間的音量比例。</p><h4>小提琴的聲音</h4><p>先看看一個小提琴的 A440 音，基音是 <strong>440 Hz</strong> 。在此之上聲音裏還混有一個 <strong>880 Hz</strong> (440×2), 一個 <strong>1320 Hz</strong> (440×3), 一個 <strong>1760 Hz</strong> (440×4) 如此類推。聲音分析工具可以找出下圖中的秘方：音量比例（amplitude ratio）。（<em>先別理會震音啦</em>）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MuTM6cq2ukez1n37lC-_A.png" /><figcaption>頻譜分析（spectral analysis）得出的小提琴音色秘方</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Ffa9cf7c281f74965bf8ff88270a8c731%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Ffa9cf7c281f74965bf8ff88270a8c731%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/92853f55d49e2ef259d6fc381ea764de/href">https://medium.com/media/92853f55d49e2ef259d6fc381ea764de/href</a></iframe><p>簡單合成後，聲音是這樣的：</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F847f9bd7cbdc46b48598790c52292c3c%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F847f9bd7cbdc46b48598790c52292c3c%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d4762477380f5c029345f9356e10b56/href">https://medium.com/media/7d4762477380f5c029345f9356e10b56/href</a></iframe><p>雖不像小提琴，但跟原來的 sine wave 純音也有一段距離。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F6b9c10f92f5149d7a39ca76ede488c3a%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F6b9c10f92f5149d7a39ca76ede488c3a%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4649107f78de9f91431c390c6771294/href">https://medium.com/media/d4649107f78de9f91431c390c6771294/href</a></iframe><p>把 sine wave 純音混合成新聲音叫「<strong>加法合成</strong>」（additive synthesis）。下面我們試用 Python 一步步製作。</p><h4>Python 裏的加法合成</h4><p>我們從 import library 開始。IPython顯示聲音播放器，matplotlib製作圖表，numpy處理數據陣列，math提供數學 function 。另外我們先定義取樣率 sampling rate sr。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F26f6d94b88f1412aace36e613f7eb4a6%3Fheight%3D191&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F26f6d94b88f1412aace36e613f7eb4a6%3Fheight%3D191&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="191" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b7ca0cfd63f2e6adef3f551d610147d/href">https://medium.com/media/9b7ca0cfd63f2e6adef3f551d610147d/href</a></iframe><p>之前我們見過用 Python 產生純 sine wave。把其放進 makesine() function，重複使用就方便一點。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F3495cfb811144766be7b1ed1f2f33876%3Fheight%3D137&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F3495cfb811144766be7b1ed1f2f33876%3Fheight%3D137&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="137" frameborder="0" scrolling="no"><a href="https://medium.com/media/5170e4e18044c7b791ea219499aa9d9e/href">https://medium.com/media/5170e4e18044c7b791ea219499aa9d9e/href</a></iframe><p>然後我們就可以多叫 makesine() 幾次，產生指定頻率 freq 和長度 dur 的聲音了。結果可以用 numpy.concatenate() 放到一起輸出。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F2025a448de294fb9afd201119e493fc2%3Fheight%3D255&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F2025a448de294fb9afd201119e493fc2%3Fheight%3D255&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="255" frameborder="0" scrolling="no"><a href="https://medium.com/media/e19ff52d07fafc8f9ef6b3a34e93acb1/href">https://medium.com/media/e19ff52d07fafc8f9ef6b3a34e93acb1/href</a></iframe><p>基本的純音聽來也像樣。接着我們可以製作整數倍數關係的音頻，再疊加起來。這裏用了 freq*i ， i 從 1 開始，每次加 1 。每個音頻都用上 amplist 裏指定的音量。疊好了就放到 out 。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fc7ff37f3db0b46f283375fb522f9f1af%3Fheight%3D371&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fc7ff37f3db0b46f283375fb522f9f1af%3Fheight%3D371&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="371" frameborder="0" scrolling="no"><a href="https://medium.com/media/5598f3f83d553b5186744adf04dcc200/href">https://medium.com/media/5598f3f83d553b5186744adf04dcc200/href</a></iframe><h4>用加法合成調出幾種基本音形</h4><p>好了，之前說到的基本音形在此，只用簡陋的加法合成器產生，用了首 10 個泛音的音量。（<em>我太懶，不理會第 11 之後的泛音啦</em>）</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F305de5379a43459994df00857ad89bd0%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F305de5379a43459994df00857ad89bd0%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1b92bbf719b0596233b72ecaa1f0800/href">https://medium.com/media/e1b92bbf719b0596233b72ecaa1f0800/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F74cada55bf854a6ead973707e0b9f22a%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F74cada55bf854a6ead973707e0b9f22a%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d2d52412ee5c8e938f7e996e0279d65/href">https://medium.com/media/4d2d52412ee5c8e938f7e996e0279d65/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fe25fd640a9dc4524808fad5e43a4b290%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fe25fd640a9dc4524808fad5e43a4b290%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff0a2508af8b9d9b494dd0d59c393a71/href">https://medium.com/media/ff0a2508af8b9d9b494dd0d59c393a71/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fd37faa10f0a34d198b2e2a613a8105be%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fd37faa10f0a34d198b2e2a613a8105be%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/97199cc7de841525a2ca0315dec9e336/href">https://medium.com/media/97199cc7de841525a2ca0315dec9e336/href</a></iframe><p>再看看之前的小提琴音⋯⋯</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F150a0b9c1c804558b16cbccb63a53946%3Fheight%3D482&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F150a0b9c1c804558b16cbccb63a53946%3Fheight%3D482&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="482" frameborder="0" scrolling="no"><a href="https://medium.com/media/988cfbd6e7252d16b9d585664fae9482/href">https://medium.com/media/988cfbd6e7252d16b9d585664fae9482/href</a></iframe><p>同樣以 440 Hz 為基音，用上不同的泛音比例，聽起來也有明顯分別。</p><h4>旋律製作</h4><p>準備工夫做好，我們可以做個 pitch-frequency 轉換器：</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F9ca084a86ab645d49fa804bd57200812%3Fheight%3D119&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F9ca084a86ab645d49fa804bd57200812%3Fheight%3D119&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="119" frameborder="0" scrolling="no"><a href="https://medium.com/media/632f75bb3312e41093964449f920d4fd/href">https://medium.com/media/632f75bb3312e41093964449f920d4fd/href</a></iframe><p>還有個旋律播放機來處理一列音 notes 和長度 durs 的組合，再指定泛音比例 harmonics 。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F4e8f441da1bd455da7e090af95538c63%3Fheight%3D191&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F4e8f441da1bd455da7e090af95538c63%3Fheight%3D191&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="191" frameborder="0" scrolling="no"><a href="https://medium.com/media/8edc848eed15b7eca240298611cd1557/href">https://medium.com/media/8edc848eed15b7eca240298611cd1557/href</a></iframe><p>旋律來了！這裏 p 是要播的音， d 是每個音的長度（放快 4 倍），而 h 是泛音音量。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F815215a686bb4af39a0f2184e0ad8576%3Fheight%3D303&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F815215a686bb4af39a0f2184e0ad8576%3Fheight%3D303&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="303" frameborder="0" scrolling="no"><a href="https://medium.com/media/7db6410e1b0842aa6fa42d0b7cfb890c/href">https://medium.com/media/7db6410e1b0842aa6fa42d0b7cfb890c/href</a></iframe><p>大概聽起來像 80 年代？（<em>而其實是 90 年代的產物</em>）</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVk4KK-gh0FM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVk4KK-gh0FM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVk4KK-gh0FM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/71aeee085fea944245292e71bd4db823/href">https://medium.com/media/71aeee085fea944245292e71bd4db823/href</a></iframe><p>加法合成也有點<em>費時失事</em>，連電腦也花不少功夫，以往因運算資源缺乏更甚。像拿原色顏料手工調色一樣，加法合成可以給 developer/musician 很大的自由，但現成聲音便捷得多，也更受歡迎。</p><p>下次我們再談其他編程工具和軟件，可以方便一點的用到現成的聲音再處理。</p><p>有興趣研究 Python code 的話，歡迎試玩： <a href="https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/Additive-synthesis-from-scratch-e0fb471d-1cce-4e57-9142-cfb7f9a4899c/%2Fnotebook.ipynb"><em>https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/Additive-synthesis-from-scratch-e0fb471d-1cce-4e57-9142-cfb7f9a4899c/%2Fnotebook.ipynb</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61b2892a281f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computer-music-research-notes/blending-pure-tones-additive-synthesis-from-scratch-with-python-code-61b2892a281f">純音手工特調：用 Python 做聲音加法合成</a> was originally published in <a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blending pure tones: Additive Synthesis from scratch with Python code]]></title>
            <link>https://medium.com/@chuckjee/blending-pure-tones-additive-synthesis-from-scratch-with-python-code-b6930e08d9b5?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6930e08d9b5</guid>
            <category><![CDATA[sound-synthesis]]></category>
            <category><![CDATA[computer-music]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Mon, 11 Jul 2022 08:09:07 GMT</pubDate>
            <atom:updated>2022-07-15T07:58:23.449Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>There are a few basic waveforms that are commonly seen in analog synthesizers as building blocks for more complex sounds. But indeed, they can all be built from the purest sound — sine waves! You just need the <strong><em>correct recipe</em></strong> for the combination.</p><p><a href="https://medium.com/@chuckjee/blending-pure-tones-additive-synthesis-from-scratch-with-python-code-61b2892a281f">純音手工特調：用 Python 做聲音加法合成</a></p><p>Although we hear the vibration of a single frequency as a <em>single pitch</em>, the harmonious sound from musical instruments all happen to have a <strong><em>collection of frequencies</em></strong> for every single pitch. With a different recipe of combination of these frequencies, the tone colour (<strong><em>timbre</em></strong>) differs.</p><blockquote>Timbre /ˈtambə/: The character or quality of a musical or vocal sound (<a href="https://www.oed.com/view/Entry/202089">Oxford English Dictionary</a>)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ikK6nv_k96bGiEiC" /><figcaption>Photo by <a href="https://unsplash.com/@nature_zen?utm_source=medium&amp;utm_medium=referral">Nature Zen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The set of harmonics is an important base of the <em>timbre</em>. Technically, we need to look for an appropriate proportion of the fundamental frequency and its <strong><em>integer multiples</em></strong>.</p><h4>A Violin Sound</h4><p>For example, a violin sound of A440 has a <em>fundamental frequency</em> of <strong>440 Hz</strong>. On top of it, the sound also has a mix of <strong>880 Hz</strong> (440×2), <strong>1320 Hz</strong> (440×3), <strong>1760 Hz</strong> (440×4), and so on. Let’s use this table of <em>secret recipe</em> that we can find using some sound analysis tools. <em>Ignore the vibrato for the moment…</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MuTM6cq2ukez1n37lC-_A.png" /><figcaption>The recipe of violin timbre, obtained with spectrum analysis</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Ffa9cf7c281f74965bf8ff88270a8c731%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Ffa9cf7c281f74965bf8ff88270a8c731%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/92853f55d49e2ef259d6fc381ea764de/href">https://medium.com/media/92853f55d49e2ef259d6fc381ea764de/href</a></iframe><p>With a very simple synthesis, it sounds like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F847f9bd7cbdc46b48598790c52292c3c%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F847f9bd7cbdc46b48598790c52292c3c%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d4762477380f5c029345f9356e10b56/href">https://medium.com/media/7d4762477380f5c029345f9356e10b56/href</a></iframe><p>Try comparing it with the pure sine tone. It sounds so different, isn’t it?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F6b9c10f92f5149d7a39ca76ede488c3a%3Fheight%3D107&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F6b9c10f92f5149d7a39ca76ede488c3a%3Fheight%3D107&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="107" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4649107f78de9f91431c390c6771294/href">https://medium.com/media/d4649107f78de9f91431c390c6771294/href</a></iframe><p>To mix pure sine tones into a new timbre is called <strong><em>additive synthesis</em></strong>. Let’s do this step by step with Python code!</p><blockquote>Don’t worry. It’s not so <strong>addictive</strong>…</blockquote><h4>Additive Synthesis with Python</h4><p>We start with importing the necessary libraries— IPython for showing the sound player, matplotlib for plotting charts, numpy for arrays, and math for some mathematical functions. We also define the sampling rate sr.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F26f6d94b88f1412aace36e613f7eb4a6%3Fheight%3D191&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F26f6d94b88f1412aace36e613f7eb4a6%3Fheight%3D191&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="191" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b7ca0cfd63f2e6adef3f551d610147d/href">https://medium.com/media/9b7ca0cfd63f2e6adef3f551d610147d/href</a></iframe><p>We have seen making a pure sine waveform before. We can put the code into a function makesine() to easily reuse it:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F3495cfb811144766be7b1ed1f2f33876%3Fheight%3D137&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F3495cfb811144766be7b1ed1f2f33876%3Fheight%3D137&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="137" frameborder="0" scrolling="no"><a href="https://medium.com/media/5170e4e18044c7b791ea219499aa9d9e/href">https://medium.com/media/5170e4e18044c7b791ea219499aa9d9e/href</a></iframe><p>Then, we can run makesine() several times to make a new waveform, with certain frequency freq and duration dur. We can put all of them together using numpy.concatenate().</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F2025a448de294fb9afd201119e493fc2%3Fheight%3D255&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F2025a448de294fb9afd201119e493fc2%3Fheight%3D255&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="255" frameborder="0" scrolling="no"><a href="https://medium.com/media/e19ff52d07fafc8f9ef6b3a34e93acb1/href">https://medium.com/media/e19ff52d07fafc8f9ef6b3a34e93acb1/href</a></iframe><p>The basic sine wave sounds pretty good! Now let’s make more sine waves with frequencies at integer multiples using freq*i, where i is a counter from 1 and adds 1 every time. The sine waves need to softened into the predefined amplitudes in amplist. They are then stacked up in out.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fc7ff37f3db0b46f283375fb522f9f1af%3Fheight%3D371&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fc7ff37f3db0b46f283375fb522f9f1af%3Fheight%3D371&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="371" frameborder="0" scrolling="no"><a href="https://medium.com/media/5598f3f83d553b5186744adf04dcc200/href">https://medium.com/media/5598f3f83d553b5186744adf04dcc200/href</a></iframe><h4>Basic Waveforms with Additive Synthesis</h4><p>Now, here are the common basic waveforms re-created with a simple additive synthesizer which only includes <em>the first 10 harmonics</em>: <em>(I’m too lazy to obtain more harmonic amplitudes…)</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F305de5379a43459994df00857ad89bd0%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F305de5379a43459994df00857ad89bd0%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1b92bbf719b0596233b72ecaa1f0800/href">https://medium.com/media/e1b92bbf719b0596233b72ecaa1f0800/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F74cada55bf854a6ead973707e0b9f22a%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F74cada55bf854a6ead973707e0b9f22a%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d2d52412ee5c8e938f7e996e0279d65/href">https://medium.com/media/4d2d52412ee5c8e938f7e996e0279d65/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fe25fd640a9dc4524808fad5e43a4b290%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fe25fd640a9dc4524808fad5e43a4b290%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff0a2508af8b9d9b494dd0d59c393a71/href">https://medium.com/media/ff0a2508af8b9d9b494dd0d59c393a71/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fd37faa10f0a34d198b2e2a613a8105be%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2Fd37faa10f0a34d198b2e2a613a8105be%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/97199cc7de841525a2ca0315dec9e336/href">https://medium.com/media/97199cc7de841525a2ca0315dec9e336/href</a></iframe><p>And here’s the <em>violin</em> again!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F150a0b9c1c804558b16cbccb63a53946%3Fheight%3D482&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F150a0b9c1c804558b16cbccb63a53946%3Fheight%3D482&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="482" frameborder="0" scrolling="no"><a href="https://medium.com/media/988cfbd6e7252d16b9d585664fae9482/href">https://medium.com/media/988cfbd6e7252d16b9d585664fae9482/href</a></iframe><p>While all of them have 440 Hz as the fundamental frequency, it sounds quite drastically different with a different combination of harmonics.</p><h4>More Sophisticated Ways to Generate a Melody</h4><p>Going further, here we prepare a function for the pitch-to-frequency calculator:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F9ca084a86ab645d49fa804bd57200812%3Fheight%3D119&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F9ca084a86ab645d49fa804bd57200812%3Fheight%3D119&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="119" frameborder="0" scrolling="no"><a href="https://medium.com/media/632f75bb3312e41093964449f920d4fd/href">https://medium.com/media/632f75bb3312e41093964449f920d4fd/href</a></iframe><p>And a melody player to accept lists of notes and durations to play, with a pre-defined list of harmonic ratios:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F4e8f441da1bd455da7e090af95538c63%3Fheight%3D191&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F4e8f441da1bd455da7e090af95538c63%3Fheight%3D191&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="191" frameborder="0" scrolling="no"><a href="https://medium.com/media/8edc848eed15b7eca240298611cd1557/href">https://medium.com/media/8edc848eed15b7eca240298611cd1557/href</a></iframe><p>Then… let’s play a melody! Here p is the notes to play, d is the durations of each note (made faster by ×4 times), and h is the list of harmonic amplitudes.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F815215a686bb4af39a0f2184e0ad8576%3Fheight%3D303&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2Fe0fb471d-1cce-4e57-9142-cfb7f9a4899c%2F5c061c3b-96b8-4f8a-a8a7-7bbdcda669f4%2F815215a686bb4af39a0f2184e0ad8576%3Fheight%3D303&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="303" frameborder="0" scrolling="no"><a href="https://medium.com/media/7db6410e1b0842aa6fa42d0b7cfb890c/href">https://medium.com/media/7db6410e1b0842aa6fa42d0b7cfb890c/href</a></iframe><p>I guess this may sound like the 80’s for you? <em>(Indeed it’s the 90’s and beyond…)</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVk4KK-gh0FM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVk4KK-gh0FM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVk4KK-gh0FM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/71aeee085fea944245292e71bd4db823/href">https://medium.com/media/71aeee085fea944245292e71bd4db823/href</a></iframe><p>Such an operation of additive synthesis can be quite <em>tedious</em>, even for computers (in older days when computation resource was less plentiful as today)! Just like mixing paints manually, such a synthesis gives the developer/musician the highest degree of control, but could be less favourable than a ready-mix that saves plenty of time.</p><p>Next time we can use easier tools such as programming libraries or software to get pre-mixture of tones for further manipulation.</p><p>You can try and play with the code in this notebook: <a href="https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/Additive-synthesis-from-scratch-e0fb471d-1cce-4e57-9142-cfb7f9a4899c/%2Fnotebook.ipynb"><em>https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/Additive-synthesis-from-scratch-e0fb471d-1cce-4e57-9142-cfb7f9a4899c/%2Fnotebook.ipynb</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6930e08d9b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[電子樂器vs數碼樂器，傻傻分不清]]></title>
            <link>https://medium.com/computer-music-research-notes/what-is-so-different-when-musical-instruments-are-electrified-b2c0ce2db8c1?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2c0ce2db8c1</guid>
            <category><![CDATA[midi]]></category>
            <category><![CDATA[電吉他]]></category>
            <category><![CDATA[電子音樂]]></category>
            <category><![CDATA[數位音樂]]></category>
            <category><![CDATA[樂器]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 06:49:23 GMT</pubDate>
            <atom:updated>2022-07-05T06:49:23.601Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>古典樂手往往對令人眼花撩亂的電子或數碼樂器有點疑惑，有點着迷。芸芸眾多「通電就有聲音」的樂器中，有些基本分別，產生聲音的方法是其一。</p><p><a href="https://medium.com/@chuckjee/what-is-so-different-when-musical-instruments-are-electrified-a7c62119774c">What is so different when musical instruments are electrified?</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXYWDoZYWywJ3pCfW2WXNA.png" /><figcaption>我的靜音低音大提琴</figcaption></figure><p>樂器的學術分類裏對「電子樂器 electrophones 」¹ 的定義仍有爭議。不過，我就先在此將一些常見電音籠統按發聲原理分為三類。</p><ol><li>將振動擴大，並變為電子聲音訊號</li><li>以電子訊號發生器（signal generator）或聲音庫（sound bank）<strong>產生</strong>聲音</li><li>以控制器（controller）驅動電腦或音源器（sound module）<strong>播放</strong>聲音</li></ol><h3>電子擴音</h3><p>電結他或低音電結他大概是最為人熟悉的電子樂器。有時被視為「弦鳴樂器 chordophones 」，弦線彈撥產生振動的方式與木結他或低音大提琴沒甚麼分別。</p><p>電結他弦線的振動由<strong><em>拾音器</em></strong>（pickup）變為電子訊號，然後可經各式放大器（amplifier）擴大，再由揚聲器（loudspeaker）輸出為聲音。樂手花上不少心血去找適合的拾音器或其他電子零件。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEzSu5zOX_Qg%3Fstart%3D506%26feature%3Doembed%26start%3D506&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEzSu5zOX_Qg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEzSu5zOX_Qg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/223594ebf68e43d0408ff1fa2bcb8aa2/href">https://medium.com/media/223594ebf68e43d0408ff1fa2bcb8aa2/href</a></iframe><p>傳統弦樂器也有電子版本，就是那些削去了音箱只剩空框的電提琴。拉奏或彈奏時，弦線振動經琴碼（bridge）傳到拾音器，故此「空框」的功用只為免影響拉奏姿勢。琴碼及拾音器質量對音質攸關重要：提琴琴碼裏的振動放大後，就連當中的瑕疵也會大為擴大！</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZh_MfEDEUY0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZh_MfEDEUY0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZh_MfEDEUY0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4770a8e8204d6f01a850143f3daf9568/href">https://medium.com/media/4770a8e8204d6f01a850143f3daf9568/href</a></iframe><h3>類比合成器</h3><p>無需振動，純以電子器材也可以產生聲音：只要有某頻率的強弱電壓脈沖推動揚聲器，效果相當。特雷門琴（theremin）是碩果僅存的傳統純電子音樂，已有百年歷史。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fw5qf9O6c20o%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dw5qf9O6c20o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fw5qf9O6c20o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e91803cd62fa87b2d20e4da82fe2a3b/href">https://medium.com/media/0e91803cd62fa87b2d20e4da82fe2a3b/href</a></iframe><p>簡單的電子零件如<strong><em>振盪器</em></strong>（oscillator）就可以產生有週期性的訊號。正弦波振盪器（sinusoidal oscillator）可以產生 sine wave ，而將 sine wave 疊加起來就可以產生其他基本波形了。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fembed%2Fpreview%2FXWEmVzP%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DXWEmVzP&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fpen%2FXWEmVzP&amp;image=https%3A%2F%2Fshots.codepen.io%2Fchuckjee%2Fpen%2FXWEmVzP-512.jpg%3Fversion%3D1656994845&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/850eb00001f267bd43f531018e6eafe2/href">https://medium.com/media/850eb00001f267bd43f531018e6eafe2/href</a></iframe><p>大部份類比合成器都用上振盪器產生各種基本波形，再行經各式電子零件如增益器（gain），或者濾波器（filter）等，成為獨特的「電音」。通常合成器都有個簡單鍵盤，用以控制音高。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1bO07ge3hzo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1bO07ge3hzo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1bO07ge3hzo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4de9f67ddb1418c22c5088caf9b6534/href">https://medium.com/media/e4de9f67ddb1418c22c5088caf9b6534/href</a></iframe><p>每次重新配置電子線路未免太繁瑣費時，樂手後來將常用的聲音儲存到聲音庫，控鍵就可以重現某訊號。如此歷史上就出現了電子琴，可以彈奏各式樂器的聲音了！</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fa3qin-nDGGU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Da3qin-nDGGU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fa3qin-nDGGU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/002c16df20373170aa984c24cc7a8b78/href">https://medium.com/media/002c16df20373170aa984c24cc7a8b78/href</a></iframe><blockquote>對合成器有興趣的話，可看看友人的 facebook page 「合成貓」：</blockquote><p><a href="https://www.facebook.com/Synth-Cat-%E5%90%88%E6%88%90%E8%B2%93-101620062614946">Synth Cat 合成貓</a></p><h3>數碼樂器</h3><p>「<a href="https://zh.wikipedia.org/wiki/%E6%91%A9%E5%B0%94%E5%AE%9A%E5%BE%8B">摩爾定律</a>」提到：電腦記憶體價格每一年半就劈價一半。除了各式樂器，現在我們已能輕易將各種強弱、奏法通通儲存起來，再用電腦晶片處理混音。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQkDX_4jWB04%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQkDX_4jWB04&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQkDX_4jWB04%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8e5bff71faa6e3d49e29c5a487e5df7/href">https://medium.com/media/c8e5bff71faa6e3d49e29c5a487e5df7/href</a></iframe><p>數碼聲音合成只需電腦運算，再用不着振動器等電子零件（<em>當然也可以用軟件模擬電子聲音</em>）。用某檔案作音頭，另找一個檔案作持續音，然後或許用上淡出（fade out）結尾。<strong><em>電腦軟件</em></strong>帶來很多新鮮可能。</p><p>現在數碼樂手較注意音樂控制器。新的控制器（controller）層出不窮，不再限於鍵盤式，還有敲擊、鼓板、吹管樂等，型態萬千。若你見到吹管樂手用 saxophone 狀的樂器奏出小提琴或定音鼓聲音，也不用太驚訝。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FV4eDN_I40BA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DV4eDN_I40BA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FV4eDN_I40BA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b2143255d0994d01db049aa04566834/href">https://medium.com/media/9b2143255d0994d01db049aa04566834/href</a></iframe><p>很多數碼樂器依然承傳着數碼音樂之皇 MIDI 的血統。只需音起/音止、音高、音量，加上各式 CC （control change）訊息，已能表現很多音樂上的可能。最重要是，各式軟硬件都有良好支援，方便延伸。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBx4zOYYAW_A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBx4zOYYAW_A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBx4zOYYAW_A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/68007fb54d2d42924f97d22ebb92419b/href">https://medium.com/media/68007fb54d2d42924f97d22ebb92419b/href</a></iframe><p>玩藝之人又豈會自我設限？每年一度的 NIME 大會就有各種各樣機器與音樂結合的嶄新嘗試。</p><p>[1] Britannica: electrophone <a href="https://www.britannica.com/art/electrophone"><em>https://www.britannica.com/art/electrophone</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2c0ce2db8c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computer-music-research-notes/what-is-so-different-when-musical-instruments-are-electrified-b2c0ce2db8c1">電子樂器vs數碼樂器，傻傻分不清</a> was originally published in <a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[More about different kinds of electrified musical instruments]]></title>
            <link>https://medium.com/@chuckjee/what-is-so-different-when-musical-instruments-are-electrified-a7c62119774c?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7c62119774c</guid>
            <category><![CDATA[electronic-music]]></category>
            <category><![CDATA[digital-music]]></category>
            <category><![CDATA[musical-instruments]]></category>
            <category><![CDATA[electric-guitar]]></category>
            <category><![CDATA[midi]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 06:48:34 GMT</pubDate>
            <atom:updated>2022-07-11T01:34:02.212Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Classical musicians are often dazzled and confused by the variety of <strong><em>electronic</em></strong> or <strong><em>digital</em></strong> musical instruments. While they all operate on electricity and sounds come through loudspeakers, there are subtle distinctions between the different types. Mainly, they differ by how they convert the human input into sound.</p><p><a href="https://medium.com/computer-music-research-notes/what-is-so-different-when-musical-instruments-are-electrified-b2c0ce2db8c1">電子樂器vs數碼樂器，傻傻分不清</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXYWDoZYWywJ3pCfW2WXNA.png" /><figcaption>My silent double bass</figcaption></figure><p>There are academic discussions on the definition of <em>electrophones¹</em>. Yet, here is a quick way to tell apart some common instruments that we usually encounter, from how sound is generated.</p><ol><li>Amplified vibration with electronics</li><li>Sound from signal generators or sound banks</li><li>Sound from computers or sound modules, driven by controllers</li></ol><h3>Amplified electronics</h3><p>Electric guitars and bass guitars are likely the most common electric instruments. Sometimes considered <em>chordophones</em>, the strings are vibrated in ways almost identical to acoustic guitars or double basses.</p><p>The mechanic vibration is converted into electric signal with a <strong><em>pickup</em></strong>. The signal then can be amplified with different kinds of amplifiers, and be output to loudspeakers. Musicians work a lot on finding the <em>good</em> pickups and other electronics <em>en route</em>!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEzSu5zOX_Qg%3Fstart%3D506%26feature%3Doembed%26start%3D506&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEzSu5zOX_Qg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEzSu5zOX_Qg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/223594ebf68e43d0408ff1fa2bcb8aa2/href">https://medium.com/media/223594ebf68e43d0408ff1fa2bcb8aa2/href</a></iframe><p>There are also traditional string instruments <em>electrified</em>, getting rid of the soundbox. When the strings are played, the vibrations go through the bridge to the pickup. That’s why they are in all those weird hollow shapes, usually serving to avoid changing the musician’s posture. The sound quality now depends heavily on the quality of the pickup, since the vibration conversion would be quite dramatically amplified.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZh_MfEDEUY0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZh_MfEDEUY0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZh_MfEDEUY0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4770a8e8204d6f01a850143f3daf9568/href">https://medium.com/media/4770a8e8204d6f01a850143f3daf9568/href</a></iframe><h3>Analog synthesizers</h3><p>Sounds can be directly generated with electronics without real vibrations. Again, we just need some pulses of strong and weak voltages, with certain frequencies, to drive the loudspeakers. The theremin is one legacy in the family of pure electronic instruments, having an age of 100 years!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fw5qf9O6c20o%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dw5qf9O6c20o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fw5qf9O6c20o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e91803cd62fa87b2d20e4da82fe2a3b/href">https://medium.com/media/0e91803cd62fa87b2d20e4da82fe2a3b/href</a></iframe><p><strong><em>Oscillators</em></strong> are some simple electronics to produce a periodic signal. Sine waves can easily be generated with sinusoidal oscillators, and other basic waveforms can also be created by combining sine waves!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fembed%2Fpreview%2FXWEmVzP%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DXWEmVzP&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fpen%2FXWEmVzP&amp;image=https%3A%2F%2Fshots.codepen.io%2Fchuckjee%2Fpen%2FXWEmVzP-512.jpg%3Fversion%3D1656994845&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/850eb00001f267bd43f531018e6eafe2/href">https://medium.com/media/850eb00001f267bd43f531018e6eafe2/href</a></iframe><p>Most analog synthesizers allow basic waveform generation with oscillators. There are often further electronics for controlling the gain, or routing through filters, creating signature sounds of electronics. Usually there is also a keyboard interface to decide the frequency to play (or, to generate a sound).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1bO07ge3hzo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1bO07ge3hzo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1bO07ge3hzo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4de9f67ddb1418c22c5088caf9b6534/href">https://medium.com/media/e4de9f67ddb1418c22c5088caf9b6534/href</a></iframe><p>Soon people found that reconfiguring through circuits got too complex and time consuming, and started to store sound patterns into sound banks for playing back. There we have simple <em>electronic pianos </em>having all sorts of musical instrument sounds!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fa3qin-nDGGU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Da3qin-nDGGU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fa3qin-nDGGU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/002c16df20373170aa984c24cc7a8b78/href">https://medium.com/media/002c16df20373170aa984c24cc7a8b78/href</a></iframe><h3>Digital instruments</h3><p>Computer memory has a trend to get half cheaper every 18 months (a.k.a. <a href="https://en.wikipedia.org/wiki/Moore%27s_law"><em>Moore’s Law</em></a>). Eventually sounds of not just various instruments, but more of different dynamics, articulations, bowing/playing methods, can be easily stored for manipulation with more powerful chips.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQkDX_4jWB04%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQkDX_4jWB04&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQkDX_4jWB04%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8e5bff71faa6e3d49e29c5a487e5df7/href">https://medium.com/media/c8e5bff71faa6e3d49e29c5a487e5df7/href</a></iframe><p>New methods of sound synthesis no longer depends on real oscillators and electronics (<em>yet we can still simulate the vintage electronics with software</em>), but more on computations. Play the note head from this file, going with note sustain from elsewhere, and the end perhaps with a fade out. Lots of new possibilities come true with <strong><em>computer</em></strong> <strong><em>software</em></strong>.</p><p>People now work harder with new ways of controlling music. New piano keyboards, mallet percussion pads, drums, winds, and even new shapes of unimagined ways of making music. It’s not too weird to see a musician making sounds of violin or timpani with a saxophone-shape controller!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FV4eDN_I40BA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DV4eDN_I40BA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FV4eDN_I40BA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b2143255d0994d01db049aa04566834/href">https://medium.com/media/9b2143255d0994d01db049aa04566834/href</a></iframe><p>Many of digital instruments and controllers rely on the king of digital music — <strong><em>MIDI</em></strong>! Just note on/off, pitch, velocity, with a large set of control change (CC) messages are already pretty good for musical expressions. Best thing with this veteran is the high compatibility and extensibility with hardware and software systems.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBx4zOYYAW_A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBx4zOYYAW_A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBx4zOYYAW_A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/68007fb54d2d42924f97d22ebb92419b/href">https://medium.com/media/68007fb54d2d42924f97d22ebb92419b/href</a></iframe><p>But certainly, no artists are to be bounded by <em>standards</em>. The NIME conference every year show cases a lot of new possibilities of music and machine interacting with each other. After all, only the sky is the limit for new ways to create new art…</p><p>[1] Britannica: electrophone <a href="https://www.britannica.com/art/electrophone"><em>https://www.britannica.com/art/electrophone</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7c62119774c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding for music is not that hard]]></title>
            <link>https://medium.com/@chuckjee/coding-for-music-is-not-that-hard-fe4e240242bb?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe4e240242bb</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-music]]></category>
            <category><![CDATA[programming-music]]></category>
            <category><![CDATA[audio-programming]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Tue, 28 Jun 2022 09:02:52 GMT</pubDate>
            <atom:updated>2022-07-11T10:23:55.729Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Music and programming seem so far away in the arts and science realms. With more and more <em>programming</em> tools available, we can indeed code and generate some unique sounds with computers. Usually we start with <em>Hello World</em> for programming starters, let’s do some Middle C’s for our music class here!</p><p><a href="https://medium.com/computer-music-research-notes/music-programming-is-easy-eaf5e8315def">用 coding 做音樂，其實不難</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tThHPoMUknA7aWFJQZdW5w.png" /><figcaption>Middle C in different programming languages</figcaption></figure><p>Middle C has a <em>MIDI pitch number</em> of <strong>60</strong>, with sound frequency <strong>261.63 Hz</strong>. If you don’t bother to look up corresponding table, you can find it with an equation too! Here <strong><em>p</em></strong> is the pitch (MIDI number), and <strong><em>f</em></strong> is the frequency:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*UHSsM1setlIzZEWcYNaRKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*p52_E_voNkLXlxfh4223rw.png" /></figure><h3>General-purpose Programming Languages</h3><p>Let’s look at the versatile <strong>Python</strong> language. As long as the values of <em>sin(2𝜋ft)</em> can be represented, it can drive the audio player to make sound. Here we usually use the <em>Numpy</em>¹ library for handling large sets of data, which works great for array storage and access. There are many math functions and constants easily available, such as numpy.linspace, numpy.sin , and numpy.pi.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F739e4c1a-813d-4620-8292-41ff7bde3903%2Fdc77241b-e365-4976-9c9f-90c337d7e609%2F8a15e908cc334bc0be286769b72052bc%3Fheight%3D381&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F739e4c1a-813d-4620-8292-41ff7bde3903%2Fdc77241b-e365-4976-9c9f-90c337d7e609%2F8a15e908cc334bc0be286769b72052bc%3Fheight%3D381&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="381" frameborder="0" scrolling="no"><a href="https://medium.com/media/c49fe727eb3749031830c1aa6a8894f8/href">https://medium.com/media/c49fe727eb3749031830c1aa6a8894f8/href</a></iframe><p>Python with Numpy together often reminds people of MATLAB code, and the pair is becoming the new beloved tools of data scientists. Once the leader in scientific computing, <strong>MATLAB</strong> is so expensive that no one wants to afford it outside research labs. (Free alternatives include <em>GNU Octave</em>², etc.) MATLAB works almost the same as in Python, where the sound also comes from the long series of values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adc466b2796c9c5b4305e2ca55f7901a/href">https://medium.com/media/adc466b2796c9c5b4305e2ca55f7901a/href</a></iframe><h3>Audio Programming Languages</h3><p>General-purpose languages can work on all purposes, but are never tailor-made for music. Audio languages include different kinds of oscillators and synthesizers for music programmers’ convenience.</p><p>A popular language among electronic (programming) musicians is <strong>CSound</strong>³. The code includes orchestra and score, which handles <em>how to sound</em> and <em>what to sound</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a08fd7656f54664744290cb64c0d7686/href">https://medium.com/media/a08fd7656f54664744290cb64c0d7686/href</a></iframe><p><strong>SuperCollider</strong>⁴ has a different coding pattern. Unlike in CSound, the sound by default does not stop, unless interrupted or when time is specified clearly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/413bcc67678bfa040412accc3fd932a9/href">https://medium.com/media/413bcc67678bfa040412accc3fd932a9/href</a></iframe><h3>Visual Audio Programming Languages</h3><p>When text-based coding could limit your creativity, the visual counterpart is well received by electronic musicians.</p><p>Coding in <strong>Max/MSP</strong>⁵ is more like drawing. We use <em>patch cords</em> to connect elements, which are all sorts of boxes for audio processing or numerical manipulation. It is the first choice for interactive electronic music thanks to the friendly interface.</p><p>As a commercial product, Max/MSP limits for certain use and distribution of music code products. The author of Max, <em>Miller Puckette</em>, made another open-source substitute named <strong>Pure Data</strong>⁶ (PD).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlzZx0CQlkWk-V5PFW43Sg.png" /><figcaption>Almost the simplest patches, for Middle C in Max (left) and Pure Data (right)</figcaption></figure><p>Let’s wrap up with a simple JavaScript synthesizer using <strong>Web Audio API</strong>⁷. The sound frequency can be adjusted with the bar.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fembed%2Fpreview%2FxxYeRQw%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DxxYeRQw&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fpen%2FxxYeRQw%3Feditors%3D1011&amp;image=https%3A%2F%2Fshots.codepen.io%2Fchuckjee%2Fpen%2FxxYeRQw-512.jpg%3Fversion%3D1655714424&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/13567eab8e73f1a367b223273e24d125/href">https://medium.com/media/13567eab8e73f1a367b223273e24d125/href</a></iframe><p><em>Let me write more on each language soon!</em></p><p>[1] Numpy <a href="https://numpy.org/"><em>https://numpy.org</em></a></p><p>[2] GNU Octave <a href="https://octave.org/"><em>https://octave.org</em></a></p><p>[3] CSound <a href="https://csound.com/"><em>https://csound.com</em></a></p><p>[4] SuperCollider <a href="https://supercollider.github.io/"><em>https://supercollider.github.io</em></a></p><p>[5] Max <a href="https://cycling74.com/products/max"><em>https://cycling74.com/products/max</em></a></p><p>[6] Pure Data <a href="https://puredata.info/"><em>https://puredata.info</em></a></p><p>[7] Web Audio API <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API"><em>https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe4e240242bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do computers hear music?]]></title>
            <link>https://medium.com/@chuckjee/how-do-computers-hear-music-91e699bdf7ea?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/91e699bdf7ea</guid>
            <category><![CDATA[midi]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-music]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Mon, 27 Jun 2022 10:03:56 GMT</pubDate>
            <atom:updated>2022-06-28T08:56:53.054Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>For a computer to process music, we have to first <strong><em>digitize</em></strong> the music information. If we are talking about graphics, <strong><em>digitization</em></strong> refers to the process of the real-life image that our eyes can see being captured by cameras into pixels, which are represented by a matrix of colour dots, to be displayed on a screen or stored as a fil.</p><p><a href="https://medium.com/computer-music-research-notes/how-do-computers-hear-music-39c935bf123a">電腦怎樣「聽」音樂？</a></p><p>Sound comes from <strong><em>vibration of particles</em></strong> in air or other media. When our ears capture the vibration energy, the brain hears something. Digitized sounds are measured as <strong><em>samples</em></strong>, which basically record the vibration amplitude of certain moments. When we need to replay a sound file in the computer, vibrating the loudspeaker diaphragm with this amplitude would re-create the sound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MLfPicYZWwswHx4-fvfhFA.png" /><figcaption>Sound comes from vibration <em>(</em><a href="https://icons8.com/"><em>Icons from icons8</em></a><em>)</em></figcaption></figure><p>There are two <em>general</em> requirements for the vibration to be heard:</p><ol><li><em>Periodic</em>: The vibration should be rather repetitive, with a certain frequency. The frequency is usually measued as times per second. Once per second is named <strong><em>1 Hertz</em></strong>, or abbreviated as <strong><em>1 Hz</em></strong>.</li><li>Within <em>human audible range</em>: Human ears can hardly perceive frequencies under 20 Hz as a sound, but instead as some vibrations felt in the human body ¹. Above around 15,000 Hz (15 kHz), the frequency perception becomes less sensitive, which especially declines with age.</li></ol><p>There are usually periodic sounds in music, with a not-so-short duration (at least around 0.1 second) and a certain frequency, referred to as a pitched sound. A higher frequency gives a higher pitch. The tuning pitch <strong><em>A440</em></strong> in orchestras is the standard A note at 440 Hz. Let’s look only at pitched sounds first.</p><h4>Audio Representation</h4><p>The “<strong><em>purest</em></strong>” sound is a sine wave — we’ll look at more complex sounds later. Here is a <strong><em>1-second 440 Hz pure sound,</em></strong> created with Python code. Play and hear it.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fbbfb3762-7557-42a7-8d22-a74caaf1f4c8%3Fheight%3D363&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fbbfb3762-7557-42a7-8d22-a74caaf1f4c8%3Fheight%3D363&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="363" frameborder="0" scrolling="no"><a href="https://medium.com/media/16201eb8891344972a639ba8cb472ae4/href">https://medium.com/media/16201eb8891344972a639ba8cb472ae4/href</a></iframe><p><em>Python programming is popular these days!</em> We will demo most of our code in Python.</p><p>So what does this code do? Basically, <strong>t</strong> is a timeline, with a value from 0 to tmax (1) in very small increments. <strong>x</strong> is the value of the sine wave at this time (t), calculated with the formula <em>2πft</em>, ranging from -1 to 1. Here shows the contents of the first 100 samples.</p><blockquote>Oopsie isn’t this too hard?? More on programming later…</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F0434b4dc2b9d4ce983e62194eacfaa97%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F0434b4dc2b9d4ce983e62194eacfaa97%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b7ee7547f472583543e1aabce81c878/href">https://medium.com/media/4b7ee7547f472583543e1aabce81c878/href</a></iframe><p>Okay, how does it look? Here is the “sound” zoomed-in a lot… that the chart only shows <em>0.01 s of the waveform</em>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F646700b319e7431bb9d534226747b10e%3Fheight%3D400&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F646700b319e7431bb9d534226747b10e%3Fheight%3D400&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b501eca278ccc3a2e16f3c7c4fa92c6/href">https://medium.com/media/3b501eca278ccc3a2e16f3c7c4fa92c6/href</a></iframe><p>Here is how the whole 1-second sound looks — doesn’t look like the usual waveform seen in recording apps <strong><em>at all</em></strong>! Do not forget, this is a plain pure sound that has no change in dynamics and pitch. Digitized sounds are really nothing more than lots of 0 → 1 → 0 → -1 → 0 → … （or occassionally something like 0–65536 in some representations).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fb182ae4049074cfd9876e6f1c44db060%3Fheight%3D400&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fb182ae4049074cfd9876e6f1c44db060%3Fheight%3D400&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9ea17e5e648352a1b19749b29d831d3/href">https://medium.com/media/c9ea17e5e648352a1b19749b29d831d3/href</a></iframe><h4>Symbolic Representation</h4><p>When the complete sound is recorded, it’s usually convenient for replaying. No matter what kind of instruments, or how the acoustics are, everything is faithfully represented given that you have a <em>reliable recording team</em>. Yet, much of the low-level data is simply too complex for musicians, giving rise to the <strong><em>symbolic representation</em></strong> of sounds. We only need information like pitch, duration, dynamics, and instruments etc.</p><p>Many electronic/digital instruments in the market support well the standard of <em>Musical Instrument Digital Interface</em> (MIDI) ². It originated in 1982 as MIDI 1.0, and the release of MIDI 2.0 in 2020 was quite a hype for (electronic) musicians.</p><p>The MIDI format didn’t change a lot since the 80’s, with basic messages as “<em>note on/off — note number — velocity</em>”. The note number (pitch) is an 8-bit number, i.e. a value of 0–127. It can correspond to every standard pitch in Western classical music. For example, MIDI number 60 represents the Middle C on the piano.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*aoNORewwOpuBvQK-xhj5bg.png" /><figcaption>MIDI pitch numbers and the corresponding piano keys</figcaption></figure><p>Here the Python code uses MIDI note numbers to notate music. melody has the pitches we want, and they are put one by one into s (the Stream). You can see the generated <em>boring</em> phrase of music with default duration and dynamics. Play and hear it!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F079321a1418a4f0790bc8ee75d25e90d%3Fheight%3D443&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F079321a1418a4f0790bc8ee75d25e90d%3Fheight%3D443&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="443" frameborder="0" scrolling="no"><a href="https://medium.com/media/af14fb3c7df0dba3a9211da992e7f45e/href">https://medium.com/media/af14fb3c7df0dba3a9211da992e7f45e/href</a></iframe><p>MIDI comes with simple musical commands only and occupies only small storage on a computer. A decent MIDI sequencer with a good MIDI player would make the listening experience… <em>acceptable</em>. Before the wave of MP3 files brought by broadband Internet, MIDI files were what people have in their music collection on their home computer. At that time Windows/Mac had MIDI players in the system for simple music playing.</p><p>Although MIDI files are no longer commonplace in home computers, the format is still widely used in music production software, such as in software instruments in Apple software, or score-making software like MuseScore. They often rely heavily on symbolic representated sounds for easy editing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7BmoVjl0BPMykbNOIqkb7g.png" /><figcaption><em>The same melody represented in “Symbolic Representation” (above) and “Audio Representation” (below)</em></figcaption></figure><p>Audio representation and symbolic representation are good for different purposes. While audio representation gives a faithful record, editing is not trivial. Symbolic representation relies on the playing system for re-creating the sound, is great for music editing but not for non-instrumental sounds (e.g. human voice!). It’s not difficult for converting a symbolic file to audio, by just playing it through. Yet the reverse is still a research problem in computer music — <em>Automatic Music Transcription</em> (AMT).</p><p>Let’s talk about other interesting tidbits of the two in another article later. Try and play with these programming notebooks!</p><p>Deepnote Notebook:</p><p><a href="https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/How-do-computers-hear-music-66fc2a65-4317-4a20-8902-9c66217ebe8a/%2Fnotebook.ipynb">Deepnote</a></p><p>Google Colab:</p><p><a href="https://colab.research.google.com/drive/1xNRJjm0qqWa08uKhklsBifvzjSKFJfxY?usp=sharing">Google Colaboratory</a></p><p>[1] Infrasound <a href="https://en.wikipedia.org/wiki/Infrasound"><em>https://en.wikipedia.org/wiki/Infrasound</em></a></p><p>[2] MIDI <a href="https://en.wikipedia.org/wiki/MIDI"><em>https://en.wikipedia.org/wiki/MIDI</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91e699bdf7ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用 coding 做音樂，其實不難]]></title>
            <link>https://medium.com/computer-music-research-notes/music-programming-is-easy-eaf5e8315def?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaf5e8315def</guid>
            <category><![CDATA[編程語言]]></category>
            <category><![CDATA[電腦音樂]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[computer-music]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Wed, 22 Jun 2022 10:41:51 GMT</pubDate>
            <atom:updated>2022-07-11T10:24:28.873Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>音樂與編程像乎「大纜都扯唔埋」，但其實現在越來越多編程工具可以選擇，用以電腦製作獨特的聲音。編程課一開始我們常說「Hello World」，音樂課我們就來個 Middle C 吧。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tThHPoMUknA7aWFJQZdW5w.png" /><figcaption>各種編程語言裏的 Middle C</figcaption></figure><p>Middle C 的 MIDI number 是 60 ， 聲音頻率是 261.63 Hz ，除了查對數表，亦有數得計。下面算式 <em>p</em> 為 pitch (MIDI number)， <em>f</em> 為 frequency 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*UHSsM1setlIzZEWcYNaRKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*p52_E_voNkLXlxfh4223rw.png" /></figure><h3>通用編程語言</h3><p>先說最常見、用途廣範的 <strong>Python</strong> ，只要能表現到算式 <em>sin(2𝜋ft)</em> 的連串數值就可以丟到播放器了。我們往往用到善於處理大型數據的 NumPy ¹ 插件，方便儲存和使用各式資料陣列（array）。 NumPy 裏有很多數學函式（function）和常數（constant）可以用，如 numpy.linspace numpy.sin numpy.pi 等。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F739e4c1a-813d-4620-8292-41ff7bde3903%2Fdc77241b-e365-4976-9c9f-90c337d7e609%2F8a15e908cc334bc0be286769b72052bc%3Fheight%3D381&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F739e4c1a-813d-4620-8292-41ff7bde3903%2Fdc77241b-e365-4976-9c9f-90c337d7e609%2F8a15e908cc334bc0be286769b72052bc%3Fheight%3D381&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="381" frameborder="0" scrolling="no"><a href="https://medium.com/media/c49fe727eb3749031830c1aa6a8894f8/href">https://medium.com/media/c49fe727eb3749031830c1aa6a8894f8/href</a></iframe><p>Python 和 NumPy 合作起來很有 MATLAB 的味道，有取而代之之勢。 <strong>MATLAB</strong> 曾是科學運算（scientific computing）的翹楚，但始終價格昂貴，在科研實驗室外常人難以負擔（免費使用可參考 GNU Octave ² 等）。MATLAB 基本發聲原理跟 Python 也差不多，也是一大串的數值。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adc466b2796c9c5b4305e2ca55f7901a/href">https://medium.com/media/adc466b2796c9c5b4305e2ca55f7901a/href</a></iframe><h3>音頻編程語言</h3><p>通用語言始終不是為音樂而設，雖然萬能也百搭，對聲音處理不及專用語言便利，往往已內置了各式振動器、合成器等音訊工具。</p><p>電子音樂人常用的語言不可不提到 <strong>CSound </strong>³。編程檔案裏包含了 orchestra 和 score 兩部份，分別處理「如何發聲」和「發甚麼聲」兩方面。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a08fd7656f54664744290cb64c0d7686/href">https://medium.com/media/a08fd7656f54664744290cb64c0d7686/href</a></iframe><p>另一著名語言叫 <strong>SuperCollider </strong>⁴ 。與 CSound 不同，聲音預設連續不斷，除非定下清晰的時間點，或者手動中斷。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/413bcc67678bfa040412accc3fd932a9/href">https://medium.com/media/413bcc67678bfa040412accc3fd932a9/href</a></iframe><h3>圖形音頻編程語言</h3><p>文字編程局限了想像力？圖形編程語言也甚受電子樂手歡迎。</p><p><strong>Max/MSP</strong> ⁵ 編程像繪圖，用線（patch cord）把不同的元件連結起來，從音頻處理到數字換算都是一個個的小格子。因為使用容易，可說是互動電子電腦音樂製作的首選平台。</p><p>Max/MSP 作為商業軟件，使用和作品發行都有一定限制。 Max 的原作者 <em>Miller Puckette</em> 也就做了個開源版本，多一個選擇，名稱叫 <strong>Pure Data</strong> ⁶ (PD) 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlzZx0CQlkWk-V5PFW43Sg.png" /><figcaption>都是 Middle C，幾乎是最簡單的 Max（上）／PD（下）patch！</figcaption></figure><p>最後加送一個可以手動操作的 JavaScript 發聲器，用上了簡單的 Web Audio API ⁷ ，可以控制聲音的頻率。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fembed%2Fpreview%2FxxYeRQw%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DxxYeRQw&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fchuckjee%2Fpen%2FxxYeRQw%3Feditors%3D1011&amp;image=https%3A%2F%2Fshots.codepen.io%2Fchuckjee%2Fpen%2FxxYeRQw-512.jpg%3Fversion%3D1655714424&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/13567eab8e73f1a367b223273e24d125/href">https://medium.com/media/13567eab8e73f1a367b223273e24d125/href</a></iframe><p>稍後再詳談，大概每種語言都可以說上幾篇！</p><p>[1] Numpy <a href="https://numpy.org/"><em>https://numpy.org</em></a></p><p>[2] GNU Octave <a href="https://octave.org/"><em>https://octave.org</em></a></p><p>[3] CSound <a href="https://csound.com/"><em>https://csound.com</em></a></p><p>[4] SuperCollider <a href="https://supercollider.github.io/"><em>https://supercollider.github.io</em></a></p><p>[5] Max <a href="https://cycling74.com/products/max"><em>https://cycling74.com/products/max</em></a></p><p>[6] Pure Data <a href="https://puredata.info/"><em>https://puredata.info</em></a></p><p>[7] Web Audio API <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API"><em>https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaf5e8315def" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computer-music-research-notes/music-programming-is-easy-eaf5e8315def">用 coding 做音樂，其實不難</a> was originally published in <a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[電腦怎樣「聽」音樂？]]></title>
            <link>https://medium.com/computer-music-research-notes/how-do-computers-hear-music-39c935bf123a?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/39c935bf123a</guid>
            <category><![CDATA[電腦音樂]]></category>
            <category><![CDATA[computer-music]]></category>
            <category><![CDATA[聲音]]></category>
            <category><![CDATA[midi]]></category>
            <category><![CDATA[編程]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Tue, 14 Jun 2022 10:59:03 GMT</pubDate>
            <atom:updated>2022-07-05T07:35:45.325Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>談到以電腦處理音樂，先要以適當方式將音樂資訊數碼化（digitization）。以較常見的圖像方式解說的話，數碼化意思就是把眼睛可見的影像，經過相機轉換成電腦的像素（pixel），成為一個個顏色點陣在螢幕顯示，或儲存為檔案。</p><p><a href="https://medium.com/@chuckjee/how-do-computers-hear-music-91e699bdf7ea">How do computers hear music?</a></p><p>聲音本來是空氣或其他媒介的粒子振動（vibration），耳朵感到振動能量就可轉為腦內的聽覺。聲音數碼化的單位是取樣（sample），每個取樣都記下某時刻振動能量的強弱。故此播放聲音檔案時，按此強弱去振動掦聲器/喇叭內的振膜¹就可以重現聲音了。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MLfPicYZWwswHx4-fvfhFA.png" /><figcaption>聲音從振動而來 <em>(</em><a href="https://icons8.com/"><em>Icons from icons8</em></a><em>)</em></figcaption></figure><p>振動要產生聲音，先有兩個要求：</p><ol><li>有<em>週期性</em>（periodic）：<br>振動要有一定程度的重覆，即「頻率」（frequency），通常以每秒次數量度。每秒一次稱作 1 個赫茲（1 Hertz），或簡稱 1 Hz 。</li><li>在<em>人耳可探測</em>範圍內：<br>人耳對約 20 Hz 以下的頻率難以感知作聲音，反而往往是身體感到震動²。而在 15,000 Hz (15 kHz) 左右以上的感知因人而異，亦隨年紀逐漸消退。</li></ol><p>音樂裏通常是週期性強的聲音，有較長的時間（至少約 0.1 秒）有固定頻率，可稱為有音高（pitch），頻率高就是較高音。樂團常用的調音音高通常是「 A440 」，即是一個 440 Hz 的標準 A 音。在本文往後的討論，我們先看有音高的聲音（pitched sound）。</p><h4>音頻表示法 Audio Representation</h4><p>最基本的「純音」是單獨一個正弦波（sine wave） — — 稍後我們再另文看為何其他聲音不只是 sine wave 。以下是一個長 1 秒的 440 Hz 純音，以 Python code 表示。按播放收聽。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fbbfb3762-7557-42a7-8d22-a74caaf1f4c8%3Fheight%3D363&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fbbfb3762-7557-42a7-8d22-a74caaf1f4c8%3Fheight%3D363&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="363" frameborder="0" scrolling="no"><a href="https://medium.com/media/16201eb8891344972a639ba8cb472ae4/href">https://medium.com/media/16201eb8891344972a639ba8cb472ae4/href</a></iframe><p>現在流行用 Python 編程，我們大部份編程示範都會如此展示，文末也會提供 Google Colab / Deepnote 上的完整內容。有興趣的讀者可以自行更改數值試試。</p><p>那這段程式碼到底做甚麼呢？簡單來說， <strong>t</strong> 是時間線，純粹就是從 0 開始，以極微小的距離漸漸加到 tmax的數值，即是 1 。而 <strong>x</strong> 就是此刻 sine wave 的數值，以算式 sin(<em>2</em><strong><em>π</em></strong><em>ft)</em> 算出，數值介乎 -1 到 1 之間。下面為首 100 個 sample 的內容。</p><blockquote>太複雜了吧！編程方面容後再談。</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F0434b4dc2b9d4ce983e62194eacfaa97%3Fheight%3D500&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F0434b4dc2b9d4ce983e62194eacfaa97%3Fheight%3D500&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b7ee7547f472583543e1aabce81c878/href">https://medium.com/media/4b7ee7547f472583543e1aabce81c878/href</a></iframe><p>好了好了，有圖有真相，到底這聲音相貌如何？這個是放大好多好多倍（見時間軸，全圖只長 0.01 秒）的音波圖（waveform）。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F646700b319e7431bb9d534226747b10e%3Fheight%3D400&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F646700b319e7431bb9d534226747b10e%3Fheight%3D400&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b501eca278ccc3a2e16f3c7c4fa92c6/href">https://medium.com/media/3b501eca278ccc3a2e16f3c7c4fa92c6/href</a></iframe><p>這一秒的聲音全貌並不像平常在錄音 App 可以見到的聲波形狀，因為這是一個毫無強弱變化的純音。但簡單來說，聲波數碼化後就是好多的 0 → 1 → 0 → -1 → 0 → … （其實有機會是以其他方法表達，例如 0–65536 等）。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fb182ae4049074cfd9876e6f1c44db060%3Fheight%3D400&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2Fb182ae4049074cfd9876e6f1c44db060%3Fheight%3D400&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9ea17e5e648352a1b19749b29d831d3/href">https://medium.com/media/c9ea17e5e648352a1b19749b29d831d3/href</a></iframe><h4>符號表示法 Symbolic Representation</h4><p>把完整的聲音記下來，要重播的時候自然很方便，無論任何樂器音色甚至錄音場地的聲學環境都可以重現出來（當然要有一個好的錄音團隊）。但是音頻當中很多低層數據，對音樂人來說太過繁瑣，故有另外的「符號」方法，只把音樂內的重要資訊記下：音高、音長、強弱、樂器等等。</p><p>大部份電子樂器都支援此歷史悠久的標準：音樂數位介面 <em>Musical Instrument Digital Interface</em> ，簡稱 MIDI³ 。 1982 年 MIDI 1.0 出場，到 2020 年， MIDI 2.0 終於發表，為（電子）音樂界一大盛事。</p><p>MIDI 制式從 80 年代都沒大改變，最基本的訊號就是「<em>音起/音完 — 音高 — 力度</em>」（<em>note on/off — note number — velocity</em>）。音高是個 8-bit 數字，即是 0–127 內的數字，可對應西方音樂中的每個標準音高。例如 MIDI number 60 就是鋼琴上的 Middle C 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*aoNORewwOpuBvQK-xhj5bg.png" /><figcaption>MIDI 音高號碼與其對應的琴鍵</figcaption></figure><p>明白了音高，下面的小段 Python 程式碼大概容易一點理解。 melody 裏的就是我們要的音高，然後把每個音逐一放進 s （一段音樂 / stream）。顯 示出來的就是預設音長、強弱等的平淡「電腦聲」，按播放收聽。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F079321a1418a4f0790bc8ee75d25e90d%3Fheight%3D443&amp;display_name=Deepnote&amp;url=https%3A%2F%2Fembed.deepnote.com%2F66fc2a65-4317-4a20-8902-9c66217ebe8a%2F48364a55-fe21-45d4-a15e-252d75c66e4a%2F079321a1418a4f0790bc8ee75d25e90d%3Fheight%3D443&amp;image=https%3A%2F%2Fdeepnote.com%2Fstatic%2Fthumbnails%2Fmain.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=deepnote" width="700" height="443" frameborder="0" scrolling="no"><a href="https://medium.com/media/af14fb3c7df0dba3a9211da992e7f45e/href">https://medium.com/media/af14fb3c7df0dba3a9211da992e7f45e/href</a></iframe><p>MIDI 只有簡單音樂指令，佔用空間不多。只要製作用心，再配合好的播放系統， MIDI 音樂也還算是「動聽」。在寬頻上網普及令 MP3 成為主流之前，很多人要在電腦儲存音樂就是靠 MIDI 。那時候 Windows/Mac 都有系統內置的 MIDI 播放器，能夠播放簡單音樂。現在 MIDI 檔雖不再常見， MIDI 格式依舊在各類音樂製作軟件可見其蹤影，例如 Apple 的各種 software instrument ，MuseScore 等樂譜製作軟件都用到 MIDI 等符號表示的音樂格式。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7BmoVjl0BPMykbNOIqkb7g.png" /><figcaption>同樣的旋律在 Logic Pro 以「符號表示法」（上）與「音頻表示法」（下）記錄</figcaption></figure><p><em>音頻</em>與<em>符號</em>表示法各擅勝場。音頻檔內所有聲音都像真而完整的記下，但修改不易。符號檔依賴播放系統重新合成聲音，方便製作，但對非樂器聲音則愛莫能助。符號檔變音頻檔不難，只需播放一次就可以；反之卻甚為艱巨，暫時仍是電腦音樂研究的熱門題目— — 自動音樂記譜 <em>Automatic Music Transcription</em> (AMT)。</p><p>如對編程有興趣，可參考以下連結，試試修改數值再執行一下。</p><p>Deepnote Notebook: <a href="https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/How-do-computers-hear-music-66fc2a65-4317-4a20-8902-9c66217ebe8a/%2Fnotebook.ipynb"><em>https://deepnote.com/workspace/chuckjee-f06aaf72-cebf-4a01-bee7-1d8eb93c1d61/project/How-do-computers-hear-music-66fc2a65-4317-4a20-8902-9c66217ebe8a/%2Fnotebook.ipynb</em></a></p><p>Google Colab: <a href="https://colab.research.google.com/drive/1xNRJjm0qqWa08uKhklsBifvzjSKFJfxY?usp=sharing"><em>https://colab.research.google.com/drive/1xNRJjm0qqWa08uKhklsBifvzjSKFJfxY?usp=sharing</em></a></p><p>[1] <em>音響世界入門第一課：弄清楚揚聲器、喇叭與單體</em> <a href="https://www.moryaudio.com.tw/%E5%BC%84%E6%B8%85%E6%A5%9A%E6%8F%9A%E8%81%B2%E5%99%A8%E3%80%81%E5%96%87%E5%8F%AD%E8%88%87%E5%96%AE%E9%AB%94.html">https://www.moryaudio.com.tw/%E5%BC%84%E6%B8%85%E6%A5%9A%E6%8F%9A%E8%81%B2%E5%99%A8%E3%80%81%E5%96%87%E5%8F%AD%E8%88%87%E5%96%AE%E9%AB%94.html</a></p><p>[2] 次聲波 <a href="https://zh.wikipedia.org/wiki/%E6%AC%A1%E5%A3%B0%E6%B3%A2">https://zh.wikipedia.org/wiki/%E6%AC%A1%E5%A3%B0%E6%B3%A2</a></p><p>[3] MIDI <a href="https://zh.wikipedia.org/wiki/MIDI">https://zh.wikipedia.org/wiki/MIDI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39c935bf123a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computer-music-research-notes/how-do-computers-hear-music-39c935bf123a">電腦怎樣「聽」音樂？</a> was originally published in <a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[科研網站指南]]></title>
            <link>https://medium.com/computer-music-research-notes/research-weblinks-a24260c9ae58?source=rss-c427fcb5e85b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a24260c9ae58</guid>
            <category><![CDATA[links]]></category>
            <category><![CDATA[網站]]></category>
            <category><![CDATA[電腦音樂]]></category>
            <category><![CDATA[computer-music]]></category>
            <dc:creator><![CDATA[Chuck-jee Chau 周卓之]]></dc:creator>
            <pubDate>Tue, 07 Jun 2022 13:04:53 GMT</pubDate>
            <atom:updated>2022-07-05T07:01:47.659Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>互聯網地大物博，以下是部份與電腦音樂（computer music）或音樂科技（music technology）研究有關的網站。此頁不定期更新，如有遺漏萬莫見怪，歡迎指正！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*wEcletplDB9IS7hK.png" /><figcaption>純粹插圖，是我碩士時的作業</figcaption></figure><h4>學術組織</h4><ul><li>Institute for Research and Coordination in Acoustics/Music (<strong><em>IRCAM</em></strong>) <a href="https://www.ircam.fr/"><em>https://www.ircam.fr</em></a></li></ul><p><a href="https://www.ircam.fr/">Ircam</a></p><ul><li>Stanford Center for Computer Research in Music and Acoustics (<strong><em>CCRMA</em></strong>) <a href="https://ccrma.stanford.edu/"><em>https://ccrma.stanford.edu</em></a></li></ul><p><a href="https://ccrma.stanford.edu/">Center for Computer Research in Music and Acoustics</a></p><ul><li>Queen Mary Centre for Digital Music (<strong><em>C4DM</em></strong>) <a href="https://c4dm.eecs.qmul.ac.uk/"><em>https://c4dm.eecs.qmul.ac.uk</em></a></li></ul><p><a href="https://c4dm.eecs.qmul.ac.uk/">Home | Centre for Digital Music (C4DM) | Queen Mary, University of London</a></p><ul><li>International Audio Laboratories Erlangen (<strong><em>AudioLabs</em></strong>) <a href="https://www.audiolabs-erlangen.de/"><em>https://www.audiolabs-erlangen.de/</em></a></li></ul><p><a href="https://www.audiolabs-erlangen.de/">AudioLabs - Home</a></p><ul><li>Music and Audio Computing Lab, Academia Sinica <a href="https://musicai.citi.sinica.edu.tw/"><em>https://musicai.citi.sinica.edu.tw</em></a></li><li>音樂與文化科技實驗室 (MCTL) <a href="https://mctlab.iis.sinica.edu.tw/mctl/"><em>https://mctlab.iis.sinica.edu.tw/mctl/</em></a></li><li>國立台灣大學資訊工程學系 多媒體資訊檢索實驗室 (MIR Lab) <a href="http://mirlab.org/"><em>http://mirlab.org</em></a></li></ul><blockquote>音樂相關實驗室何其多，可見此頁：<a href="https://ismir.net/resources/research-centers/">https://ismir.net/resources/research-centers/</a></blockquote><p><a href="https://ismir.net/resources/research-centers/">Research Centers</a></p><h4>科研會議</h4><ul><li>International Society for Music Information Retrieval (<strong><em>ISMIR</em></strong>) <a href="https://www.ismir.net/"><em>https://www.ismir.net</em></a></li></ul><p><a href="https://www.ismir.net/">ISMIR - Home</a></p><ul><li>International Computer Music Association (<strong><em>ICMA</em></strong>) <a href="http://www.computermusic.org/"><em>http://www.computermusic.org</em></a></li></ul><p><a href="http://www.computermusic.org/">International Computer Music Association</a></p><ul><li>The International Conference on New Interfaces for Musical Expression (<strong><em>NIME</em></strong>) <a href="https://www.nime.org/"><em>https://www.nime.org</em></a></li></ul><p><a href="https://www.nime.org/">The International Conference on New Interfaces for Musical Expression</a></p><ul><li>世界音樂人工智能大會（SOMI） <a href="https://somi-ccom.com/"><em>https://somi-ccom.com</em></a> / <a href="https://www.zhihu.com/column/c_1436116468476387328"><em>https://www.zhihu.com/column/c_1436116468476387328</em></a></li></ul><p><a href="https://somi-ccom.com/">世界人工智能大会 SOMI</a></p><blockquote>聲音及音樂會議亦有不少，可見此頁：<a href="http://conferences.smcnetwork.org/">http://conferences.smcnetwork.org</a></blockquote><p><a href="http://conferences.smcnetwork.org/">Music Technology conference list</a></p><h4>香港學者</h4><ul><li>Andrew Horner @HKUST <a href="http://home.cse.ust.hk/~horner/"><em>http://home.cse.ust.hk/~horner/</em></a></li></ul><p><a href="http://home.cse.ust.hk/~horner/">Andrew Horner</a></p><ul><li>Christopher Keyes @HKBU <a href="https://sites.google.com/view/ckeyes"><em>https://sites.google.com/view/ckeyes</em></a></li></ul><p><a href="https://sites.google.com/view/ckeyes">keyesmusic</a></p><ul><li>Chuck-jee Chau @CUHK <a href="https://www.cse.cuhk.edu.hk/~chuckjee/"><em>https://www.cse.cuhk.edu.hk/~chuckjee/</em></a></li></ul><p><a href="https://www.cse.cuhk.edu.hk/~chuckjee/">chuckjee@cse</a></p><ul><li>Simon Lui @Huawei <a href="http://www.simonlui.com/"><em>http://www.simonlui.com</em></a></li></ul><p><a href="http://www.simonlui.com/">Dr. Simon Lui 雷兆恒</a></p><ul><li>Wai-man Szeto @CUHK <a href="https://www.oge.cuhk.edu.hk/index.php/en/overview/staff/dr-szeto-wai-man"><em>https://www.oge.cuhk.edu.hk/index.php/en/overview/staff/dr-szeto-wai-man</em></a></li></ul><p><a href="https://www.oge.cuhk.edu.hk/index.php/en/overview/staff/dr-szeto-wai-man">University General Education - Dr SZETO Wai Man</a></p><h4>參考教材</h4><ul><li>Python Notebooks for Fundamentals of Music Processing <a href="https://www.audiolabs-erlangen.de/FMP"><em>https://www.audiolabs-erlangen.de/FMP</em></a></li></ul><p><a href="https://www.audiolabs-erlangen.de/FMP">C0</a></p><ul><li>musicinformationretrieval.com <a href="https://musicinformationretrieval.com/"><em>https://musicinformationretrieval.com</em></a></li></ul><p><a href="https://musicinformationretrieval.com/">musicinformationretrieval.com</a></p><ul><li>Audio Content Analysis <a href="https://www.audiocontentanalysis.org/"><em>https://www.audiocontentanalysis.org</em></a></li></ul><p><a href="https://www.audiocontentanalysis.org/">audio content analysis</a></p><ul><li>Synth Cat 合成貓 <a href="https://www.facebook.com/Synth-Cat-%E5%90%88%E6%88%90%E8%B2%93-101620062614946/"><em>https://www.facebook.com/Synth-Cat-合成貓-101620062614946</em></a></li></ul><p><a href="https://www.facebook.com/Synth-Cat-%E5%90%88%E6%88%90%E8%B2%93-101620062614946/">Synth Cat 合成貓</a></p><ul><li>音樂科技網 <a href="https://musictech.tw/"><em>https://musictech.tw</em></a></li></ul><p><a href="https://musictech.tw/">音樂科技網</a></p><ul><li>无痛入门音乐科技<a href="https://github.com/beiciliang/intro2musictech"> <em>https://github.com/beiciliang/intro2musictech</em></a></li></ul><p><a href="https://github.com/beiciliang/intro2musictech">GitHub - beiciliang/intro2musictech: 公众号&quot;无痛入门音乐科技&quot;开源代码</a></p><ul><li>電腦音樂研究筆記 <a href="https://medium.com/computer-music-research-notes"><em>https://medium.com/computer-music-research-notes</em></a></li></ul><p><a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a></p><ul><li>JavaScript 音樂漫遊 — 30 天探索 Web Audio！ <a href="https://ithelp.ithome.com.tw/users/20111380/ironman/1783"><em>https://ithelp.ithome.com.tw/users/20111380/ironman/1783</em></a></li><li>120 Years of Electronic Music <a href="https://120years.net/"><em>https://120years.net</em></a></li></ul><p><a href="https://120years.net/">120 Years of Electronic Music</a></p><ul><li>CUHK AIST2010 Introduction to Computer Music （<em>也讓我自我宣傳一下） </em><a href="https://www.cse.cuhk.edu.hk/~chuckjee/aist2010/"><em>https://www.cse.cuhk.edu.hk/~chuckjee/aist2010/</em></a></li></ul><p><a href="https://www.cse.cuhk.edu.hk/~chuckjee/aist2010/">AIST2010 Introduction to Computer Music</a></p><h4>討論串</h4><ul><li>为什么我们总能听到计算机图形学，而很少听到计算机音频学之类的？ <a href="https://www.zhihu.com/question/302660504"><em>https://www.zhihu.com/question/302660504</em></a></li></ul><p><a href="https://www.zhihu.com/question/302660504">为什么我们总能听到计算机图形学，而很少听到计算机音频学之类的？</a></p><pre>以上內容以世界性或中文組織為主，如要增刪歡迎留言。</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a24260c9ae58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computer-music-research-notes/research-weblinks-a24260c9ae58">科研網站指南</a> was originally published in <a href="https://medium.com/computer-music-research-notes">電腦音樂研究筆記 Computer Music Research Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>