feepogram
A tiny DSL for non-trivial bloopsaphone projects.
Briefly
require 'bloops'
require 'feepogram'
bloops = Bloops.new
bloops.tempo = 320
song = Feepogram.new(bloops) do
sound :crunch, Bloops::NOISE do |s|
s.punch = 0.5
end
sound :oooo, Bloops::SINE do |s|
s.sustain = 2.0
end
sound :plink, Bloops::SQUARE do |s|
s.punch = 1.0
end
def and_one
phrase do
oooo " 1:c2 " * 8
plink " c d e f g a b + c - " * 4
end
end
def and_two
phrase do
crunch " c2 4 c5 4 " * 8
oooo " 1:g2 " * 8
plink " c d e f g a b + c - " * 4
end
end
2.times do
and_one
and_two
end
end
song.play
Right, So
sound
initialises a bloopsaphone sound and defines a handy method for you. That’s not the interesting part.
The Interesting Part
phrase
defines a 32-beat phrase. Any instruments to which you don’t assign a tune in the block are told to rest for 32 beats.
This makes it easy to decompose sections of your song into methods and repeat or comment out calls to them, which is something you’ll definitely want to be doing if your song is more than 10 seconds long.
Yeah, that’s it. There’s definitely potential for more though! Like, well, I don’t know. Potential, though.
Copyright
Copyright © 2009 Aanand Prasad. See LICENSE for details.