You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.6 KiB

<!doctype html>
<html lang="en">
  <!-- hi stranger -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
    <link href="favicon.png" rel="icon">
    <link href="styles.css" rel="stylesheet">
    <title>Creating Music in Sonic Pi—Part 1</title>
    <meta name="description" content="Senior Capstone Journal Entry 1">
      <h1><a href="..">&larr;</a>Creating Music in Sonic Pi—Part 1</h1>
      <time datetime="2020-05-29">29 May 2020</time>
      <a href="track2.html">Part 2</a>
      <a href="track3.html">Part 3</a>
        <h2>Meeting the Requirements</h2>
          High schoolers in my state are required to complete a
          <em>Capstone</em> project to finish off their senior year.
          It is really up to the individual as to how they meet the requirements,
          so I decided to create some music using <a href="">Sonic Pi</a>.
          Sonic Pi is touted on their website as the “future of music.”
          Instead of a arranging notes manually, you <em>write code to describe the sound you want</em>,
          instead of using midi keyboards<sup><a id="fna:midi" href="fn:midi">[1]</a></sup>,
          you use an actual keyboard (bad joke).
        <h2>Proof of Progress</h2>
          After spending a few weeks messing around with the editor,
          learning the ropes and creating some sound, I knew it was
          time to record at least something. And I did. Below is the
          ≈10 minute recording of some “music” I made, below that is
          the code to make the sound. This was recorded live and
          edited in real time, so the code you see below is not the
          entire piece, it is only a snapshot of the end. In a later
          post, I will explain how it works in detail. I would
          recommend starting around the two minute mark.
          <audio src="track1.mp3" controls class="jam"></audio>
        <code># Welcome to Sonic Pi
use_bpm 180
live_loop :kick do
  with_fx :distortion, distort: 0.7, reps: 8 do
    cue :kick
    sample :bd_klub
    sleep 0.5
live_loop :tick do
  sync :kick
  ##| sample :elec_tick, rate: 0.5
live_loop :beep do
  ##| use_synth :chipbass
  ##| 10.times do
  sync :kick
  ##| end
  ##| play :d3
live_loop :bump do
  2.times do
    sync :kick
  ##| sample :bd_808
live_loop :snare do
  with_fx :reverb, reps: 2 do
    5.times do
      3.times do
        sync :kick
      ##| sample :elec_hi_snare, amp: 0.5
    sleep 0.5
    sample :elec_lo_snare, rate: 0.3, amp: 0.75
live_loop :bassline do
  chords = ring :e2, :g2, :e2, :e3, :d3
  i = 0
  with_fx :ping_pong, feedback: 0.99 do
    with_fx :distortion, distort: 0.5, reps: chords.length do
      wait = 3
      if i == chords.length - 1 then
        wait -= 1
      wait.times do
        sync :kick
      use_synth :dtri
      ##| play chords[i], attack: 0, sustain: 1, release: 0, detune: 0.5
      i += 1
          <li><a id="fn:midi" href="fna:midi">[1]</a>: Though you can use midi with Sonic Pi</li>
      <a rel="license" href=""><img alt="Creative Commons License" src="images/cc.png"></a>