I just wanna share my ideas about the drum machine.
The idea is to create something like real drum machine in a single line.
And so I wrote a simple function like this
##| define :maschine do |s_name, beats, amp, humanize, stretch| define :maschine do |var| ##| set default values in case they if they are not set _sample = !var.nil? ? var : "bd_house" _beats = !var.nil? ? var.ring :  _n = _beats.length ? _beats.length : 1 _amp = !var.nil? ? var : 1 _humanize = !var.nil? ? var : 0 _stretch = !var.nil? ? var : 1 _n.times do if(_beats.tick == 1) sample _sample, amp: _amp, start: rrand(0, _humanize), rate: rrand(1, _stretch) end sleep 1.0 / _beats.length end end
this is the way how to use it
live_loop :beat do maschine [ "bd_haus", [1, 0, 0, 0 ], 0.5, 0.002, 1.1] end
What you do is that you call the function it self, you tell it what sample you wanna play, you give it bunch of 1 & 0 (the number depends completely on you). The next 3 numbers are: amp, random start position (which gives the groove bit of human like feel), and the rate for funky transpositions
You can even do this
maschine [ "bd_haus"]
this will play one beat per a measure
maschine [ “bd_haus”, [1, 0, 0, 0 ]]
this will play one beat on the beginning with the time/measure equally divided by number of beats in this case it is equal to this
sample :bd_house sleep 0.25 sleep 0.25 sleep 0.25 sleep 0.25
and so this
live_loop :beat do maschine [ "bd_haus", [1, 0, 0, 0 ]] end live_loop :beat2 do maschine [ "elec_blip", [0, 1, 0 ]] end
will create 4/3 beat
You see that it’s even more powerful than normal beat maschine as you can use as many beats per measure as you like 1, 4, 5, 6, 19876,… if you will
(yes I have not use any of other features like: amp, start, rate that are part of the function, I just wanted to simplify the example)
Although I like the what it does in a code of “one line” I feel it has flaws. Mainly the most elementary flaw is that - while I write the line it does not autocomplete for the sample type.
If you look at it… it is basically a simple extension of the sample it self… only enhanced by the repetition.
Something like we have
play_pattern [:d3, :c1, :Eb5]
But the play_pattern is able to play melodical pattern but not rhythmical.
The ideal implementation I can think of would be:
sample :bd_ada, pattern: [1,0,0,0,1,0,1,0], amp: 1, start: 0.02, …
If the sample or synth, whatever will be extended for the “pattern” option, we will be able to create a drum maschine from every sample/synth right away… I just don’t know how to patch the sample implementation it self…
Plus My question is, if you feel anything other/better approach to that?
looking forward to hear your comments.