Sha256: 0aef275b54d505c2b865132f8d2a560ead9f138158cb77e6fe750ed9d33cc25f

Contents?: true

Size: 1.64 KB

Versions: 6

Compression:

Stored size: 1.64 KB

Contents

require 'music-transcription'
require 'yaml'

include Music::Transcription
include Pitches

bass_riff = [
  # 0.0
  Note.new(Rational(1,6), [ Bb2 ]),
  Note.new(Rational(1,4)),
  Note.new(Rational(1,3), [ Ab2 ]),
  Note.new(Rational(1,6), [ F2 ]),
  Note.new(Rational(1,12), [ Ab2 ]),
  # 1.0
  Note.new(Rational(1,6), [ Bb2 ]),
  Note::Quarter.new,
  Note.new(Rational(1,3), [ Ab2 ]),
  Note::Quarter.new([ Ab2 ]),
]

lead_riff = [
  # 0.0
  Note.new(Rational(1,6), [ Bb3 ]),
  Note.new(Rational(1,4)),
  Note.new(Rational(1,12), [ Db4 ], links: {Db4 => Link::Slur.new(Db4)}),
  Note.new(Rational(1,6), [ Db4 ], links: {Db4 => Link::Slur.new(Db4)}),
  Note.new(Rational(1,36), [ Db4 ]),
  Note.new(Rational(1,36), [ Eb4 ]),
  Note.new(Rational(1,36), [ Db4 ]),
  Note.new(Rational(1,6), [ Ab3 ]),
  Note.new(Rational(1,12), [ Db4 ]),
  # 1.0
  Note.new(Rational(1,6), [ Bb3 ]),
  Note.new(Rational(1,4)),
  Note.new(Rational(1,12), [ Db4 ], links: {Db4 => Link::Slur.new(Db4)}),
  Note::Quarter.new([ Db4 ], links: {Db4 => Link::Slur.new(Db4)}),
  Note::Eighth.new([ Db4 ], links: {Db4 => Link::Portamento.new(C4)}),
  Note::Eighth.new([ C4 ]),
]

whole_step = Pitch.new(:semitone => 2)
bass_notes = bass_riff + bass_riff.map {|note| note.transpose(whole_step) }
lead_notes = lead_riff + lead_riff.map {|note| note.transpose(whole_step) }

score = Score.new(
  Meter.new(4,"1/4".to_r),
  120,
  program: Program.new([0...2, 0...2,2...4,0...2]),
  parts: {
    "lead" => Part.new(
      Dynamics::MF,
      notes: lead_notes
    ),
    "bass" => Part.new(
      Dynamics::MP,
      notes: bass_notes
    )
  }
)

File.open('hip.yml','w') do |file|
  file.write score.to_yaml
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
music-transcription-0.8.1 examples/make_hip.rb
music-transcription-0.8.0 examples/make_hip.rb
music-transcription-0.7.3 examples/make_hip.rb
music-transcription-0.7.2 examples/make_hip.rb
music-transcription-0.7.1 examples/make_hip.rb
music-transcription-0.7.0 examples/make_hip.rb