Files
-
blinds / hardware_design / pcb / blinds_v60.brd
-
blinds / hardware_design / pcb / blinds_v60.sch
-
braids / hardware_design / pcb / braids_v50.brd
-
braids / hardware_design / pcb / braids_v50.sch
-
branches / hardware_design / pcb / branches_v40.brd
-
branches / hardware_design / pcb / branches_v40.sch
-
clouds / hardware_design / pcb / clouds_v30.brd
-
clouds / hardware_design / pcb / clouds_v30.sch
-
ears / hardware_design / panel / ears_panel_v30.brd
-
ears / hardware_design / panel / ears_panel_v30.sch
-
ears / hardware_design / pcb / ears_v40.brd
-
ears / hardware_design / pcb / ears_v40.sch
-
edges / hardware_design / pcb / edges_expander_v01.brd
-
edges / hardware_design / pcb / edges_expander_v01.sch
-
edges / hardware_design / pcb / edges_v20.brd
-
edges / hardware_design / pcb / edges_v20.sch
-
elements / hardware_design / pcb / elements_v02.brd
-
elements / hardware_design / pcb / elements_v02.sch
-
frames / hardware_design / pcb / frames_v03.brd
-
frames / hardware_design / pcb / frames_v03.sch
-
grids / hardware_design / pcb / grids_v02.brd
-
grids / hardware_design / pcb / grids_v02.sch
-
kinks / hardware_design / pcb / kinks_v41.brd
-
kinks / hardware_design / pcb / kinks_v41.sch
-
links / hardware_design / pcb / links_v40.brd
-
links / hardware_design / pcb / links_v40.sch
-
marbles / hardware_design / pcb / marbles_v70.brd
-
marbles / hardware_design / pcb / marbles_v70.sch
-
peaks / hardware_design / pcb / peaks_v30.brd
-
peaks / hardware_design / pcb / peaks_v30.sch
-
plaits / hardware_design / pcb / plaits_v50.brd
-
plaits / hardware_design / pcb / plaits_v50.sch
-
rings / hardware_design / pcb / rings_v30.brd
-
rings / hardware_design / pcb / rings_v30.sch
-
ripples / hardware_design / pcb / ripples_v40.brd
-
ripples / hardware_design / pcb / ripples_v40.sch
-
shades / hardware_design / pcb / shades_v30.brd
-
shades / hardware_design / pcb / shades_v30.sch
-
shelves / hardware_design / pcb / shelves_expander_v10.brd
-
shelves / hardware_design / pcb / shelves_expander_v10.sch
-
shelves / hardware_design / pcb / shelves_v05.brd
-
shelves / hardware_design / pcb / shelves_v05.sch
-
stages / hardware_design / pcb / stages_v70.brd
-
stages / hardware_design / pcb / stages_v70.sch
-
streams / hardware_design / pcb / streams_v02_bargraph.brd
-
streams / hardware_design / pcb / streams_v02_bargraph.sch
-
streams / hardware_design / pcb / streams_v05.brd
-
streams / hardware_design / pcb / streams_v05.sch
-
tides / hardware_design / pcb / tides_v40.brd
-
tides / hardware_design / pcb / tides_v40.sch
-
veils / hardware_design / pcb / veils_v40.brd
-
veils / hardware_design / pcb / veils_v40.sch
-
volts / hardware_design / pcb / volts_v01.brd
-
volts / hardware_design / pcb / volts_v01.sch
-
warps / hardware_design / pcb / warps_v30.brd
-
warps / hardware_design / pcb / warps_v30.sch
-
yarns / hardware_design / pcb / yarns_v03.brd
-
yarns / hardware_design / pcb / yarns_v03.sch
Last update 6 years 3 months
by
Olivier Gillet
Filesgridsresources | |
---|---|
.. | |
__init__.py | |
lookup_tables.py | |
resources.py |
lookup_tables.py#!/usr/bin/python2.5 # # Copyright 2012 Olivier Gillet. # # Author: Olivier Gillet (olivier@mutable-instruments.net) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ----------------------------------------------------------------------------- # # Lookup table definitions. import numpy lookup_tables = [] drum_map_nodes = [] """---------------------------------------------------------------------------- Drum map nodes ----------------------------------------------------------------------------""" nodes = [ [ 255, 0, 0, 0, 0, 0, 145, 0, 0, 0, 0, 0, 218, 0, 0, 0, 72, 0, 36, 0, 182, 0, 0, 0, 109, 0, 0, 0, 72, 0, 0, 0, 36, 0, 109, 0, 0, 0, 8, 0, 255, 0, 0, 0, 0, 0, 72, 0, 0, 0, 182, 0, 0, 0, 36, 0, 218, 0, 0, 0, 145, 0, 0, 0, 170, 0, 113, 0, 255, 0, 56, 0, 170, 0, 141, 0, 198, 0, 56, 0, 170, 0, 113, 0, 226, 0, 28, 0, 170, 0, 113, 0, 198, 0, 85, 0 ], [ 229, 0, 25, 0, 102, 0, 25, 0, 204, 0, 25, 0, 76, 0, 8, 0, 255, 0, 8, 0, 51, 0, 25, 0, 178, 0, 25, 0, 153, 0, 127, 0, 28, 0, 198, 0, 56, 0, 56, 0, 226, 0, 28, 0, 141, 0, 28, 0, 28, 0, 170, 0, 28, 0, 28, 0, 255, 0, 113, 0, 85, 0, 85, 0, 159, 0, 159, 0, 255, 0, 63, 0, 159, 0, 159, 0, 191, 0, 31, 0, 159, 0, 127, 0, 255, 0, 31, 0, 159, 0, 127, 0, 223, 0, 95, 0 ], [ 255, 0, 0, 0, 127, 0, 0, 0, 0, 0, 102, 0, 0, 0, 229, 0, 0, 0, 178, 0, 204, 0, 0, 0, 76, 0, 51, 0, 153, 0, 25, 0, 0, 0, 127, 0, 0, 0, 0, 0, 255, 0, 191, 0, 31, 0, 63, 0, 0, 0, 95, 0, 0, 0, 0, 0, 223, 0, 0, 0, 31, 0, 159, 0, 255, 0, 85, 0, 148, 0, 85, 0, 127, 0, 85, 0, 106, 0, 63, 0, 212, 0, 170, 0, 191, 0, 170, 0, 85, 0, 42, 0, 233, 0, 21, 0 ], [ 255, 0, 212, 0, 63, 0, 0, 0, 106, 0, 148, 0, 85, 0, 127, 0, 191, 0, 21, 0, 233, 0, 0, 0, 21, 0, 170, 0, 0, 0, 42, 0, 0, 0, 0, 0, 141, 0, 113, 0, 255, 0, 198, 0, 0, 0, 56, 0, 0, 0, 85, 0, 56, 0, 28, 0, 226, 0, 28, 0, 170, 0, 56, 0, 255, 0, 231, 0, 255, 0, 208, 0, 139, 0, 92, 0, 115, 0, 92, 0, 185, 0, 69, 0, 46, 0, 46, 0, 162, 0, 23, 0, 208, 0, 46, 0 ], [ 255, 0, 31, 0, 63, 0, 63, 0, 127, 0, 95, 0, 191, 0, 63, 0, 223, 0, 31, 0, 159, 0, 63, 0, 31, 0, 63, 0, 95, 0, 31, 0, 8, 0, 0, 0, 95, 0, 63, 0, 255, 0, 0, 0, 127, 0, 0, 0, 8, 0, 0, 0, 159, 0, 63, 0, 255, 0, 223, 0, 191, 0, 31, 0, 76, 0, 25, 0, 255, 0, 127, 0, 153, 0, 51, 0, 204, 0, 102, 0, 76, 0, 51, 0, 229, 0, 127, 0, 153, 0, 51, 0, 178, 0, 102, 0 ], [ 255, 0, 51, 0, 25, 0, 76, 0, 0, 0, 0, 0, 102, 0, 0, 0, 204, 0, 229, 0, 0, 0, 178, 0, 0, 0, 153, 0, 127, 0, 8, 0, 178, 0, 127, 0, 153, 0, 204, 0, 255, 0, 0, 0, 25, 0, 76, 0, 102, 0, 51, 0, 0, 0, 0, 0, 229, 0, 25, 0, 25, 0, 204, 0, 178, 0, 102, 0, 255, 0, 76, 0, 127, 0, 76, 0, 229, 0, 76, 0, 153, 0, 102, 0, 255, 0, 25, 0, 127, 0, 51, 0, 204, 0, 51, 0 ], [ 255, 0, 0, 0, 223, 0, 0, 0, 31, 0, 8, 0, 127, 0, 0, 0, 95, 0, 0, 0, 159, 0, 0, 0, 95, 0, 63, 0, 191, 0, 0, 0, 51, 0, 204, 0, 0, 0, 102, 0, 255, 0, 127, 0, 8, 0, 178, 0, 25, 0, 229, 0, 0, 0, 76, 0, 204, 0, 153, 0, 51, 0, 25, 0, 255, 0, 226, 0, 255, 0, 255, 0, 198, 0, 28, 0, 141, 0, 56, 0, 170, 0, 56, 0, 85, 0, 28, 0, 170, 0, 28, 0, 113, 0, 56, 0 ], [ 223, 0, 0, 0, 63, 0, 0, 0, 95, 0, 0, 0, 223, 0, 31, 0, 255, 0, 0, 0, 159, 0, 0, 0, 127, 0, 31, 0, 191, 0, 31, 0, 0, 0, 0, 0, 109, 0, 0, 0, 218, 0, 0, 0, 182, 0, 72, 0, 8, 0, 36, 0, 145, 0, 36, 0, 255, 0, 8, 0, 182, 0, 72, 0, 255, 0, 72, 0, 218, 0, 36, 0, 218, 0, 0, 0, 145, 0, 0, 0, 255, 0, 36, 0, 182, 0, 36, 0, 182, 0, 0, 0, 109, 0, 0, 0 ], [ 255, 0, 0, 0, 218, 0, 0, 0, 36, 0, 0, 0, 218, 0, 0, 0, 182, 0, 109, 0, 255, 0, 0, 0, 0, 0, 0, 0, 145, 0, 72, 0, 159, 0, 0, 0, 31, 0, 127, 0, 255, 0, 31, 0, 0, 0, 95, 0, 8, 0, 0, 0, 191, 0, 31, 0, 255, 0, 31, 0, 223, 0, 63, 0, 255, 0, 31, 0, 63, 0, 31, 0, 95, 0, 31, 0, 63, 0, 127, 0, 159, 0, 31, 0, 63, 0, 31, 0, 223, 0, 223, 0, 191, 0, 191, 0 ], [ 226, 0, 28, 0, 28, 0, 141, 0, 8, 0, 8, 0, 255, 0, 8, 0, 113, 0, 28, 0, 198, 0, 85, 0, 56, 0, 198, 0, 170, 0, 28, 0, 8, 0, 95, 0, 8, 0, 8, 0, 255, 0, 63, 0, 31, 0, 223, 0, 8, 0, 31, 0, 191, 0, 8, 0, 255, 0, 127, 0, 127, 0, 159, 0, 115, 0, 46, 0, 255, 0, 185, 0, 139, 0, 23, 0, 208, 0, 115, 0, 231, 0, 69, 0, 255, 0, 162, 0, 139, 0, 115, 0, 231, 0, 92, 0 ], [ 145, 0, 0, 0, 0, 0, 109, 0, 0, 0, 0, 0, 255, 0, 109, 0, 72, 0, 218, 0, 0, 0, 0, 0, 36, 0, 0, 0, 182, 0, 0, 0, 0, 0, 127, 0, 159, 0, 127, 0, 159, 0, 191, 0, 223, 0, 63, 0, 255, 0, 95, 0, 31, 0, 95, 0, 31, 0, 8, 0, 63, 0, 8, 0, 255, 0, 0, 0, 145, 0, 0, 0, 182, 0, 109, 0, 109, 0, 109, 0, 218, 0, 0, 0, 72, 0, 0, 0, 182, 0, 72, 0, 182, 0, 36, 0 ], [ 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 218, 0, 72, 36, 0, 0, 182, 0, 0, 0, 145, 109, 0, 0, 127, 0, 0, 0, 42, 0, 212, 0, 0, 212, 0, 0, 212, 0, 0, 0, 0, 0, 42, 0, 0, 0, 255, 0, 0, 0, 170, 170, 127, 85, 145, 0, 109, 109, 218, 109, 72, 0, 145, 0, 72, 0, 218, 0, 109, 0, 182, 0, 109, 0, 255, 0, 72, 0, 182, 109, 36, 109, 255, 109, 109, 0 ], [ 255, 0, 0, 0, 255, 0, 191, 0, 0, 0, 0, 0, 95, 0, 63, 0, 31, 0, 0, 0, 223, 0, 223, 0, 0, 0, 8, 0, 159, 0, 127, 0, 0, 0, 85, 0, 56, 0, 28, 0, 255, 0, 28, 0, 0, 0, 226, 0, 0, 0, 170, 0, 56, 0, 113, 0, 198, 0, 0, 0, 113, 0, 141, 0, 255, 0, 42, 0, 233, 0, 63, 0, 212, 0, 85, 0, 191, 0, 106, 0, 191, 0, 21, 0, 170, 0, 8, 0, 170, 0, 127, 0, 148, 0, 148, 0 ], [ 255, 0, 0, 0, 0, 0, 63, 0, 191, 0, 95, 0, 31, 0, 223, 0, 255, 0, 63, 0, 95, 0, 63, 0, 159, 0, 0, 0, 0, 0, 127, 0, 72, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 72, 0, 72, 0, 36, 0, 8, 0, 218, 0, 182, 0, 145, 0, 109, 0, 255, 0, 162, 0, 231, 0, 162, 0, 231, 0, 115, 0, 208, 0, 139, 0, 185, 0, 92, 0, 185, 0, 46, 0, 162, 0, 69, 0, 162, 0, 23, 0 ], [ 255, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 204, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 8, 0, 36, 0, 255, 0, 0, 0, 182, 0, 8, 0, 0, 0, 0, 0, 72, 0, 109, 0, 145, 0, 0, 0, 255, 0, 218, 0, 212, 0, 8, 0, 170, 0, 0, 0, 127, 0, 0, 0, 85, 0, 8, 0, 255, 0, 8, 0, 170, 0, 0, 0, 127, 0, 0, 0, 42, 0, 8, 0 ], [ 255, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 182, 0, 0, 0, 218, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 145, 0, 109, 0, 36, 0, 36, 0, 0, 0, 0, 0, 255, 0, 0, 0, 182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 218, 0, 0, 0, 145, 0, 72, 72, 255, 0, 28, 0, 226, 0, 56, 0, 198, 0, 0, 0, 0, 0, 28, 28, 170, 0, 0, 0, 141, 0, 0, 0, 113, 0, 0, 0, 85, 85, 85, 85 ], [ 255, 0, 0, 0, 0, 0, 95, 0, 0, 0, 127, 0, 0, 0, 0, 0, 223, 0, 95, 0, 63, 0, 31, 0, 191, 0, 0, 0, 159, 0, 0, 0, 0, 0, 31, 0, 255, 0, 0, 0, 0, 0, 95, 0, 223, 0, 0, 0, 0, 0, 63, 0, 191, 0, 0, 0, 0, 0, 0, 0, 159, 0, 127, 0, 141, 0, 28, 0, 28, 0, 28, 0, 113, 0, 8, 0, 8, 0, 8, 0, 255, 0, 0, 0, 226, 0, 0, 0, 198, 0, 56, 0, 170, 0, 85, 0 ], [ 255, 0, 0, 0, 8, 0, 0, 0, 182, 0, 0, 0, 72, 0, 0, 0, 218, 0, 0, 0, 36, 0, 0, 0, 145, 0, 0, 0, 109, 0, 0, 0, 0, 0, 51, 25, 76, 25, 25, 0, 153, 0, 0, 0, 127, 102, 178, 0, 204, 0, 0, 0, 0, 0, 255, 0, 0, 0, 102, 0, 229, 0, 76, 0, 113, 0, 0, 0, 141, 0, 85, 0, 0, 0, 0, 0, 170, 0, 0, 0, 56, 28, 255, 0, 0, 0, 0, 0, 198, 0, 0, 0, 226, 0, 0, 0 ], [ 255, 0, 8, 0, 28, 0, 28, 0, 198, 0, 56, 0, 56, 0, 85, 0, 255, 0, 85, 0, 113, 0, 113, 0, 226, 0, 141, 0, 170, 0, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 191, 0, 0, 0, 255, 0, 0, 0, 255, 0, 127, 0, 0, 0, 85, 0, 0, 0, 212, 0, 0, 0, 212, 0, 42, 0, 170, 0, 0, 0, 127, 0, 0, 0, 0, 0 ], [ 255, 0, 0, 0, 0, 0, 218, 0, 182, 0, 0, 0, 0, 0, 145, 0, 145, 0, 36, 0, 0, 0, 109, 0, 109, 0, 0, 0, 72, 0, 36, 0, 0, 0, 0, 0, 109, 0, 8, 0, 72, 0, 0, 0, 255, 0, 182, 0, 0, 0, 0, 0, 145, 0, 8, 0, 36, 0, 8, 0, 218, 0, 182, 0, 255, 0, 0, 0, 0, 0, 226, 0, 85, 0, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 170, 0, 56, 0, 198, 0, 0, 0, 113, 0, 28, 0 ], [ 255, 0, 0, 0, 113, 0, 0, 0, 198, 0, 56, 0, 85, 0, 28, 0, 255, 0, 0, 0, 226, 0, 0, 0, 170, 0, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 145, 0, 109, 0, 218, 0, 36, 0, 182, 0, 72, 0, 72, 0, 255, 0, 0, 0, 0, 0, 109, 0, 36, 0, 36, 0, 145, 0, 0, 0, 72, 0, 72, 0, 182, 0, 0, 0, 72, 0, 72, 0, 218, 0, 0, 0, 109, 0, 109, 0, 255, 0, 0, 0 ], [ 255, 0, 0, 0, 218, 0, 0, 0, 145, 0, 0, 0, 36, 0, 0, 0, 218, 0, 0, 0, 36, 0, 0, 0, 182, 0, 72, 0, 0, 0, 109, 0, 0, 0, 0, 0, 8, 0, 0, 0, 255, 0, 85, 0, 212, 0, 42, 0, 0, 0, 0, 0, 8, 0, 0, 0, 85, 0, 170, 0, 127, 0, 42, 0, 109, 0, 109, 0, 255, 0, 0, 0, 72, 0, 72, 0, 218, 0, 0, 0, 145, 0, 182, 0, 255, 0, 0, 0, 36, 0, 36, 0, 218, 0, 8, 0 ], [ 255, 0, 0, 0, 42, 0, 0, 0, 212, 0, 0, 0, 8, 0, 212, 0, 170, 0, 0, 0, 85, 0, 0, 0, 212, 0, 8, 0, 127, 0, 8, 0, 255, 0, 85, 0, 0, 0, 0, 0, 226, 0, 85, 0, 0, 0, 198, 0, 0, 0, 141, 0, 56, 0, 0, 0, 170, 0, 28, 0, 0, 0, 113, 0, 113, 0, 56, 0, 255, 0, 0, 0, 85, 0, 56, 0, 226, 0, 0, 0, 0, 0, 170, 0, 0, 0, 141, 0, 28, 0, 28, 0, 198, 0, 28, 0 ], [ 255, 0, 0, 0, 229, 0, 0, 0, 204, 0, 204, 0, 0, 0, 76, 0, 178, 0, 153, 0, 51, 0, 178, 0, 178, 0, 127, 0, 102, 51, 51, 25, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 255, 0, 0, 31, 0, 0, 8, 0, 0, 0, 191, 159, 127, 95, 95, 0, 223, 0, 63, 0, 255, 0, 255, 0, 204, 204, 204, 204, 0, 0, 51, 51, 51, 51, 0, 0, 204, 0, 204, 0, 153, 153, 153, 153, 153, 0, 0, 0, 102, 102, 102, 102 ], [ 170, 0, 0, 0, 0, 255, 0, 0, 198, 0, 0, 0, 0, 28, 0, 0, 141, 0, 0, 0, 0, 226, 0, 0, 56, 0, 0, 113, 0, 85, 0, 0, 255, 0, 0, 0, 0, 113, 0, 0, 85, 0, 0, 0, 0, 226, 0, 0, 141, 0, 0, 8, 0, 170, 56, 56, 198, 0, 0, 56, 0, 141, 28, 0, 255, 0, 0, 0, 0, 191, 0, 0, 159, 0, 0, 0, 0, 223, 0, 0, 95, 0, 0, 0, 0, 63, 0, 0, 127, 0, 0, 0, 0, 31, 0, 0 ] ] for i, p in enumerate(nodes): drum_map_nodes.append(('%d' % i, p)) """---------------------------------------------------------------------------- Euclidean patterns ----------------------------------------------------------------------------""" def Flatten(l): if hasattr(l, 'pop'): for item in l: for j in Flatten(item): yield j else: yield l def EuclidianPattern(k, n): pattern = [[1]] * k + [[0]] * (n - k) while k: cut = min(k, len(pattern) - k) k, pattern = cut, [pattern[i] + pattern[k + i] for i in xrange(cut)] + \ pattern[cut:k] + pattern[k + cut:] return pattern table = [] for num_steps in xrange(1, 33): for num_notes in xrange(32): num_notes = int(round(float(num_notes) / 31 * num_steps)) bitmask = 0 for i, bit in enumerate(Flatten(EuclidianPattern(num_notes, num_steps))): if bit: bitmask |= (1 << i) table.append(bitmask) lookup_tables32 = [('euclidean', table)] """---------------------------------------------------------------------------- Phase increment for tempo. ----------------------------------------------------------------------------""" control_rate = 8000 width = 1 << 32 tempo_values = numpy.arange(0, 512.0) lookup_tables32.append( ('tempo_phase_increment', width * tempo_values * 8 / (60 * control_rate) / 2) )