{"id":2231,"date":"2019-03-18T12:25:46","date_gmt":"2019-03-18T03:25:46","guid":{"rendered":"https:\/\/blog.criware.com\/?p=2231"},"modified":"2019-09-19T13:38:37","modified_gmt":"2019-09-19T04:38:37","slug":"responsive-engine-synthesis-with-adx2-and-ue4","status":"publish","type":"post","link":"https:\/\/blog.criware.com\/index.php\/2019\/03\/18\/responsive-engine-synthesis-with-adx2-and-ue4\/","title":{"rendered":"Responsive Engine Synthesis with ADX2 and UE4"},"content":{"rendered":"<h2 style=\"font-size: 150%; font-weight: bold;\">Introduction<\/h2>\n<p>One of the biggest differences between video games and more traditional sorts of linear media is the added level of interactivity. In most cases, we can account for this non-linearity by randomly playing back from a pool of samples, which helps to add variety and keeps the gameplay from feeling too repetitive. However, sometimes we need a much more nuanced control over our sound. Fortunately, ADX2 has some really powerful features which can be leveraged to fulfil this need.<\/p>\n<p>In this month\u2019s blog, we will look at crafting a motor sound in Atom Craft, and plugging it into UE4\u2019s Rolling Template to be controlled by the ball\u2019s velocity.<\/p>\n<div style=\"max-width: 800px; margin: 0 auto; margin-bottom: 20px;\">\n<div style=\"width: 800px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2231-1\" width=\"800\" height=\"450\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/rollingball-1.mp4?_=1\" \/><a href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/rollingball-1.mp4\">https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/rollingball-1.mp4<\/a><\/video><\/div>\n<\/div>\n<div style=\"text-align: center;\">\n<a style=\"display: inline-block; border: 1px solid #ccc; padding: 20px;\" href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/AtomCraft_1903_RollingBall.zip\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1813\" style=\"display: inline-block;\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2018\/06\/zip.png\" alt=\"zip\" width=\"80\" height=\"78\" \/><br \/>\nAtomCraft_1903_RollingBall.zip<br \/>\n<em>This project was created using CRI Atom Craft V3.40.07<\/em><br \/>\n<\/a><\/div>\n<p>&nbsp;<\/p>\n<h2 style=\"font-size: 150%; font-weight: bold;\">Atom Craft<\/h2>\n<p>The system that we need to make in Atom Craft is a straight-forward one. All we need is a looping material, which will provide a constant hum, and some AISAC curves to control the playback parameters of this loop. To get the Atom Craft project sorted we need to:<\/p>\n<ul>\n<li>Create a Polyphonic Cue and name it Cue_BallEngine<\/li>\n<li>Drag the loop onto the Cue, and it should be ready as is (the looped area is indicated by the transparent green block around the waveform in the Materials window)<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-1.png\" alt=\"6-1\" width=\"1651\" height=\"366\" class=\"alignnone size-full wp-image-2246\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-1.png 1651w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-1-300x67.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-1-768x170.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-1-1024x227.png 1024w\" sizes=\"auto, (max-width: 1651px) 100vw, 1651px\" \/><\/p>\n<li>Rename AisacControl_00 to AISAC_BallSpeed (for easy reference) under AISAC-Controls in the Project Tree<\/li>\n<li>Attach an AISAC curve to the loop track, and:\n<ul>\n<li>Set the <strong>Name<\/strong> to enginepitch<\/li>\n<li>Set the <strong>Control<\/strong> to AISAC_BallSpeed<\/li>\n<li>Tick <strong>Default Control Value<\/strong> and make sure it\u2019s set to 0<\/li>\n<\/ul>\n<\/li>\n<li>Right-click the enginepitch AISAC and:\n<ul>\n<li>Create Graph \u2192 <strong>Pitch<\/strong><\/li>\n<li>Set this curve approximately as below<\/li>\n<\/ul>\n<\/li>\n<li>Right-click the enginepitch AISAC again and:\n<ul>\n<li>Create Graph \u2192 Bandpass Filter \u2192 <strong>Bandpass Cutoff High<\/strong><\/li>\n<li>Set this curve approximately as below<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-2.png\" alt=\"6-2\" width=\"1518\" height=\"484\" class=\"alignnone size-full wp-image-2247\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-2.png 1518w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-2-300x96.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-2-768x245.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-2-1024x326.png 1024w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><\/p>\n<p>This can now be tested out in the Session Window. Since the Bandpass Cutoff starts all the down at 0, it is effectively acting as a volume control as well, so be sure to adjust the AISAC value to hear it after pushing play. The addition of just two effects makes for a much more responsive sound that can\u2019t easily be achieved with just sample playback alone. Once you are finished testing, you can finish off by building your CueSheet Binary.<br \/>\n&nbsp;<\/p>\n<h2 style=\"font-size: 150%; font-weight: bold;\">UE4<\/h2>\n<p><em>Integrating ADX2 into UE4 is a straight-forward process, and I recommend following the SDK documentation for this part as it is easy to follow and kept up-to-date. <\/em><\/p>\n<p>Since this effect is only being explored due to the consequence of interactivity, it makes sense to test it out within a game. We will use the Rolling Template included in UE4 since it is a really simple template with all the physics already set up. We just need to access these values and control our AISAC with them.<\/p>\n<p>For simplicity, we can create our script in the Physics Ball blueprint. This blueprint can be accessed from the Content Browser under Content \u2192 RollingBP \u2192 Blueprints \u2192 PhysicsBallBP. Taking a look around the blueprint, the only scripting that exists by default is for movement and jumping. The rest is up to us. To get started, we first need to:<\/p>\n<ol>\n<li>Create Cue_BallMovement Component in Components Tab, then in Details Tab\n<ul>\n<li>Set Sound to Cue_BallEngine<\/li>\n<li>Uncheck Auto Activate<\/li>\n<\/ul>\n<\/li>\n<li>Create 2 variables: DelayedValue, and DeltaTime<\/li>\n<\/ol>\n<p>Then we need to tell UE4 to:<\/p>\n<ol start=\"3\">\n<li>Play the Sound when the level starts<\/li>\n<li>Update the AISAC_BallSpeed <strong>Control Value<\/strong> every frame<\/li>\n<li>Get the value for the AISAC from the velocity of the Ball<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-3.png\" alt=\"6-3\" width=\"1914\" height=\"695\" class=\"alignnone size-full wp-image-2248\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-3.png 1914w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-3-300x109.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-3-768x279.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2019\/03\/6-3-1024x372.png 1024w\" sizes=\"auto, (max-width: 1914px) 100vw, 1914px\" \/><\/p>\n<p>Step 5 may look a little daunting, but I will break it down.<\/p>\n<p>The <strong>Get Physics Angular Velocity in Degrees <\/strong>Action is calculating how fast the ball is spinning, and outputting that value as a Vector. If you right-click this pin, you can tell it to <strong>Split Struct Pin<\/strong>, which instead outputs X, Y, and Z values. This is done so that all of the values can be added together to find the maximum velocity regardless of how the ball is spinning. This is also why the <strong>ABS<\/strong> (absolute float) action is used, which essentially just turns negative numbers into positive numbers.<\/p>\n<p>The last step involves the <strong>FInterp To <\/strong>action, which is simply smoothing the transition between values (interpolating) so that if the ball stops suddenly, the audio doesn\u2019t create sudden unwanted noise. It also helps to create a more natural feel. This does add a bit of latency, but with the right value, and the addition of an impact sound, it should be largely diminished. The<strong> Interp Speed <\/strong>pin controls how sensitive this process is, where higher values result in more abrupt transitions. The <strong>Target<\/strong> pin is receiving its value scaled down by 5000 since the AISAC responds to values between 0.0 and 1.0. This part is quite experimental, and a debug action can be used to determine what the output value is and how best to scale it. Play around with different <strong>Interp Speeds<\/strong> and <strong>Target<\/strong> scaling to hear the effects these have.<br \/>\n&nbsp;<\/p>\n<h2 style=\"font-size: 150%; font-weight: bold;\">Conclusion<\/h2>\n<p>Pitch control in ADX2 is a powerful feature that can offer more than just subtle variation to randomised sample playback. Used in the right way, pitch control can unlock new creative and interactive potential for your games. This could also just be one small part of a system, with scope to become even more impressive with additional layering and effects processing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction One of the biggest differences between video games and more traditional sorts of linear media is the added level<\/p>\n","protected":false},"author":2,"featured_media":2529,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-2231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-adx","category-tutorials"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/2231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/comments?post=2231"}],"version-history":[{"count":11,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/2231\/revisions"}],"predecessor-version":[{"id":2307,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/2231\/revisions\/2307"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media\/2529"}],"wp:attachment":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media?parent=2231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/categories?post=2231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/tags?post=2231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}