File: 2600.patch.tcl

package info (click to toggle)
din 5.2.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,200 kB
  • sloc: cpp: 9,369; sh: 6,563; ansic: 2,977; tcl: 1,770; makefile: 283
file content (80 lines) | stat: -rw-r--r-- 2,326 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
if {0} {

  /*
    * This file is part of din.
    *
    * din is copyright (c) 2006 - 2012 S Jagannathan <jag@dinisnoise.org>
    * For more information, please visit http://dinisnoise.org
    *
    * din 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 2 of the License, or
    * (at your option) any later version.
    *
    * din 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 din.  If not, see <http://www.gnu.org/licenses/>.
    *
  */

  turn a list of very offensive English language words
  picked using 4 MIDI sliders/knobs into morse code
  and apply as gater patterns

}

set ::redact 0 ;# print fuck as f*ck if ::redact is 1

proc read-word-list {} {
  ;# read banned words list compiled by 2600 magazine: http://www.2600.com/googleblacklist/
  global wordlist
  set wordlist {}
  set f [open ~/.din/2600 r]
  while {[gets $f line] >= 0} { lappend wordlist $line }
  close $f
}

proc midi-cc {status cc value} {

  global wordlist id redact

  set sliders {1 2 3 4} ;# slider ids. change these values to match ids of your midi slider/knobs
  set j 0
  foreach i $sliders {
    if {$cc eq $i} { # matched 1 of the (4) banks of words

      ;# find word
      set step [expr $j * 127]
      set id [expr $step+$value]
      set word [lindex $wordlist $id]

      if {$word ne ""} {
        ;# print word in pretty random text color
        set-text-color [expr rand()] [expr rand()] [expr rand()]
        if {$redact eq 1} {
          ;# redact is 1 so simply replace the vowels with a special char
          set word [string map "a * e # i & o % u !" $word]
          echo $word
        } else {
          echo $word
        }
        do-morse-code $word ;# word -> morse code -> gaters
      }
      return
    }
    incr j
  }

}

proc do-morse-code {str} {
  morse-code [string toupper $str] ;# create morse code bezier curves
  paste-gater ;# paste the curves into gater
}

read-word-list