tetsujin 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -31
- data/lib/tetsujin/dsl/instrument.rb +3 -3
- data/lib/tetsujin/dsl/theory.rb +2 -2
- data/lib/tetsujin/version.rb +1 -1
- metadata +2 -3
- data/tetsujin.gemspec +0 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6a9279855f7d0c718185bb8ed486a3776f7ccfb8c60dfc6af1013399a31e35c
|
|
4
|
+
data.tar.gz: 8f3852d8bf63e5f125150471c1456b72e4e0cc20b34660e575804a2dce9c22d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0dd1cb8536f142f4634dc0d36ec028ecbb266e2ed0d921637783979cf2f0a284ee52df5966eccb0f96e46c7d1d868f3c923fded3a4e51ece578d4393021a33c1
|
|
7
|
+
data.tar.gz: dabffa5e60b3c2238f6fd7e95777c1c758f5e881193142190ec0fbe2851c1dedd0066b4c664d100bf57cadff663bd83a202bdcfe8efe939fe73eeed206f7eca9
|
data/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# Tetsujin
|
|
2
2
|
|
|
3
|
-
TODO: Delete this and the text below, and describe your gem
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tetsujin`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
-
|
|
7
3
|
## Installation
|
|
8
4
|
|
|
9
5
|
```
|
|
@@ -12,52 +8,62 @@ $ gem install tetsujin
|
|
|
12
8
|
|
|
13
9
|
## Usage
|
|
14
10
|
|
|
15
|
-
###
|
|
11
|
+
### Please include Tetsujin Module
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require "tetsujin"
|
|
15
|
+
|
|
16
|
+
class YourClass
|
|
17
|
+
include Tetsujin
|
|
18
|
+
end
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Generate a Note
|
|
16
22
|
|
|
17
23
|
```ruby
|
|
18
24
|
# Can generate C4 sound
|
|
19
|
-
c_note =
|
|
20
|
-
c_note =
|
|
25
|
+
c_note = create_note("C", 4)
|
|
26
|
+
c_note = create_note("ド", 4)
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
### Generate Scale
|
|
29
|
+
### Generate a Scale
|
|
24
30
|
|
|
25
31
|
```ruby
|
|
26
32
|
# Can generate major scales starting from C4
|
|
27
|
-
c_note =
|
|
28
|
-
c_major_scale =
|
|
29
|
-
c_major_scale =
|
|
33
|
+
c_note = create_note("C", 4)
|
|
34
|
+
c_major_scale = create_scale(c_note, :major)
|
|
35
|
+
c_major_scale = create_scale(c_note, "major")
|
|
30
36
|
```
|
|
31
37
|
|
|
32
|
-
### Generate Guitar
|
|
38
|
+
### Generate a Guitar
|
|
33
39
|
|
|
34
40
|
```ruby
|
|
35
41
|
# Can generate a guitar in regular tuning
|
|
36
|
-
guitar =
|
|
42
|
+
guitar = create_regular_tuning_guitar(fretboard_length: 22)
|
|
37
43
|
|
|
38
44
|
# Can generate custom tuned guitars
|
|
39
45
|
tunings = [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
create_note("B", 2),
|
|
47
|
+
create_note("E", 2),
|
|
48
|
+
create_note("A", 2),
|
|
49
|
+
create_note("D", 3),
|
|
50
|
+
create_note("G", 3),
|
|
51
|
+
create_note("B", 3),
|
|
52
|
+
create_note("E", 4)
|
|
47
53
|
]
|
|
48
|
-
guitar =
|
|
54
|
+
guitar = create_guitar(tunings: tunings, fretboard_length: 22)
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
### Playing notes on the guitar
|
|
52
58
|
|
|
53
59
|
```ruby
|
|
54
|
-
guitar =
|
|
60
|
+
guitar = create_regular_tuning_guitar(fretboard_length: 12)
|
|
55
61
|
|
|
56
|
-
c_note =
|
|
57
|
-
d_note =
|
|
62
|
+
c_note = create_note("C", 4)
|
|
63
|
+
d_note = create_note("D", 4)
|
|
58
64
|
|
|
59
65
|
guitar.play!([c_note, d_note])
|
|
60
|
-
|
|
66
|
+
display_guitar(guitar)
|
|
61
67
|
|
|
62
68
|
# 1 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
|
|
63
69
|
# 2 : ------- C4 ------- D4 ------- ------- ------- ------- ------- ------- ------- ------- -------
|
|
@@ -71,13 +77,13 @@ Tetsujin.display_guitar(guitar)
|
|
|
71
77
|
### Playing scales on the guitar
|
|
72
78
|
|
|
73
79
|
```ruby
|
|
74
|
-
guitar =
|
|
80
|
+
guitar = create_regular_tuning_guitar(fretboard_length: 12)
|
|
75
81
|
|
|
76
|
-
c_note =
|
|
77
|
-
c_major_scale =
|
|
82
|
+
c_note = create_note("C", 4)
|
|
83
|
+
c_major_scale = create_scale(c_note, :major)
|
|
78
84
|
|
|
79
85
|
guitar.play!(c_major_scale)
|
|
80
|
-
|
|
86
|
+
create_display_guitar(guitar)
|
|
81
87
|
|
|
82
88
|
# 1 : E4 F4 ------- G4 ------- A4 ------- B4 C5 ------- ------- ------- -------
|
|
83
89
|
# 2 : ------- C4 ------- D4 ------- E4 F4 ------- G4 ------- A4 ------- B4
|
|
@@ -91,11 +97,11 @@ Tetsujin.display_guitar(guitar)
|
|
|
91
97
|
### Pressing frets
|
|
92
98
|
|
|
93
99
|
```ruby
|
|
94
|
-
guitar =
|
|
100
|
+
guitar = create_regular_tuning_guitar(fretboard_length: 12)
|
|
95
101
|
|
|
96
102
|
guitar.press!(2, 1)
|
|
97
103
|
guitar.press!(2, 3)
|
|
98
|
-
|
|
104
|
+
display_guitar(guitar)
|
|
99
105
|
|
|
100
106
|
# 1 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
|
|
101
107
|
# 2 : ------- C4 ------- D4 ------- ------- ------- ------- ------- ------- ------- ------- -------
|
|
@@ -5,7 +5,7 @@ module Tetsujin
|
|
|
5
5
|
module Instrument
|
|
6
6
|
# @param fretboard_length [Integer] フレット数
|
|
7
7
|
# @return [Tetsujin::Instrument::Guitar]
|
|
8
|
-
def
|
|
8
|
+
def create_regular_tuning_guitar(fretboard_length:)
|
|
9
9
|
tunings = [
|
|
10
10
|
Tetsujin::Theory::Note.new(pitch_class: 4, octave: 2),
|
|
11
11
|
Tetsujin::Theory::Note.new(pitch_class: 9, octave: 2),
|
|
@@ -14,12 +14,12 @@ module Tetsujin
|
|
|
14
14
|
Tetsujin::Theory::Note.new(pitch_class: 11, octave: 3),
|
|
15
15
|
Tetsujin::Theory::Note.new(pitch_class: 4, octave: 4)
|
|
16
16
|
]
|
|
17
|
-
|
|
17
|
+
create_guitar(tunings: tunings, fretboard_length: fretboard_length)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# @param tunings [Array<Tetsujin::Theory::Note>] チューニング 低い方から順に
|
|
21
21
|
# @param fretboard_length [Integer] フレット数
|
|
22
|
-
def
|
|
22
|
+
def create_guitar(tunings:, fretboard_length:)
|
|
23
23
|
Tetsujin::Instrument::Guitar::Factory.create(tunings: tunings, fretboard_length: fretboard_length)
|
|
24
24
|
end
|
|
25
25
|
|
data/lib/tetsujin/dsl/theory.rb
CHANGED
|
@@ -5,13 +5,13 @@ module Tetsujin
|
|
|
5
5
|
module Theory
|
|
6
6
|
# @param name [String] 音名
|
|
7
7
|
# @param octave [Integer] オクターブ
|
|
8
|
-
def
|
|
8
|
+
def create_note(name, octave)
|
|
9
9
|
Tetsujin::Theory::Note::Factory.create_from_name(name: name, octave: octave)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# @param root [Tetsujin::Theory::Note] ルート音
|
|
13
13
|
# @param pattern [String | Symbol] スケールのパターン
|
|
14
|
-
def
|
|
14
|
+
def create_scale(root, pattern)
|
|
15
15
|
Tetsujin::Theory::Scale.new(root: root, pattern: pattern.to_sym)
|
|
16
16
|
end
|
|
17
17
|
end
|
data/lib/tetsujin/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tetsujin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mew3880
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -41,7 +41,6 @@ files:
|
|
|
41
41
|
- lib/tetsujin/theory/scale.rb
|
|
42
42
|
- lib/tetsujin/version.rb
|
|
43
43
|
- sig/tetsujin.rbs
|
|
44
|
-
- tetsujin.gemspec
|
|
45
44
|
homepage: https://github.com/Takahashi-Riki/tetsujin
|
|
46
45
|
licenses:
|
|
47
46
|
- MIT
|
data/tetsujin.gemspec
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/tetsujin/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "tetsujin"
|
|
7
|
-
spec.version = Tetsujin::VERSION
|
|
8
|
-
spec.authors = ["mew3880"]
|
|
9
|
-
spec.email = ["mew3880@gmail.com"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "ギターのスケールを生成するライブラリ"
|
|
12
|
-
# spec.description = "TODO: Write a longer description or delete this line."
|
|
13
|
-
spec.homepage = "https://github.com/Takahashi-Riki/tetsujin"
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
-
|
|
17
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
|
18
|
-
|
|
19
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
22
|
-
|
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
|
-
spec.files = Dir.chdir(__dir__) do
|
|
26
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
-
(File.expand_path(f) == __FILE__) ||
|
|
28
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
spec.bindir = "exe"
|
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
33
|
-
spec.require_paths = ["lib"]
|
|
34
|
-
|
|
35
|
-
# Uncomment to register a new dependency of your gem
|
|
36
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
|
37
|
-
|
|
38
|
-
# For more information and examples about making a new gem, check out our
|
|
39
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
|
40
|
-
end
|