Skip to content

Commit

Permalink
Merge pull request #4 from DimitriosLisenko/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
DimitriosLisenko authored Sep 1, 2021
2 parents bf26ad4 + fda067c commit a70b127
Show file tree
Hide file tree
Showing 57 changed files with 2,245 additions and 588 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ruby

on: [push,pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
bundler-cache: true
- name: Run the default task
run: bundle exec rake
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
14 changes: 11 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
singing
listening
listening_single_note
/singing/
/listening/
/listening_single_note/
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
47 changes: 47 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
AllCops:
TargetRubyVersion: 3.0
NewCops: enable

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Style/TrailingCommaInArrayLiteral:
Enabled: true
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArguments:
Enabled: true
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInHashLiteral:
Enabled: true
EnforcedStyleForMultiline: consistent_comma

Style/RaiseArgs:
Enabled: true
EnforcedStyle: compact

Style/WordArray:
Enabled: true
EnforcedStyle: brackets

Style/SymbolArray:
Enabled: true
EnforcedStyle: brackets

Layout/CaseIndentation:
Enabled: true

Layout/LineLength:
Max: 175

Style/RedundantReturn:
Enabled: false

Style/EmptyCaseCondition:
Enabled: false
1 change: 1 addition & 0 deletions .ruby_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## [Unreleased]

## [0.1.0] - 2021-08-26

- Initial release
20 changes: 18 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
source 'https://rubygems.org'
# frozen_string_literal: true

gem 'midilib', '~> 2.0', '>= 2.0.5'
source "https://rubygems.org"

# Specify your gem's runtime dependencies in fet.gemspec
gemspec

group :test do
gem "minitest", "~> 5.0"
gem "simplecov", "~> 0.21.2"
end

group :test, :development do
gem "codecov", "~> 0.6.0"
gem "pry-byebug", "~> 3.9"
gem "rake", "~> 13.0"
gem "rdoc", "~> 6.3", ">= 6.3.2"
gem "rubocop", "~> 1.7"
end
64 changes: 61 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,71 @@
PATH
remote: .
specs:
fet (0.2.0)
gli (~> 2.20, >= 2.20.1)
ice_nine (~> 0.11.2)
midilib (~> 2.0, >= 2.0.5)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
byebug (11.1.3)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
coderay (1.1.3)
docile (1.4.0)
gli (2.20.1)
ice_nine (0.11.2)
method_source (1.0.0)
midilib (2.0.5)
minitest (5.14.4)
parallel (1.20.1)
parser (3.0.2.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rainbow (3.0.0)
rake (13.0.6)
rdoc (6.3.2)
regexp_parser (2.1.1)
rexml (3.2.5)
rubocop (1.20.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.9.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.11.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
unicode-display_width (2.0.0)

PLATFORMS
x86_64-darwin-20
ruby

DEPENDENCIES
midilib (~> 2.0, >= 2.0.5)
codecov (~> 0.6.0)
fet!
minitest (~> 5.0)
pry-byebug (~> 3.9)
rake (~> 13.0)
rdoc (~> 6.3, >= 6.3.2)
rubocop (~> 1.7)
simplecov (~> 0.21.2)

BUNDLED WITH
2.2.15
2.2.22
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Dimitrios Lisenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
97 changes: 52 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
[![codecov](https://codecov.io/gh/DimitriosLisenko/fet/branch/master/graph/badge.svg?token=6W2B0Z4E4S)](https://codecov.io/gh/DimitriosLisenko/fet)

# FET (Functional Ear Training)
Create midi/mp3 files for functional ear training. Each file will contain a major/minor chord progression, followed by note(s) that you should identify the scale degree of by ear.
# FET (Functional Ear Trainer)
Create MIDI files for functional ear training. Each file will contain a major/minor chord progression, followed by note(s) that you should identify the scale degree of by ear.

## Usage
### Listening Exercises
```sh
ruby generate_listening_exercises.rb {number_of_degrees} {number_of_exercises} {tempo}
## Installation
Add this line to your application's Gemfile:

```ruby
gem 'fet'
```

`number_of_degrees`: After the chord progression, how many distinct degrees to play. Values from 1 to 11 are allowed. Suggested value: 1.
And then execute:

`number_of_exercises`: How many exercises to generate per progression. Suggested value: 100.
$ bundle install

`tempo`: How fast the chord progression + notes play - the faster, the harder the exercise is. Suggested value: 120.
Or install it yourself as:

For example, running the following command:
```sh
ruby generate_listening_exercises.rb 2 5 120
```
could generate the following files in the root of the project:
$ gem install fet

## Usage
Refer to [the rdoc](https://github.com/DimitriosLisenko/fet/blob/master/fet.rdoc) for detailed usage instructions and descriptions of commands.

## Filename Format
The generators will currently create MIDI files. The correct answer is included in the filename.

### Listening exercises
For listening exercises, here is a potential list of generated MIDI files (for 2 degrees):
```sh
$ find .
...
Expand Down Expand Up @@ -48,28 +54,8 @@ The file name contains all the information required for the answer. For example,

`(G#2)`: the [scientific pitch notation](https://en.wikipedia.org/wiki/Scientific_pitch_notation) of which is G#2

These midi files can then be converted to MP3 if required via:
```
midi_to_mp3.sh listening
```

The midi/mp3 files can then be placed on shuffle in an audio player and drilled.

### Singing Exercises
```sh
ruby generate_singing_exercises.rb {tempo} {sleep_duration}
```

`tempo`: How fast the chord progression + notes play - the faster, the harder the exercise is. Suggested value: 120.

`sleep_duration`: After the chord progression, how many seconds to wait before playing the answer so you can compare it with what you sang. Values from 1 to 60 are allowed. Suggested value: 3.


For example, running the following command:
```sh
ruby generate_singing_exercises.rb 120 3
```
will generate all possible combinations for keys and degrees in the root of the project:
### Singing exercises
The singing exercises will generate all possible combinations for keys and degrees as follows:
```sh
$ find .
...
Expand All @@ -92,15 +78,36 @@ The file name contains all the information required for the answer. For example,

`3`: you should sing the 3rd degree.

These midi files can then be converted to MP3 if required via:
```
midi_to_mp3.sh singing
### Single Note Listening exercises
For single note listening exercises, the same note is played across all possible keys:
```sh
$ find .
...
./listening_single_note/major/CM_1.mid
./listening_single_note/major/BM_b2.mid
./listening_single_note/major/F#M_b5.mid
...
./listening_single_note/minor/Am_b3.mid
./listening_single_note/minor/G#m_3.mid
./listening_single_note/minor/Cm_1.mid
...
```
The file name contains all the information required for the answer. For example, `G#m_3.mid`:

The midi/mp3 files can then be placed on shuffle in an audio player and drilled.
`G#m`: the chord progression is in G# Minor.

## Installing Dependencies
### OS X
```
brew install timidity lame
```
`3`: the note that is played is the 3rd degree in this key.

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DimitriosLisenko/fet.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
6 changes: 6 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= fet

FET (Functional Ear Trainer)

:include:fet.rdoc

23 changes: 23 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end

require "rubocop/rake_task"

RuboCop::RakeTask.new

require "rdoc/task"
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb", "bin/**/*")
rd.title = "FET (Functional Ear Trainer)"
end

task(default: [:test, :rubocop])
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "fet"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
Loading

0 comments on commit a70b127

Please sign in to comment.