Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: complex-pitch
Fetching contributors…

Cannot retrieve contributors at this time

file 30 lines (26 sloc) 0.68 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
require File.join( File.dirname(__FILE__), 'spec_helper')
require 'rational'
require 'music/midi_time'

include Music

describe Music, "midi interface" do
  
  describe MidiTime do
    it "should convert qn to ppqn" do
      t = MidiTime.new(480)
      { 1 => 480,
        1.0 => 480,
        2 => 960,
        2.0 => 960,
        2.quo(1) => 960,
        0.5 => 240,
        1.quo(2) => 240,
        1.quo(3) => 160,
        1.quo(7) => 69
      }.each do |dur,ppqn|
        x = t.ppqn(dur)
        x.should be_kind_of(Integer)
        x.should == ppqn
      end
      
      proc { t.ppqn(".5") }.should raise_error(ArgumentError)
    end
  end
end
Something went wrong with that request. Please try again.