{"id":416,"date":"2024-07-22T23:06:27","date_gmt":"2024-07-22T23:06:27","guid":{"rendered":"https:\/\/www.julien-nevo.com\/arkostracker\/?page_id=416"},"modified":"2025-09-29T13:04:40","modified_gmt":"2025-09-29T11:04:40","slug":"events","status":"publish","type":"page","link":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/events\/","title":{"rendered":"Events"},"content":{"rendered":"\n<p>Events are &#8220;signals&#8221; written at specific moments in your song, which the player can detect. As explained <a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/the-pattern-viewer#event-tracks\" data-type=\"page\" data-id=\"133\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>, this is useful to synchronize your production with a music without the coder having to count the frames. A demo can be music-driven!<\/p>\n\n\n\n<p>Events are an 8-bit integer from 0 to 255 (<code>FF<\/code> in hex). What it means is up to you. You could simply use <code>01<\/code> and say to the coder &#8220;<code>01<\/code>, or any other number, means the demo moves forward&#8221;. Or something more sophisticated like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>01<\/code> means the colors must flash.<\/li>\n\n\n\n<li><code>02<\/code> means the screen must wobble.<\/li>\n\n\n\n<li><code>03<\/code> means the dots effect must start.<\/li>\n\n\n\n<li><code>04<\/code> means the 3D effect must start&#8221;.<\/li>\n<\/ul>\n\n\n\n<p>This is entirely up to you to know what these numbers mean.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Samples\/digidrums can also be triggered by using events. It is&nbsp;<strong>strongly<\/strong>&nbsp;advised to use the events from the top numbers (FF) and going downwards to avoid clashing with the sample numbering.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Writing events<\/h2>\n\n\n\n<p>This is explained in the <a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/the-pattern-viewer#event-tracks\">aforementioned<\/a> page, but here is a summary. At any times in event tracks, write a number between <code>01<\/code> and <code>FF<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"30\" height=\"182\" src=\"https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/07\/eventColumn.png\" alt=\"\" class=\"wp-image-407\"\/><\/figure>\n\n\n\n<p>Nothing happens in AT when writing these, unless they match <a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/the-pattern-viewer#event-samples\" data-type=\"page\" data-id=\"133\" target=\"_blank\" rel=\"noreferrer noopener\">sample instruments<\/a>. Only the players on the hardware can receive and interpret these.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Receiving events<\/h2>\n\n\n\n<p>This is where this get technical. Not all players can naturally handle events. AKG does, but AKM and AKY does <strong>not<\/strong>. Don&#8217;t worry, there is a trick for it explained <a href=\"#exporting-events\">below<\/a>.<\/p>\n\n\n\n<p>Export the song as you would normally do. It contains the events within its data.<\/p>\n\n\n\n<p>In your assembly code (Z80 for example), play the song normally as it is done in the testers provided in the package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    ;Main loop. I suppose this runs at 50 Hz.\n    call PLY_AKG_Play\n    \n    ;Is there any event? 0 means \"no effect\".\n    ld a,(PLY_AKG_Event)\n    or a\n    jr z,NoEvents\n\n    ;Ah, there is an event!\n    cp 1\n    jr z,FlashColor\n    cp 2\n    jr z,WobbleScreen\n    ;... and so on.\n\nNoEvents\n    ;Continue your main code here...<\/code><\/pre>\n\n\n\n<p>This is only a raw code but it is a starting point (if you handle many events, it would be better to have a pointer table and jump directly on the code instead of chaining many CPs, but optimization is not the purpose of this tutorial!).<\/p>\n\n\n\n<p>This is it if you use the AKG player. If using any other player, you might be embarrassed as none supports events directly. Read on&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"exporting-events\">Exporting events<\/h2>\n\n\n\n<p>If not using AKG player, you will have to handle the events by yourself. Don&#8217;t worry it is easy. Also, the AKY <a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/digidrums\/\" data-type=\"page\" data-id=\"2543\" target=\"_blank\" rel=\"noreferrer noopener\">digidrums player<\/a> include a parser of such events, so you can rip its code.<\/p>\n\n\n\n<p>Let&#8217;s pretend that your events were written as this in your song (with a speed of <code>06<\/code>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"40\" height=\"567\" src=\"https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/events2.png\" alt=\"\" class=\"wp-image-1283\"\/><\/figure>\n\n\n\n<p>First of all, export the events. Go to File > Export > Export events. A dialog opens.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"800\" height=\"1020\" src=\"https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents.png\" alt=\"\" class=\"wp-image-1282\" srcset=\"https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents.png 800w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-235x300.png 235w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-768x979.png 768w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-500x638.png 500w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-230x293.png 230w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-350x446.png 350w, https:\/\/www.julien-nevo.com\/arkostracker\/wp-content\/uploads\/2024\/10\/exportEvents-480x612.png 480w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p> For our example, make sure that the source profile is Z80, and source.<\/p>\n\n\n\n<p>The &#8220;Export all events&#8221; drop-down allows you to filter among events:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>all events<\/li>\n\n\n\n<li>events not related to samples (the events <strong>not<\/strong> matching sample instruments)<\/li>\n\n\n\n<li>events related to sample (the events matching sample instruments).<\/li>\n<\/ul>\n\n\n\n<p>In our case, &#8220;events not related to samples&#8221; is fine, but since you don&#8217;t have samples, &#8220;all events&#8221; will work as well.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The &#8220;events related to samples&#8221; choice is especially useful when wanting to play digidrums, as explained <a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/digidrums\/\" data-type=\"page\" data-id=\"2543\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<p>Then press <strong>Export<\/strong>.<\/p>\n\n\n\n<p>A Z80 source code is generated. Let&#8217;s look at it (this example has been cleaned of some comments and labels for cleanliness):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>; Events generated by Arkos Tracker 3.\n\nMainEvents\n\nMainEvents_Loop\n    dw 1    ; Wait for 0 frames.\n    db 1\n\n    dw 42    ; Wait for 41 frames.\n    db 2\n\n    dw 42    ; Wait for 41 frames.\n    db 1\n\n    dw 36    ; Wait for 35 frames.\n    db 3\n\n    dw 54    ; Wait for 53 frames.\n    db 4\n\n    dw 42    ; Wait for 41 frames.\n    db 5\n\n    dw 168    ; Wait for 167 frames.\n    db 0\n\n    dw 0    ; End of sequence.\n    dw MainEvents_Loop    ; Loops here.<\/code><\/pre>\n\n\n\n<p>This is pretty straightforward. It is only a list of pair of values:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, a 16-bit number representing <em>how many frames to wait -1<\/em>:\n<ul class=\"wp-block-list\">\n<li>50 means wait for 49 frames before reading the event number.<\/li>\n\n\n\n<li>49 means wait for 48 frames before reading the event number.<\/li>\n\n\n\n<li>&#8230;<\/li>\n\n\n\n<li>2 means wait for 1 frame before reading the event number.<\/li>\n\n\n\n<li>1 means &#8220;don&#8217;t wait&#8221;: read the event.<\/li>\n\n\n\n<li>0 means &#8220;end of list&#8221;, followed by the address where to loop to. Continue the parsing.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Then, a 8-bit integer of the event number. If 0, it means <em>no event<\/em>, simply continues the parsing.<\/li>\n<\/ul>\n\n\n\n<p>After reading a valid event (&gt;0), you can stop the parsing for this frame.<\/p>\n\n\n\n<p>In the unlikely event that more than 65535 frames must be waited, and thus a 16-bit number is not enough, then more than one wait is encoded, with an event number of 0 (meaning <em>no event, continue parsing<\/em>). There is actually no special code to perform if you followed the rules described above.<\/p>\n\n\n\n<p>You can check the digidrum players which interpret them, if you don&#8217;t want to create the code on your own.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Events are &#8220;signals&#8221; written at specific moments in your song, which the player can detect. As explained here, this is useful to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":185,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"class_list":["post-416","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/comments?post=416"}],"version-history":[{"count":19,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/416\/revisions"}],"predecessor-version":[{"id":2900,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/416\/revisions\/2900"}],"wp:attachment":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/media?parent=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}