Skip to content

Instantly share code, notes, and snippets.

@aurelijusb
Last active Sep 12, 2021
Embed
What would you like to do?
Happy programmers day 2021!

I have heard saying, that software development is like an art: you create unique things by pressing buttons on the keyboard.

For International programmers' day I wanted to try it literally: make music from the sounds of the keyboard clicks. And of course, do it via writing programming code (using https://sonic-pi.net/).

Happy listening...

MIT License
Copyright (c) 2021 Aurelijus Banelis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Are programmers making art with the keyboard?
define :key do |name, long, loudness|
sample name + ".wav", release: long, amp: loudness
sleep long
end
live_loop :typing do
key "n", 0.4, 1
key "f", 0.4, 1
key "q", 0.4, 1
key "space", 0.4, 1
end
# Let's give some speed
define :key do |name, long, loudness|
sample name + ".wav", release: long, amp: loudness
sleep long
end
live_loop :typing do
with_fx :reverb do
key "n", 0.4, 1
key "f", 0.4, 1
key "q", 0.4, 1
key "space", 0.4, 1
end
end
# When is Programmers' day?
define :key do |name, long, loudness|
sample name + ".wav", release: long, amp: loudness
sleep long
end
$day = -1
live_loop :typing do
with_fx :reverb do
$day += 8
$loudness = $day / 16.0
key "n", 0.2, $loudness
key "f", 0.2, $loudness
key "q", 0.2, $loudness
key "space", 0.2, $loudness
print "Day of the year: " + $day.to_s
print $day.to_s(2)
end
if $day == 255 then
sleep 0.4
print "Happy programmers day!"
print "Greetings from NFQ" #nfqvibe
with_fx :echo, decay: 16 do
with_fx :krush do
sample "space.wav", amp: 16
sleep 16
end
end
stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment