{"id":208,"date":"2016-04-19T12:55:12","date_gmt":"2016-04-19T12:55:12","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=208"},"modified":"2016-04-19T12:59:47","modified_gmt":"2016-04-19T12:59:47","slug":"motifs-and-transformations","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2016\/04\/19\/motifs-and-transformations\/","title":{"rendered":"Motifs and Transformations"},"content":{"rendered":"<p>One of the creative approaches to synthesizing music is to start with a short <strong><em>melodic motif<\/em><\/strong> and then apply various <em><strong>transformations<\/strong><\/em> on it. The motif is usually (but not necessarily) of 1 bar duration.<\/p>\n<p>What are some possible transformations? This depends on one\u2019s creativity, but here is a simple list:<\/p>\n<p style=\"padding-left: 30px;\"><strong>1) Identity transformation:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Do nothing on the input, just return it as it is.<\/p>\n<p style=\"padding-left: 30px;\"><strong>2) Augmentation:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Increase the duration of each note by a factor two (or four, etc.), so it plays slower. The pitches are not disturbed.<\/p>\n<p style=\"padding-left: 30px;\"><strong>3) Diminution:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Reduce the duration of each note by a factor two (or four, etc.), so it plays faster. The pitches are not disturbed.<\/p>\n<p style=\"padding-left: 30px;\"><strong>4) Replace a pitch with another:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Replace one of the pitches with another pitch, randomly.<\/p>\n<p style=\"padding-left: 30px;\"><strong>5) Swap two pitches:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Swap randomly chosen two pitches.<\/p>\n<p style=\"padding-left: 30px;\"><strong>5) Replace a pitch with rest:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Silence a pitch, chosen at random. The total duration is not altered.<\/p>\n<p style=\"padding-left: 30px;\"><strong>6) Sort the pitches in ascending order:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Reorder the pitches in the motif so that they are in ascending order of pitch values.<\/p>\n<p style=\"padding-left: 30px;\"><strong>7) Sort the pitches in descending order:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Reorder the pitches in the motif so that they are in descending order of pitch values.<\/p>\n<p style=\"padding-left: 30px;\"><strong>8) Reverse the pitches:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Reverse the order of pitches in the motif.<\/p>\n<p style=\"padding-left: 30px;\"><strong>9) Shuffle the pitches:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Shuffle the pitches randomly.<\/p>\n<p style=\"padding-left: 30px;\"><strong>10) Shuffle the durations:<\/strong><\/p>\n<p style=\"padding-left: 60px;\">Keeping the order of pitches the same, randomly shuffle the lengths.<\/p>\n<p>The above are just a few possibilities. I am sure you can think of a few more.<\/p>\n<p><strong>How to apply the transformations?<\/strong><\/p>\n<p>When we apply a sequence of transformations starting from the given motif, there are at least two ways to go about it. One is to apply the transformations sequentially on the <em>same input<\/em> that we started with. The other is to apply the <em>first transformation<\/em> on the <em>given input<\/em>, and then onwards, apply each transformation on the <em>result of the previous transformation<\/em>. Some transformations can yield interesting results when we use the second approach; for example, consider transformation (5). This will result in increasing number of rests as the transformations progress, because in each transformation we replace one pitch by rest. In general, we can choose the strategy that suits us best in a given context.<\/p>\n<p>For today\u2019s post, I have implemented the different transformations as well as the two transformation strategies explained above. I have also defined a sample score using these ideas in <a href=\"https:\/\/opusmodus.com\" target=\"_blank\">Opusmodus<\/a>.<\/p>\n<figure id=\"attachment_210\" aria-describedby=\"caption-attachment-210\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png\" rel=\"attachment wp-att-210\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"210\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2016\/04\/19\/motifs-and-transformations\/motifs-and-transformations\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png\" data-orig-size=\"876,1104\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Motifs and transformations\" data-image-description=\"&lt;p&gt;Motifs and transformations&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Motifs and transformations&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations-813x1024.png\" class=\"wp-image-210\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png?resize=700%2C882\" alt=\"Motifs and transformations\" width=\"700\" height=\"882\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png?w=876&amp;ssl=1 876w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png?resize=238%2C300&amp;ssl=1 238w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png?resize=768%2C968&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/04\/Motifs-and-transformations.png?resize=813%2C1024&amp;ssl=1 813w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-210\" class=\"wp-caption-text\">Motifs and transformations<\/figcaption><\/figure>\n<p>You can download the full source <a href=\"http:\/\/www.rangakrish.com\/downloads\/Motifs and transformations.opmo\" target=\"_blank\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the creative approaches to synthesizing music is to start with a short melodic motif and then apply various transformations on it. The motif is usually (but not necessarily) of 1 bar duration. What are some possible transformations? This depends on one\u2019s creativity, but here is a simple list: 1) Identity transformation: Do nothing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[18,5,17],"tags":[53,37,54],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry","category-lisp","category-music","category-programming","tag-motifs","tag-opusmodus","tag-transformations"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-3m","jetpack-related-posts":[{"id":2242,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/12\/20\/jfugue-a-java-library-for-music-synthesis\/","url_meta":{"origin":208,"position":0},"title":"JFugue: A Java Library for Music Synthesis","author":"admin","date":"December 20, 2020","format":false,"excerpt":"JFugue\u00a0is an open-source Java library that can be used for algorithmic music composition. Developed by David Koelle, currently it is in its fifth major version. You can get the library from here. I had downloaded the library some time ago, but could not spend much time since my primary focus\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Simple Java Program","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/12\/java-2-300x142.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/12\/java-2-300x142.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/12\/java-2-300x142.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":159,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/02\/28\/using-cellular-automata-to-generate-music\/","url_meta":{"origin":208,"position":1},"title":"Using Cellular Automata to Generate Music","author":"admin","date":"February 28, 2016","format":false,"excerpt":"Cellular automata are a powerful computational formalism. Stephen Wolfram\u2019s book A New Kind of Science\u00a0provides a thorough study of these devices. Not surprisingly,\u00a0Wolfram Mathematica has great support for working with them. For example, the following figure shows the evolution of Rule 30 over 50 steps, plotted using ArrayPlot function (in\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Cellular Automata","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/02\/Cellular-Automata.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2174,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/10\/24\/using-random-walk-principle-to-generate-music\/","url_meta":{"origin":208,"position":2},"title":"Using Random Walk Principle to Generate Music","author":"admin","date":"October 24, 2020","format":false,"excerpt":"In mathematics, the simplest example of Random Walk\u00a0is a random process along a one-dimensional plane of integers, starting at 0 and moving in the positive or negative direction in steps of +1 or -1, with equal probability. The Random Walk\u00a0theory has been applied in many domains including Physics and even\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Random Walk Example in Mathematica","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/10\/Mathematica-RandomWalk-300x135.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":227,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/05\/10\/generating-melody-to-fit-harmony\/","url_meta":{"origin":208,"position":3},"title":"Generating Melody to Fit Harmony","author":"admin","date":"May 10, 2016","format":false,"excerpt":"There are two common approaches to composing music. One involves synthesizing a suitable chord progression first and then layering melody over it. The other is to start with melody and then harmonize it by applying chords. Of course, you can mix both approaches - use one technique for a portion\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Melody Over Harmony","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/05\/Melody-Over-Harmony-888x1024.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/05\/Melody-Over-Harmony-888x1024.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/05\/Melody-Over-Harmony-888x1024.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/05\/Melody-Over-Harmony-888x1024.png?resize=700%2C400 2x"},"classes":[]},{"id":2084,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/08\/16\/pattern-matching-comparing-elixir-and-mathematica\/","url_meta":{"origin":208,"position":4},"title":"Pattern Matching: Comparing Elixir and Mathematica","author":"admin","date":"August 16, 2020","format":false,"excerpt":"One of the things I like about Elixir\u00a0is its support for patterns at the core language level, not through library functions as in most other languages. This contributes to writing cleaner code, in my opinion. \u00a0 Another environment that I am familiar with, namely Mathematica, boasts of (arguably) the most\u2026","rel":"","context":"In &quot;Elixir&quot;","block_context":{"text":"Elixir","link":"https:\/\/www.rangakrish.com\/index.php\/category\/elixir\/"},"img":{"alt_text":"Symbolic Expressions","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":140,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/02\/06\/organum-in-music\/","url_meta":{"origin":208,"position":5},"title":"Organum in Music","author":"admin","date":"February 6, 2016","format":false,"excerpt":"When two or more voices in a song follow the same rhythm and move by the same interval, thus causing a parallel motion of the voices, it is referred to as Organum. Depending on the intervals between the voices, this can give rise to a rich and interesting effect. For\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Single voice","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/02\/Single-voice.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/02\/Single-voice.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/02\/Single-voice.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}