{"id":4454,"date":"2023-07-05T17:05:16","date_gmt":"2023-07-05T08:05:16","guid":{"rendered":"https:\/\/blog.criware.com\/?p=4454"},"modified":"2023-07-05T17:05:16","modified_gmt":"2023-07-05T08:05:16","slug":"generative-ambient-music","status":"publish","type":"post","link":"https:\/\/blog.criware.com\/index.php\/2023\/07\/05\/generative-ambient-music\/","title":{"rendered":"Generative Ambient Music"},"content":{"rendered":"<p>Background music can often be heard for hours while playing a game. To fight repetitiveness and avoid player fatigue, generative music techniques can be used. In this post, we will design a basic generative system using Atom Craft. \u00a0In this implementation, all the notes will be dynamically generated out of selected scales.<\/p>\n<div class=\"wp-video\" style=\"width: 800px; display: block; margin: 40px auto;\">\n<div style=\"width: 800px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-4454-1\" width=\"800\" height=\"422\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/Video_GenerativeAmbientMusic.mp4?_=1\" \/><a href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/Video_GenerativeAmbientMusic.mp4\">https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/Video_GenerativeAmbientMusic.mp4<\/a><\/video><\/div>\n<\/div>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">Assets Creation<\/h2>\n<p>First, we will create two types of instrumental sounds: long synth pads for the ambient bed, on top of which shorter notes (e.g., plucked strings or mallet percussions) will be played. In both cases, it is recommended to apply a long delay or a pronounced reverb effect, so that the sounds have a long tail, making it easier to blend them together. Of course, it does not have to be baked at this stage, and can also be done by using Atom Craft\u2019s own effects later.<\/p>\n<p>The main idea is to pick some interesting scales for the mood of your game, and then generate single notes following these scales. In Atom Craft, the scales will be played in a random order and the notes will be adjusted accordingly. Let\u2019s prepare our assets:<\/p>\n<ul>\n<li>Choose a set of scales (4 in our case, but it can be more)<\/li>\n<li>From each scale, play 5 single notes lasting 1 or 2 bars with the long synth pads.<\/li>\n<li>Then, on the same scales, play 8 single notes with the short sound.<\/li>\n<li>Edit and export all notes individually, then import everything in Atom Craft.<\/li>\n<\/ul>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">Implementation<\/h2>\n<p>It is now time to start the implementation in Atom Craft.<\/p>\n<ul>\n<li>Create 4 <strong>Random no Repeat Cues<\/strong> (one for each of our 4 scales) for the pad sounds.<\/li>\n<li>Do the same for the short notes.<\/li>\n<li>Drag and drop all the Materials (pads and shorter notes) on their respective Cues.<\/li>\n<li>Create an extra track in each Cue and leave it empty. Playing a silence now and then will help us generate rhythmic variations.<\/li>\n<li>In the <strong>Inspector<\/strong>, simply change the <em>Random Weight<\/em> for that track to 90.<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/01-RandomNoReapetCues.png\" alt=\"01 RandomNoReapetCues\" width=\"1590\" height=\"665\" class=\"alignnone size-full wp-image-4455\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/01-RandomNoReapetCues.png 1590w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/01-RandomNoReapetCues-300x125.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/01-RandomNoReapetCues-768x321.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/01-RandomNoReapetCues-1024x428.png 1024w\" sizes=\"auto, (max-width: 1590px) 100vw, 1590px\" \/>\n<\/p>\n<p>The long note Cues are used to set up the tempo on which the notes will be triggered:<\/p>\n<ul>\n<li>Create a <strong>BeatSync parameter<\/strong> at the start of these four Cues.<\/li>\n<li>For all of them, change the <em>BPM<\/em> to 150 and the <em>Numerator<\/em> to 8.<\/li>\n<li>Then, disable two beats of the Beat Pattern of each Cue (different ones).<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/02-BeatSync.png\" alt=\"02 BeatSync\" width=\"1059\" height=\"699\" class=\"alignnone size-full wp-image-4458\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/02-BeatSync.png 1059w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/02-BeatSync-300x198.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/02-BeatSync-768x507.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/02-BeatSync-1024x676.png 1024w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<p>In order to trigger the notes in sync with the tempo, an <strong>Action<\/strong> must be used instead of a regular Cue:<\/p>\n<ul>\n<li>Create 8 new <strong>Polyphonic<\/strong> Cues (4 long notes and 4 short notes).<\/li>\n<li>Insert an <strong>Action Track<\/strong> and then add a <strong>Start Action<\/strong> at the beginning of the Cues.<\/li>\n<li>Link the actions to your note Cues by dragging and dropping them onto the Action tracks.<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/03-Action-Track.png\" alt=\"03 Action Track\" width=\"770\" height=\"359\" class=\"alignnone size-full wp-image-4459\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/03-Action-Track.png 770w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/03-Action-Track-300x140.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/03-Action-Track-768x358.png 768w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/>\n<\/p>\n<p>Finally, a global Cue will be used to trigger all the Actions:<\/p>\n<ul>\n<li>Create a <strong>Polyphonic Cue<\/strong> called Sequence. Change its <strong>Time Base settings<\/strong> to <em>Bars\/Beats<\/em> at <em>150 BPM<\/em>.<\/li>\n<li>Create 4 Blocks with 13 bars, corresponding to our 4 scales.<\/li>\n<li>Set the <em>Block Transition Destination Type<\/em> property to <em>Specify Block Transition<\/em>, and change its <em>Specification Type<\/em> to <em>Random No Repeat<\/em>.<\/li>\n<li>Add all the Blocks to the <em>List of Block Transition Destinations<\/em> so that each Block can randomly transition to any other Block.<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/04-Blocks.png\" alt=\"04 Blocks\" width=\"1411\" height=\"617\" class=\"alignnone size-full wp-image-4461\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/04-Blocks.png 1411w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/04-Blocks-300x131.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/04-Blocks-768x336.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/04-Blocks-1024x448.png 1024w\" sizes=\"auto, (max-width: 1411px) 100vw, 1411px\" \/>\n<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Create two tracks, one for the long notes and the other for the short notes.<\/li>\n<li>Drag and drop the Action Cues on their respective tracks at the beginning of each Block. This will create <strong>Link Cues<\/strong>.<\/li>\n<li>In order for the notes to be triggered several times, in each block set the <em>Auto Repeat Number<\/em> property to -1 in all Link Cues (for infinite repetition).<\/li>\n<li>Change the <em>Auto Repeat Interval<\/em> to 2300 for the long notes, and to 1000 for the short ones. These values don\u2019t have to be very precise, as the BeatSync parameter will force the notes to be triggered on the next beat anyway.<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/05-Cue-Links.png\" alt=\"05 Cue Links\" width=\"1561\" height=\"552\" class=\"alignnone size-full wp-image-4462\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/05-Cue-Links.png 1561w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/05-Cue-Links-300x106.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/05-Cue-Links-768x272.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/05-Cue-Links-1024x362.png 1024w\" sizes=\"auto, (max-width: 1561px) 100vw, 1561px\" \/>\n<\/p>\n<p>And that\u2019s it! Once the Sequence Cue is triggered, the long notes will be played, generating chords against which the short notes will play, using the same scale. In its current state, the system can generate out-of-tune sounds during the transitions. If that is something you want to avoid, it can be fixed by adding more specific Block Transitions when switching from one scale to another. The project below should give you a good starting point for experimenting and creating more complicated generative music systems.<\/p>\n<p>&nbsp;<\/p>\n<div style=\"max-width: 800px; margin: 0 auto; margin-bottom: 20px; text-align: center;\"><a style=\"display: block; border: 1px solid #ccc; padding: 20px; max-width: 100%; margin: 0 auto;\" href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2023\/07\/AtomCraft_Project_GenerativeAmbientMusic.zip\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1813\" style=\"display: block; margin: 0 auto;\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2018\/06\/zip.png\" alt=\"zip\" width=\"80\" height=\"78\" \/>AtomCraft_Project_GenerativeAmbientMusic<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Background music can often be heard for hours while playing a game. To fight repetitiveness and avoid player fatigue, generative<\/p>\n","protected":false},"author":2,"featured_media":5410,"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-4454","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\/4454","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=4454"}],"version-history":[{"count":9,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/4454\/revisions"}],"predecessor-version":[{"id":5419,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/4454\/revisions\/5419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media\/5410"}],"wp:attachment":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media?parent=4454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/categories?post=4454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/tags?post=4454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}