tetsujin 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8387e5d1a33b5216b6c4e6582a177021364deca9993d38348fddc920746f72e6
4
- data.tar.gz: 7da91bdede287a154db7540e21f7d9d94725cad16e8bb4d4263b830aa432312d
3
+ metadata.gz: d6a9279855f7d0c718185bb8ed486a3776f7ccfb8c60dfc6af1013399a31e35c
4
+ data.tar.gz: 8f3852d8bf63e5f125150471c1456b72e4e0cc20b34660e575804a2dce9c22d6
5
5
  SHA512:
6
- metadata.gz: 0c80e2e2cc875565d6302f95ce9862cbea0578f5a9ce2e865e520bfd1fc13870188d566bf189f11bfbe63de6866a9750a7e96293e44c616026d29384e93d400a
7
- data.tar.gz: '08a835992f845f166e9fb6be0148fa9f72b7a7956ed31e3894f4eb54d5efe898825a5ab87e0c35718d2eab509525af6d32c5ac624225448e08b47d87f417ab32'
6
+ metadata.gz: 0dd1cb8536f142f4634dc0d36ec028ecbb266e2ed0d921637783979cf2f0a284ee52df5966eccb0f96e46c7d1d868f3c923fded3a4e51ece578d4393021a33c1
7
+ data.tar.gz: dabffa5e60b3c2238f6fd7e95777c1c758f5e881193142190ec0fbe2851c1dedd0066b4c664d100bf57cadff663bd83a202bdcfe8efe939fe73eeed206f7eca9
data/README.md CHANGED
@@ -1,24 +1,116 @@
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
5
+ ```
6
+ $ gem install tetsujin
7
+ ```
18
8
 
19
9
  ## Usage
20
10
 
21
- TODO: Write usage instructions here
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
22
+
23
+ ```ruby
24
+ # Can generate C4 sound
25
+ c_note = create_note("C", 4)
26
+ c_note = create_note("ド", 4)
27
+ ```
28
+
29
+ ### Generate a Scale
30
+
31
+ ```ruby
32
+ # Can generate major scales starting from C4
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")
36
+ ```
37
+
38
+ ### Generate a Guitar
39
+
40
+ ```ruby
41
+ # Can generate a guitar in regular tuning
42
+ guitar = create_regular_tuning_guitar(fretboard_length: 22)
43
+
44
+ # Can generate custom tuned guitars
45
+ tunings = [
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)
53
+ ]
54
+ guitar = create_guitar(tunings: tunings, fretboard_length: 22)
55
+ ```
56
+
57
+ ### Playing notes on the guitar
58
+
59
+ ```ruby
60
+ guitar = create_regular_tuning_guitar(fretboard_length: 12)
61
+
62
+ c_note = create_note("C", 4)
63
+ d_note = create_note("D", 4)
64
+
65
+ guitar.play!([c_note, d_note])
66
+ display_guitar(guitar)
67
+
68
+ # 1 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
69
+ # 2 : ------- C4 ------- D4 ------- ------- ------- ------- ------- ------- ------- ------- -------
70
+ # 3 : ------- ------- ------- ------- ------- C4 ------- D4 ------- ------- ------- ------- -------
71
+ # 4 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- C4 ------- D4
72
+ # 5 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
73
+ # 6 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
74
+ # : 0 1 2 3 4 5 6 7 8 9 10 11 12
75
+ ```
76
+
77
+ ### Playing scales on the guitar
78
+
79
+ ```ruby
80
+ guitar = create_regular_tuning_guitar(fretboard_length: 12)
81
+
82
+ c_note = create_note("C", 4)
83
+ c_major_scale = create_scale(c_note, :major)
84
+
85
+ guitar.play!(c_major_scale)
86
+ create_display_guitar(guitar)
87
+
88
+ # 1 : E4 F4 ------- G4 ------- A4 ------- B4 C5 ------- ------- ------- -------
89
+ # 2 : ------- C4 ------- D4 ------- E4 F4 ------- G4 ------- A4 ------- B4
90
+ # 3 : ------- ------- ------- ------- ------- C4 ------- D4 ------- E4 F4 ------- G4
91
+ # 4 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- C4 ------- D4
92
+ # 5 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
93
+ # 6 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
94
+ # : 0 1 2 3 4 5 6 7 8 9 10 11 12
95
+ ```
96
+
97
+ ### Pressing frets
98
+
99
+ ```ruby
100
+ guitar = create_regular_tuning_guitar(fretboard_length: 12)
101
+
102
+ guitar.press!(2, 1)
103
+ guitar.press!(2, 3)
104
+ display_guitar(guitar)
105
+
106
+ # 1 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
107
+ # 2 : ------- C4 ------- D4 ------- ------- ------- ------- ------- ------- ------- ------- -------
108
+ # 3 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
109
+ # 4 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
110
+ # 5 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
111
+ # 6 : ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
112
+ # : 0 1 2 3 4 5 6 7 8 9 10 11 12
113
+ ```
22
114
 
23
115
  ## Development
24
116
 
@@ -5,7 +5,7 @@ module Tetsujin
5
5
  module Instrument
6
6
  # @param fretboard_length [Integer] フレット数
7
7
  # @return [Tetsujin::Instrument::Guitar]
8
- def regular_tuning_guitar(fretboard_length:)
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
- guitar(tunings: tunings, fretboard_length: fretboard_length)
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 guitar(tunings:, fretboard_length:)
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
 
@@ -5,13 +5,13 @@ module Tetsujin
5
5
  module Theory
6
6
  # @param name [String] 音名
7
7
  # @param octave [Integer] オクターブ
8
- def note(name, octave)
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 scale(root, pattern)
14
+ def create_scale(root, pattern)
15
15
  Tetsujin::Theory::Scale.new(root: root, pattern: pattern.to_sym)
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tetsujin
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
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.1.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-08-25 00:00:00.000000000 Z
11
+ date: 2024-09-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: