Skip to content

Instantly share code, notes, and snippets.

@jchuerva
jchuerva / CONDTIONALS
Created June 4, 2023 12:21 — forked from alptugan/CONDTIONALS
Sonic Pi Cheat Sheet
So, let’s flip a coin: if it’s heads, play a drum, if it’s tails, play a cymbal. Easy. We can emulate a coin flip with our one_in function (introduced in the section on randomness) specifying a probability of 1 in 2: one_in(2). We can then use the result of this to decide between two pieces of code, the code to play the drum and the code to play the cymbal:
loop do
if one_in(2)
sample :drum_heavy_kick
else
sample :drum_cymbal_closed
end
@jchuerva
jchuerva / ReadMe.md
Created June 4, 2023 12:21 — forked from rbnpi/ReadMe.md
Beethoven Moonlight Sonata played by Sonic Pi. Uses Sonatina Symphonic Orchestra samples. See readme for availablilty. Video at https://youtu.be/8rdJ9wxGw5Y

The Sonic Pi file moonlightSonata-RF.rb which plays Beethoven's Moonlight Sonata 1st Movement requires the use of the Grand Piano samples from the Sonatina Symphonic Orchestra produced by Matthias Westlund.

Unfortunately this is no longer available from his website https://sso.mattiaswestlund.net/ However there is an alternative available at https://github.com/peastman/sso from where you can download the library. It is coverd by a https://creativecommons.org/licenses/sampling+/1.0/ Download and expand on your Desktop, or other suitable location and then set the link in the program at line 9 appropraitely for your installation.

The file should be run using the run_file "/path/to/file/location" command as it is too long to run from a Sonic Pi buffer.

An alternative version using the built in piano synth in Sonic Pi is included for comparison.

@jchuerva
jchuerva / obsidian-web-clipper.js
Created August 21, 2022 11:00 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */