feep 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/bin/feep +7 -7
- data/lib/feep/scale.rb +3 -3
- data/lib/feep/sound_player.rb +7 -7
- data/lib/feep/version.rb +1 -1
- data/spec/feep_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e87c34f7d21c5d23b2669158b25ce0fc0fd1bf60
|
4
|
+
data.tar.gz: edf55481d50da651ffd4d48e907ba1e8e310660a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7e7b72212d937917828282e0523133e9b1ef38d61d6c47e42a3b860a9d9270444ebc5ec08483e547cc84e8532277ca0b8a6e2617ac56771722bed82c13236c
|
7
|
+
data.tar.gz: 985dab8e5d8b3e4aafd0547bfeeddaaed048448f0d50b5f18c85f5eda8aa2e33a5bd8f6fd873790a675444805811991641daf4c6c3e703b83aa298950e9c0cdb
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/feep.svg)](http://badge.fury.io/rb/feep)
|
3
3
|
|
4
4
|
## Wha?
|
5
|
-
Use the power of Ruby gems to make your computer [feep](http://dictionary.reference.com/browse/feep) (except more musically) using sweet [WAV-file-writing technology](http://wavefilegem.com) from [Joel Strait](https://github.com/jstrait). Works on both Windows and
|
5
|
+
Use the power of Ruby gems to make your computer [feep](http://dictionary.reference.com/browse/feep) (except more musically) using sweet [WAV-file-writing technology](http://wavefilegem.com) from [Joel Strait](https://github.com/jstrait). Works on both Windows and \*nix (including OS X) as it uses the standard WAV format to do its bidding.
|
6
6
|
|
7
|
-
_Note:_ In order for the sound-playing magic to work on Windows, you will need [sounder](http://www.elifulkerson.com/projects/commandline-wav-player.php), a free command-line WAV file player on your system and in your path. Mac and
|
7
|
+
_Note:_ In order for the sound-playing magic to work on Windows, you will need [sounder](http://www.elifulkerson.com/projects/commandline-wav-player.php), a free command-line WAV file player on your system and in your path. Mac and \*nix uses `afplay`, which should be built-in, but feel free to change either to something you already have or desire to install.
|
8
8
|
|
9
9
|
## Why?
|
10
10
|
|
@@ -18,7 +18,7 @@ Feep doesn't require any parameters, as it will play a 440Hz/A4 sine wave at 50%
|
|
18
18
|
|
19
19
|
The full usage looks like this:
|
20
20
|
|
21
|
-
`feep [-f, --frequency FREQUENCY] [-n, --note NOTE_NAME] [-s, --scale SCALE_ID] [--degrees SCALE_DEGREES] [-w, --waveform WAVEFORM_ID] [-a, --amplitude MAX_AMPLITUDE] [-d, --duration DURATION] [--save] [--
|
21
|
+
`feep [-f, --frequency FREQUENCY] [-n, --note NOTE_NAME] [-s, --scale SCALE_ID] [--degrees SCALE_DEGREES] [-w, --waveform WAVEFORM_ID] [-a, --amplitude MAX_AMPLITUDE] [-d, --duration DURATION] [--save] [--verbose] [--visual_cue]`
|
22
22
|
|
23
23
|
`-f, --frequency, -n, --note`: a number from 0 to 20000, or a valid note name from C0 to B9 (including sharps and flats). Both `-f|--frequency` and `-n|--note` parameters can take either kind; they're both supported mainly for ease of use. You can try a frequency outside of this range, but you may get odd results. You may also enter some combination of these with commas between them and it'll play all of them together in a chord.
|
24
24
|
|
@@ -34,7 +34,9 @@ The full usage looks like this:
|
|
34
34
|
|
35
35
|
`--save`: switch to save the resulting WAV file in the current directory. Will create it in the format of `waveform_frequency-in-Hz_volume_duration.wav`.
|
36
36
|
|
37
|
-
`--
|
37
|
+
`--verbose`: switch that displays note and file-making information.
|
38
|
+
|
39
|
+
`--visual_cue`: switch that display a cute "Feep!" message, the length of which determined by the duration of the feep.
|
38
40
|
|
39
41
|
## Examples
|
40
42
|
|
data/bin/feep
CHANGED
@@ -13,14 +13,14 @@ def parse_options
|
|
13
13
|
:volume => 0.5,
|
14
14
|
:duration => 100,
|
15
15
|
:save => false,
|
16
|
-
:
|
17
|
-
:
|
16
|
+
:verbose => false,
|
17
|
+
:visual_cue => false,
|
18
18
|
:usage => nil
|
19
19
|
}
|
20
20
|
|
21
21
|
optparse = OptionParser.new do |opts|
|
22
22
|
opts.banner = "Play sounds on the command line\n"
|
23
|
-
opts.banner += "usage: feep [-f, -n, --frequency, --note FREQUENCY|NOTE_NAME] [-s, --scale SCALE_ID] [-sd, --degrees NUMBER_OF_SCALE_DEGREES] [-w, --waveform WAVEFORM_ID] [-a, --amplitude MAX_AMPLITUDE] [-d, --duration DURATION] [--save] [--
|
23
|
+
opts.banner += "usage: feep [-f, -n, --frequency, --note FREQUENCY|NOTE_NAME] [-s, --scale SCALE_ID] [-sd, --degrees NUMBER_OF_SCALE_DEGREES] [-w, --waveform WAVEFORM_ID] [-a, --amplitude MAX_AMPLITUDE] [-d, --duration DURATION] [--save] [--verbose] [--visual_cue]\n\n"
|
24
24
|
|
25
25
|
opts.on('-f', '--frequency FREQUENCY', 'One or more frequencies or to play at once, e.g. 440 or 220,440,880') do |frequency|
|
26
26
|
options[:freq_or_note] = frequency
|
@@ -54,12 +54,12 @@ def parse_options
|
|
54
54
|
options[:save] = true
|
55
55
|
end
|
56
56
|
|
57
|
-
opts.on('--
|
58
|
-
options[:
|
57
|
+
opts.on('--verbose', 'Displays information about note(s) being played') do
|
58
|
+
options[:verbose] = true
|
59
59
|
end
|
60
60
|
|
61
|
-
opts.on('--
|
62
|
-
options[:
|
61
|
+
opts.on('--visual_cue', 'Display "Feeep!" text on play') do
|
62
|
+
options[:visual_cue] = true
|
63
63
|
end
|
64
64
|
|
65
65
|
opts.on('-v', '--version', 'Display version number and exit') do
|
data/lib/feep/scale.rb
CHANGED
@@ -27,18 +27,18 @@ module Feep
|
|
27
27
|
:volume => options[:volume],
|
28
28
|
:duration => options[:duration],
|
29
29
|
:save => options[:save],
|
30
|
-
:
|
30
|
+
:verbose => options[:verbose]
|
31
31
|
}
|
32
32
|
|
33
33
|
# play number of degrees of scale supplied or one octave by default
|
34
34
|
degrees = options[:degrees] || steps.length
|
35
35
|
|
36
|
-
if options[:
|
36
|
+
if options[:verbose]
|
37
37
|
puts "Playing a #{options[:scale]} scale..."
|
38
38
|
end
|
39
39
|
|
40
40
|
1.upto(degrees.to_i) {|deg|
|
41
|
-
if options[:
|
41
|
+
if options[:verbose]
|
42
42
|
puts "note: #{NOTE_FREQ.key(freq)}, freq: #{freq}"
|
43
43
|
end
|
44
44
|
|
data/lib/feep/sound_player.rb
CHANGED
@@ -7,22 +7,22 @@ module Feep
|
|
7
7
|
|
8
8
|
# main function that creates, plays, and removes note
|
9
9
|
def play_note(frequency, output_filename, samples_to_write, options)
|
10
|
-
if options[:
|
10
|
+
if options[:verbose]
|
11
11
|
puts 'Playing note'
|
12
12
|
puts " frequency: #{frequency.to_f.abs}"
|
13
13
|
puts " midi: #{Utils.freq_to_midi(frequency)}"
|
14
14
|
puts " duration: #{options[:duration]}"
|
15
15
|
end
|
16
16
|
SoundFile.new.create_sound(frequency, samples_to_write, output_filename, options)
|
17
|
-
play_wav_file(output_filename, options[:duration], options[:
|
17
|
+
play_wav_file(output_filename, options[:duration], options[:visual_cue])
|
18
18
|
remove_sound(output_filename, options)
|
19
19
|
end
|
20
20
|
|
21
21
|
# use command line app to play wav file
|
22
|
-
def play_wav_file(file, duration,
|
22
|
+
def play_wav_file(file, duration, visual_cue)
|
23
23
|
if OS.windows?
|
24
24
|
if command_exists?(SNDPLAYER_WIN)
|
25
|
-
display_text_beep(duration)
|
25
|
+
display_text_beep(duration) if visual_cue
|
26
26
|
system("#{SNDPLAYER_WIN} #{file}")
|
27
27
|
else
|
28
28
|
puts "couldn't find #{SNDPLAYER_WIN}"
|
@@ -31,7 +31,7 @@ module Feep
|
|
31
31
|
|
32
32
|
if OS.mac? || OS.linux?
|
33
33
|
if command_exists?(SNDPLAYER_UNIX)
|
34
|
-
display_text_beep(duration)
|
34
|
+
display_text_beep(duration) if visual_cue
|
35
35
|
system("#{SNDPLAYER_UNIX} #{file}")
|
36
36
|
else
|
37
37
|
puts "couldn't find #{SNDPLAYER_UNIX}"
|
@@ -50,7 +50,7 @@ module Feep
|
|
50
50
|
puts 'ep!'
|
51
51
|
end
|
52
52
|
|
53
|
-
# removes the sound, unless marked to save,
|
53
|
+
# removes the sound, unless marked to save,
|
54
54
|
# and optionally display info about file
|
55
55
|
def remove_sound(file, options)
|
56
56
|
unless options[:save]
|
@@ -60,7 +60,7 @@ module Feep
|
|
60
60
|
system("rm #{file}")
|
61
61
|
end
|
62
62
|
else
|
63
|
-
if options[:
|
63
|
+
if options[:verbose]
|
64
64
|
info = WaveFile::Reader.info(file)
|
65
65
|
duration = info.duration
|
66
66
|
formatted_duration = duration.minutes.to_s.rjust(2, '0') << ':' <<
|
data/lib/feep/version.rb
CHANGED
data/spec/feep_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wavefile
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.6.
|
162
|
+
rubygems_version: 2.6.11
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Make your computer feep with Ruby
|