Created
November 6, 2008 17:21
-
-
Save lp/22638 to your computer and use it in GitHub Desktop.
Bank & Presets for Arkx.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Pattern is a Bank & Presets system for Archaeopteryx live rythms performance. | |
| # This Module has the purpose of giving more flexibility to the sequenced patterns in | |
| # Arkx. | |
| # It is a live editable file for musical performance of midi rythms | |
| # generated inside Archaeopteryx. | |
| # | |
| # allows you to name your tracks with ruby symbols for better musical organisation. | |
| # Then, gives you the Pattern::preset function, allowing for | |
| # arbitrary mapping of the symbol named tracks into midi note tracks. | |
| # | |
| # Instructions: | |
| # Place this file inside your archaeopteryx folder. | |
| # call this file with: | |
| # | |
| # eval(File.read('pattern.rb')). | |
| # | |
| # on top of your db_drum_definition.rb file | |
| # then, comment # all probabilities midi notes definitions and leave only one loading your preset like: | |
| # probabilities = Pattern.preset(7) | |
| # | |
| # functions: | |
| # Pattern.preset( preset_number ) | |
| # calls one of the pattern.rb preset pattern by number. | |
| # An optionnal hash of options may also be given: | |
| # Pattern.preset( preset_number, { :start => first_midi_note_in_range, | |
| # :order => ordered_symbol_array }) | |
| # | |
| # You can add as many presets as you wish, | |
| # don't forget to add them to the bank to get to call them. | |
| # | |
| # Fill and Go! | |
| # | |
| # LICENSE:: | |
| # Author: l-p | |
| # Copyright (c) 2008 Louis-Philippe Perron | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to | |
| # deal in the Software without restriction, including without limitation the | |
| # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
| # sell copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: | |
| # | |
| # The above copyright notice and this permission notice shall be included in | |
| # all copies or substantial portions of the Software. | |
| # | |
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | |
| # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
| # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| # | |
| # | |
| # :title:Pattern | |
| module Pattern | |
| # beats 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
| @@preset1 = { | |
| :BD1 => [1.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :BD2 => [0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0], | |
| :SN1 => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0], | |
| :SN2 => [0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.8, 0.0, 0.0, 0.0], | |
| :RIM => [0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :CLP => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0], | |
| :HH1 => [0.0, 0.7, 0.7, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0], | |
| :HH2 => [0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7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| |
| # beats 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
| @@preset5 = { | |
| :BD1 => [1.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :BD2 => [0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0], | |
| :SN1 => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0], | |
| :SN2 => [0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.8, 0.0, 0.0, 0.0], | |
| :RIM => [0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :CLP => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0], | |
| :HH1 => [0.0, 0.7, 0.7, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0], | |
| :HH2 => [0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :HH3 => [0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0], | |
| :SHK => [0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.7, 0.0] | |
| } | |
| # beats 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
| @@preset6 = { | |
| :BD1 => [1.0, 0.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0, 0.7, 0.0, 0.0, 0.0], | |
| :SN1 => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0], | |
| :SN2 => [0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.8, 0.0, 0.0, 0.0], | |
| :RIM => [0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :CLP => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0], | |
| :HH1 => [0.0, 0.7, 0.7, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0], | |
| :HH2 => [0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| :HH3 => [0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0], | |
| :SHK => [0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.7, 0.0] | |
| } | |
| # Here comes the Array that determine the index, | |
| # at which the presets are assigned, inside the @@bank class Array. | |
| # It can be used as a hack to choose which preset plays. | |
| @@bank = [ nil, @@preset1, @@preset2, @@preset3, @@preset4, @@preset5, @@preset6, @@preset7, @@preset8] | |
| # Accept a preset number + option hash | |
| # return probabilities hash starting at :start midi note of :order order | |
| def Pattern.preset(preset, mapping={ :start => 36, | |
| :order => [:BD1, :RIM, :SN1, :CLP, :SN2, :BD2, :HH1, :HH2, :HH3, :SHK]}) | |
| probabilities = Hash.new; note = mapping[:start] | |
| mapping[:order].each do |track| | |
| probabilities[note] = @@bank[preset][track] | |
| note += 1 | |
| end | |
| return probabilities | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment