Ixi confusion - well, it isn't ixi

I saw discussion of ixi, and wondered what it was. I had a go at implementing something ixi like in Sonic Pi, but unfortunately I did that before I watched the tutorial on ixi to understand how it works. So, what I did is … different.

Once set up, my ‘ixi-like’ code which isn’t very ixi-like looks like this:

live_loop :forever do
  
  ixi "|a a b acc b a bc|" +
    "|d       d   e  |" +
    "|p  pq   p p q r|"
  "|x y x y x y x y|"
  
  sleep 4
end

But, what my code is doing is mapping each ‘a’ onto a function a(), ‘b’ onto b(), and so on. By adding function definitions for these single letter functions, and creating a very big and copy-pasted ixi() function, it works.

Well, when I say ‘works’, I mean that it produces sound and modifying the above code changes the music. But, having now seen an ixi tutorial, what it’s not doing is implementing ixi :smiley:

Note that while there are 26 possible single letter functions, it’s only necessary to define the ones that are actually going to be used in the not-ixi pattern.

use_bpm 120

set_mixer_control! limiter_bypass: 1

define :x do
  sample :drum_cymbal_closed, pan: 0.7
end

define :y do
  sample :drum_cymbal_closed, pan: -0.7
end

define :d do
  sample :tabla_ghe2
end

define :e do
  sample :tabla_ghe4
end

define :a do
  use_synth :dsaw
  play 48, amp: 0.25, cutoff: 90, sustain: 0.25
end

define :b do
  use_synth :dsaw
  play 51, amp: 0.45, cutoff: 90, sustain: 0.25
end

define :c do
  use_synth :dsaw
  play 53, amp: 0.45, cutoff: 90, sustain: 0.25
end

define :p do
  sample :bd_haus
end

define :q do
  sample :sn_dolf
end

define :r do
  sample :sn_dolf, amp: 0.25
end




define :ixi do |contents|
  conarr = contents.split( "|" )
  
  conarr.each do |line|
    if line != ""
      
      in_thread do
        line.length.times do |i|
          b = line[i]
          
          if b == "a"
            a()
          end
          
          if b == "b"
            b()
          end
          
          if b == "c"
            c()
          end
          
          if b == "d"
            d()
          end
          
          if b == "e"
            e()
          end
          
          if b == "f"
            f()
          end
          
          if b == "g"
            g()
          end
          
          if b == "h"
            h()
          end
          
          if b == "i"
            i()
          end
          
          if b == "j"
            j()
          end
          
          if b == "k"
            k()
          end
          
          if b == "l"
            l()
          end
          
          if b == "m"
            m()
          end
          
          if b == "n"
            n()
          end
          
          if b == "o"
            o()
          end
          
          if b == "p"
            p()
          end
          
          if b == "q"
            q()
          end
          
          if b == "r"
            r()
          end
          
          if b == "s"
            s()
          end
          
          if b == "t"
            t()
          end
          
          if b == "u"
            u()
          end
          
          if b == "v"
            v()
          end
          
          if b == "w"
            w()
          end
          
          if b == "x"
            x()
          end
          
          if b == "y"
            y()
          end
          
          if b == "z"
            z()
          end
          
          sleep 0.25
        end
      end
    end
  end
end

live_loop :forever do
  
  ixi "|a a b acc b a bc|" +
    "|d       d   e  |" +
    "|p  pq   p p q r|"
  "|x y x y x y x y|"
  
  sleep 4
end
1 Like