Project

post_tonal

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby library for analyzing pitch-class sets according to post-tonal theory
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.9.5
>= 0
>= 2.1.1
 Project Readme

PostTonal

PostTonal is a Ruby library for analyzing sets of musical pitches. It's based on pitch class set theory pioneered by Allen Forte.

Install

  • gem install post_tonal --pre
  • In your Gemfile: gem "post_tonal", "~> 0.1.0.pre"

Usage

Setup

require 'post_tonal'

Define a pitch-class set

set = PostTonal::PitchClassSet.new

#Add the set [C, C#, D#, E, G] <-(recognize this collection?)  
set.add_pitch 0  # or set.add_pitch 'c'  
set.add_pitch 1  # or set.add_pitch 'c#'  
set.add_pitch 3  # or set.add_pitch 'd#'  
set.add_pitch 4  # or set.add_pitch 'e'  
set.add_pitch 6  # or set.add_pitch 'g'  

Transformations

# Get the normal form
puts set.normal_form

# Get the prime form
puts set.prime_form

# Get an inversion of the set
puts set.inversion

# Get a transposition of the set
puts set.transpose 4

All transformations return a new PitchClassSet object, and are thus non-destructive. Transformations can be chained:

set.inversion.transpose(6) #Transpose the inversion of the set by +6  
set.normal_form.inversion #Invert the normal form of the set

License

post_tonal is free software, and may be redistributed under the terms specified in the LICENSE file.