Skip to content

Instantly share code, notes, and snippets.

@MaxPleaner
Last active August 22, 2017 00:03
Show Gist options
  • Save MaxPleaner/97ff9fede490a4fe34be670005cbef71 to your computer and use it in GitHub Desktop.
Save MaxPleaner/97ff9fede490a4fe34be670005cbef71 to your computer and use it in GitHub Desktop.
step_sequencer script skeleton
# This is written for use with https://github.com/maxpleaner/step_sequencer
# It should be loaded from the step_sequencer repl using pry's `play` command,
# e.g. `play song.rb`
Player = StepSequencer::SoundPlayer
Builder = StepSequencer::SoundBuilder
DrumsPlayer = Player.new %{
"Symbol.mp3",
"Hat.mp3",
"Snare.mp3",
"Kick.mp3"
}
BassPlayer = Player.new Builder.build(
sources: ["middle_c_bass.mp3"],
effect: :Scale,
args: [{scale: :equal_temperament}]
).first.first(6)
LeadPlayer = Player.new Builder.build(
sources: ["middle_c_lead.mp3"],
effect: :Scale,
args: [{scale: :equal_temperament}]
).first.first(6)
DrumsRiff1 = <<-TXT
x _ _ _
_ x x _ _ x x _ x x _ x _ _x _ x x
_ _ _ _ x _ _ _ _ _ _ _ x _ _ _ _ _
x _ _ x _ x _ x _ _ x _ _ x _ x _ _
TXT
BassRiff1 = <<-TXT
_
_ _ _ _ _ _ _ _ _ _ x x _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ x x _ _ x x
x x x x x x x x x x _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ x x _ _
_
TXT
LeadRiff1 = <<-TXT
_
_ _ _ _ _ _ _ _ _ _ x x _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ x x _ _ x x
x x x x x x x x x x _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ x x _ _
_
TXT
Riff1Reps = 2
Riff1Length = 18
DrumsPlayer.play string: DrumsRiff1, limit: (Riff1Length * Riff1Reps)
BassPlayer.play string: BassRiff1, limit: (Riff1Length * Riff1Reps)
LeadPlayer.play string: LeadRiff1, limit: (Riff1Length * Riff1Reps)
sleep while [DrumsPlayer, BassPlayer, LeadPlayer].any? &:playing
DrumsRiff2 = <<-TXT
_
_ _ x x _ _ x x _ _ x x _ _ x x
_ _ _ _ x _ _ _ _ _ _ _ x _ _ _
x _ _ _ _ _ _ _ x _ _ _ _ _ _ _
TXT
BassRiff2 = <<-TXT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ x _ x _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ x _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ x _ x _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ x _ _ _ _ _ x _ _ _ _ _ _ _ _ _ x _ _ _ _ _ x _
_ _ _ _ _ _ _ _ _ _ _ _ x _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ x _ _ _
TXT
LeadRiff2 = <<-TXT
_ _ _ x _ _ _ _ _ _ _ x _ _ _ _
_ _ _ _ x _ _ _ _ _ _ _ x _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
TXT
Riff2Reps = 2
Riff2Length = 18
DrumsPlayer.play string: DrumsRiff2, limit: (Riff2Length * Riff1Reps)
BassPlayer.play string: BassRiff2, limit: (Riff2Length * Riff1Reps)
LeadPlayer.play string: LeadRiff2, limit: (Riff2Length * Riff1Reps)
sleep while [DrumsPlayer, BassPlayer, LeadPlayer].any? &:playing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment