Code Monkey home page Code Monkey logo

working-with-sonic-pi-chord-inversions's Introduction

Working With Sonic PI Chord Inversions

The file ChordsAnd Inversion.rb illustates the basics

When you run this code it will show output in the right hand pane pf the Sonic Pi application It lists: The scale names The chord names, and The note numbers for an Ae major chord It plays two scales major and minor and then the three inversions of a chord.

puts "An A3major chord is composed of "
puts chord :A3, "M"
play_pattern_timed scale(:d3, :major), 0.125, release: 0.1
play_pattern_timed scale(:d3, :minor), 0.125, release: 0.1
play (chord_invert (chord :A3, "M"), 0)
sleep 0.5
play (chord_invert (chord :A3, "M"), 1)
sleep 0.5
play (chord_invert (chord :A3, "M"), 2)
sleep 0.5

The program showchords.rb puts the note names of a chord and plays them

The program chordinversion3.rb creates a new function to play a song

define :chordinvert do |tonic,name,iseq,timeseq|
  i=0
  while  i<iseq.length
    puts i
    puts tonic,name,timeseq[i],iseq[i]
    puts tonic.intern
    play (chord_invert (chord tonic.intern,name),
          iseq[i])
    sleep timeseq[i]*xx
    i+=1
  end
end

tonic and name specify the chord

iseq is an array of integers 0,1,or 2 that specify the inversion number

timeseq is an array of floats that specify the time each iseq inversion of the chord is to play

the arrays iseq and timeseq must contain an equal number of elements.

The program plays a song using the chord inversion sequences.

Listen here:

Listen

working-with-sonic-pi-chord-inversions's People

Contributors

clearmemory041063 avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.