{"id":474,"date":"2020-03-26T08:21:19","date_gmt":"2020-03-25T23:21:19","guid":{"rendered":"https:\/\/machiaworx.net\/?p=474"},"modified":"2021-02-03T09:24:01","modified_gmt":"2021-02-03T00:24:01","slug":"gpusound%e5%85%a5%e9%96%80%ef%bc%88%ef%bc%93%ef%bc%89%e3%80%80%e3%82%b7%e3%83%b3%e3%82%bb%e3%82%b5%e3%82%a4%e3%82%b6%e3%83%bc%e9%83%a8%e5%88%86%e3%81%ae%e9%9f%b3%e8%89%b2%e3%81%84%e3%81%98%e3%82%8a","status":"publish","type":"post","link":"https:\/\/machiaworx.net\/?p=474","title":{"rendered":"GPUSound\u5165\u9580\uff08\uff13\uff09\u3000\u30b7\u30f3\u30bb\u30b5\u30a4\u30b6\u30fc\u90e8\u5206\u306e\u97f3\u8272\u3044\u3058\u308a"},"content":{"rendered":"<p>### \u97f3\u91cf\u5909\u66f4\uff08Amp\/\u30a8\u30f3\u30d9\u30ed\u30fc\u30d7\uff09<\/p>\n<p>&#8220;` GLSL:SampleCode<br \/>\nvec2 mainSound( float time )<br \/>\n{<br \/>\n\/\/ A 440 Hz wave that attenuates quickly overt time<br \/>\nreturn vec2( sin(6.2831*440.0*time)*exp(-3.0*time) );<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>\u524d\u56de\u6642\u70b9\u3067\u30b5\u30a4\u30f3\u6ce2\u306e\u51fa\u529b\u306f\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3053\u306b\u767a\u97f3\u5f8c\u3001\u6301\u7d9a\u6642\u3084\u51fa\u59cb\u3081\u306e\u97f3\u91cf\u306e\u63a8\u79fb\u3092\u3082\u3063\u3066\u3088\u308a\u697d\u5668\u3063\u307d\u304f\u97f3\u304c\u9cf4\u308a\u307e\u3059\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u65b9\u6cd5\u3092\u3044\u304f\u3064\u304b\u8a18\u8f09\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u524d\u56de\u51fa\u3066\u304d\u305fexp\u95a2\u6570\u306e\u5f79\u5272\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>exp\u95a2\u6570\u306f\u3001\u3044\u308f\u3086\u308b\u300ce^x\u300d\u306e\u3053\u3068\u3067\u3059\u306d\u3002<br \/>\n\u5bfe\u6570\u30b0\u30e9\u30d5\u306f\u3044\u3044\u8cc7\u6599\u304c\u3042\u3063\u305f\u306e\u3067\u3053\u3063\u3061\u3092\u5fa1\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n\uff08Google\u3055\u3093\u3084\u3063\u3066\u304f\u308c\u308b\u308f\uff09<\/p>\n<p>https:\/\/www.google.co.jp\/search?source=hp&#038;ei=JJUJXKOSBYmN8wX2uLTgAw&#038;q=e%5Ex&#038;btnK=Google+%E6%A4%9C%E7%B4%A2&#038;oq=e%5Ex&#038;gs_l=psy-ab.3..0l8.483.2011..4197&#8230;0.0..0.75.280.4&#8230;&#8230;0&#8230;.1..gws-wiz&#8230;..0..0i4j0i131i4j0i131.Z8kLYDyRmdI<\/p>\n<p>\u30b3\u30ec\u898b\u3066\u5206\u304b\u308b\u306e\u306f\u3001\u300c\u30de\u30a4\u30ca\u30b9\u306e\u5024\u306b\u884c\u304f\u307b\u30690\u306b\u53ce\u675f\u3057\u3066\u3044\u304f\u300d\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<br \/>\n\u3088\u3063\u3066\u3001\u3053\u306e\u30b0\u30e9\u30d5\u306f\u5de5\u592b\u3059\u308b\u3053\u3068\u3067\u30c7\u30fc\u30bf\u3092\u53ce\u675f\u3055\u305b\u308b\u306e\u306b\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u5236\u5fa1\u306b\u3064\u3044\u3066\u306f\u3001\u300c\u6642\u9593\u304c\u7d4c\u904e\u3059\u308b\u307b\u3069\u3053\u306e\u30b0\u30e9\u30d5\u306e\u30de\u30a4\u30ca\u30b9\u90e8\u5206\u306b\u9032\u3093\u3067\u3044\u304f\u300d\u3068\u3044\u3046\u5f62\u306b\u3059\u308c\u3070\u3001\u5024\u306f\u6b63\u306e\u5024\u3092\u53d6\u308a\u3064\u30640\u306b\u8fd1\u3065\u3044\u3066\u3044\u304f\u3068\u3044\u3046\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u5024\u3092\u6e1b\u8870\u3055\u305b\u308b\u306e\u306b\u3068\u3063\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002<br \/>\n\u3042\u3068\u3001x=0\u306e\u3068\u304d\u3001e^x = 1\u306a\u306e\u3067\u3001\u500d\u6570\u306b\u3059\u308b\u306e\u306b\u4fbf\u5229\u3067\u3059\u3002\uff08\u5143\u306e\u6570\u3092\u53c2\u7167\u3067\u304d\u308b\uff09<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3067\u6e1b\u8870\u3092\u8868\u73fe\u3057\u305f\u306e\u304c\u4e0a\u8a18SampleCode\u306eext\u95a2\u6570\u90e8\u5206\u306a\u3093\u3067\u3059\u306d\u3002<br \/>\n\u540c\u3058\u8003\u3048\u3067\u3001\u5f90\u3005\u306b\u97f3\u91cf\u304c\u4e0a\u304c\u3063\u3066\u3044\u304f\u5f62\u306b\u3059\u308b\u306b\u306f\u300c\u7279\u5b9a\u306e\u5024\u306b\u53ce\u675f\u3057\u3066\u3044\u304f\u300d\u5f0f\u3092\u5f53\u3066\u306f\u3081\u308c\u3070\u3044\u3044\u3093\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u9762\u5012\u306a\u306e\u3067\u3001\u305d\u306e\u307e\u307eexp\u95a2\u6570\u3092\u4f7f\u3044\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u7121\u9650\u306b\u5024\u304c\u5897\u52a0\u3057\u3066\u3044\u304f\u305f\u3081\u3001clamp\u95a2\u6570\u3067\u5024\u306e\u7bc4\u56f2\u3092\u6307\u5b9a\u3059\u308b\u5f62\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u30a2\u30bf\u30c3\u30af\u30fb\u30ea\u30ea\u30fc\u30b9\uff08\u30c7\u30a3\u30b1\u30a4\u304b\u306a\uff1f\uff09\u3092\u3086\u308b\u304f\u30d5\u30a7\u30fc\u30c9\u3055\u305b\u305f\u306e\u304c\u4e0b\u8a18\u30bd\u30fc\u30b9\u3067\u3059\u3002<\/p>\n<p>&#8220;` GLSL:SampleCode3<br \/>\nvec2 mainSound( float time )<br \/>\n{<br \/>\n\/\/ A 440 Hz wave that attenuates quickly overt time<br \/>\nreturn vec2( sin(6.2831*440.0*time)<br \/>\n*clamp(exp(time)-1.,0.0,1.0)<br \/>\n*exp(-time)<br \/>\n);<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u97f3\u3092\u4f5c\u308a\u8fbc\u3093\u3067\u3044\u3051\u3070\u3001\u30b7\u30f3\u30bb\u30b5\u30a4\u30b6\u30fc\u306e\u97f3\u306f\u3069\u3046\u306b\u304b\u306a\u308a\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>### \u306e\u3053\u304e\u308a\u6ce2<\/p>\n<p>\u3042\u3068\u30b5\u30a4\u30f3\u6ce2\u3060\u3051\u3058\u3083\u7269\u8db3\u308a\u306a\u3044\u306e\u3067\u3001\u4ed6\u306e\u6ce2\u5f62\u3082\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u53c2\u8003\u8cc7\u6599\u304c\u3042\u3063\u305f\u306e\u3067\u9023\u643a\u3002<br \/>\nhttp:\/\/www.graffathon.fi\/2016\/presentations\/additive_slides.pdf<\/p>\n<p>\u3069\u3061\u3089\u304b\u3068\u8a00\u3046\u3068\u306e\u3053\u304e\u308a\u6ce2\u5f62\u306a\u611f\u3058\u3002<\/p>\n<p>&#8220;` GLSL:SampleCode_SAW<br \/>\n#define PI 3.14159<\/p>\n<p>float saw(float phase) {<br \/>\nfloat s = 0.0;<br \/>\nfor (int k = 1; k &lt;= 8; k++) {<br \/>\ns += (sin(2.0*PI*float(k)*phase) \/ float(k));<br \/>\n}<br \/>\nreturn (1.0\/2.0) &#8211; (1.0\/PI)*s &#8211; 0.5;<br \/>\n}<\/p>\n<p>vec2 mainSound( float time )<br \/>\n{<br \/>\n\/\/ FM\u97f3\u6e90<br \/>\nreturn vec2( saw(time*440.0) *exp(-3.*time) );<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>\u4ed6\u306b\u306f\u4e09\u89d2\u6ce2\u3092\u30b5\u30a4\u30f3\u6ce2\u3060\u3051\u3067\u4f5c\u308b\u8cc7\u6599\u3068\u304b\u3002<br \/>\n\u7121\u9650\u30d5\u30fc\u30ea\u30a8\u7d1a\u6570\u306e\u5f0f\u3092\u3053\u3063\u3061\u306b\u66f8\u3044\u3066\u3044\u304f\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>https:\/\/ja.wikipedia.org\/wiki\/%E4%B8%89%E8%A7%92%E6%B3%A2_(%E6%B3%A2%E5%BD%A2)<\/p>\n<p>\u3082\u3063\u3068\u8a08\u7b97\u3092\u5358\u7d14\u306b\u3057\u3066\u3082\u3044\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u307e\u305a\u306f\u6b63\u78ba\u306a\u5f0f\u3092\u66f8\u3044\u3066\u305d\u3063\u304b\u3089\u5358\u7d14\u5316\u3057\u3066\u3044\u304f\u3068\u5f62\u3092\u7dad\u6301\u3057\u3084\u3059\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u77e9\u5f62\u3068\u304b\u3059\u3052\u3048\u7c21\u5358\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3057\u306d\u30fb\u30fb\u30fb<\/p>\n<p>### FM\u97f3\u6e90<\/p>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u30aa\u30fc\u30eb\u30c9\u30ed\u30de\u30f3\u6ea2\u308c\u308bFM\u97f3\u6e90\u3082\u5b9f\u88c5\u3055\u305b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\uff08\u3044\u3084FM8\u3068\u304b\u3067\u73fe\u5f79\u306a\u306e\u308f\u304b\u308a\u307e\u3059\u3051\u3069\u81ea\u5206\u304cFM\u97f3\u6e90\u3068\u805e\u3044\u3066\u30ac\u30ec\u30c3\u30ac\u3068\u304b\u601d\u3044\u6d6e\u304b\u3079\u308b\u306e\u3067\u30fb\u30fb\u30fb\uff09<\/p>\n<p>FM\u97f3\u6e90\u306b\u3064\u3044\u3066\u306f\u4e0b\u8a18URL\u53c2\u7167\u3002<br \/>\nhttps:\/\/ja.wikipedia.org\/wiki\/FM%E9%9F%B3%E6%BA%90<\/p>\n<p>\u3064\u307e\u308a\u30b5\u30a4\u30f3\u6ce2\u3092\u5b9a\u7fa9\u3059\u308b\u6ce2\u5f62\u306e\u5468\u671f\u3092\u66f4\u306b\u30b5\u30a4\u30f3\u6ce2\u3067\u632f\u52d5\u3055\u305b\u308b\u3053\u3068\u3067\u3001<br \/>\n\u97f3\u3092\u30b0\u30ef\u30f3\u30b0\u30ef\u30f3\u63fa\u3089\u3059\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u5b9f\u969b\u306eFM\u97f3\u6e90\u3067\u306f\u66f4\u306b\u4e26\u5217\u306b\u3057\u305f\u308a\u591a\u91cd\u3067\u5909\u8abf\u304b\u3051\u305f\u308a\u3057\u307e\u3059\u304c\u3001<br \/>\n\u307e\u305a\u306f\u30ad\u30e3\u30ea\u30a2-\u30e2\u30b8\u30e5\u30ec\u30fc\u30bf1\u7d44\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3002<br \/>\na * sin( 2*PI*fa*time + b * sin(2*PI*fb*time) )<\/p>\n<p>a : \u632f\u5e45<br \/>\nfa: \u30ad\u30e3\u30ea\u30a2\uff08\u57fa\u6e96\u306b\u306a\u308b\u767a\u632f\u5668\uff09\u306e\u5468\u6ce2\u6570<br \/>\nb : \u5909\u8abf\u6307\u6570\uff08\u9069\u5f53\u306b\u6c7a\u3081\u308b\u30e4\u30c4\uff09<br \/>\nfb: \u30e2\u30b8\u30e5\u30ec\u30fc\u30bf\uff08\u30ad\u30e3\u30ea\u30a2\u3092\u63fa\u3089\u3059\u767a\u632f\u5668\uff09\u306e\u5468\u6ce2\u6570<\/p>\n<p>\u3053\u308c\u3092\u5c11\u3057\u6574\u3048\u3066\u307f\u308b\u3068\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&#8220;` GLSL:SampleCode_FM<br \/>\nvec2 mainSound( float time )<br \/>\n{<br \/>\n\/\/ FM\u97f3\u6e90<br \/>\nreturn vec2( sin(6.2831*440.0*time<br \/>\n+4.0* sin(6.2831*220.0*time))<br \/>\n*exp(-3.*time)<br \/>\n);<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>FM\u97f3\u6e90\u3082\u7406\u8ad6\u304c\u5206\u304b\u308b\u3068\u7d50\u69cb\u30b3\u30f3\u30d1\u30af\u30c8\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u30d5\u30a3\u30fc\u30c9\u30d0\u30c3\u30af\u3068\u304b\u306f\u5225\u9014\u51e6\u7406\u66f8\u304b\u306a\u304d\u3083\u3044\u3051\u306a\u3044\u3067\u3059\u3051\u3069\u3002<\/p>\n<p>### \u7d42\u308f\u308a<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u97f3\u8272\u306e\u8aac\u660e\u306f\u6700\u4f4e\u9650\u3053\u308c\u304c\u3042\u308c\u3070\u56f0\u3089\u306d\u3048\u3060\u308d\u3046\u3068\u3044\u3046\u306e\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3067\u30d9\u30fc\u30b9\u30fb\u30e1\u30ed\u30c7\u30a3\u30fb\u30d1\u30c3\u30c9\u7b49\u66f8\u3051\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u30c9\u30e9\u30e0\u3068\u304b\u5fc5\u8981\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<br \/>\n\u3053\u308c\u306f\u5225\u9805\u76ee\u3067\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### \u97f3\u91cf\u5909\u66f4\uff08Amp\/\u30a8\u30f3\u30d9\u30ed\u30fc\u30d7\uff09 &#8220;` GLSL:SampleCode vec2 mainSound( float time ) { \/\/ A 440 Hz wave that attenuates &hellip; <span class=\"clear\"><\/span><a href=\"https:\/\/machiaworx.net\/?p=474\" class=\"more-link read-more\" rel=\"bookmark\"><span class=\"screen-reader-text\">GPUSound\u5165\u9580\uff08\uff13\uff09\u3000\u30b7\u30f3\u30bb\u30b5\u30a4\u30b6\u30fc\u90e8\u5206\u306e\u97f3\u8272\u3044\u3058\u308a<\/span><i class=\"fa fa-arrow-right\"><\/i> \u306e\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,15,19,4],"tags":[],"class_list":["post-474","post","type-post","status-publish","format-standard","hentry","category-synth-dev","category-gpu","category-demoscene","category-pgm"],"_links":{"self":[{"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/posts\/474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/machiaworx.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=474"}],"version-history":[{"count":1,"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/posts\/474\/revisions"}],"predecessor-version":[{"id":475,"href":"https:\/\/machiaworx.net\/index.php?rest_route=\/wp\/v2\/posts\/474\/revisions\/475"}],"wp:attachment":[{"href":"https:\/\/machiaworx.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/machiaworx.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/machiaworx.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}