feep 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/bin/feep +79 -78
- data/lib/feep/constants.rb +1 -1
- data/lib/feep/version.rb +2 -2
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fbfa4b1a2f1ad90c662578b40edd7bbf4b7730a
|
4
|
+
data.tar.gz: 618b77c63ea478dbb25da2d7f434bb6756ff8c0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bf0d4aef97bc23668c7ba56de50be3bab94bee3e848ebe3ab124b25e395010e5bccd06570ed154003292ada9881f8b0457854043c35df3c0c3335e619f74f9
|
7
|
+
data.tar.gz: 9a12ac8131c8957682042f3af6ff30ff0ccd6a1568accf43d3cfc3ce1f387330217e2bb60008e7b82d4cb18b3f44343491e21c03c48eefc53e65f12dd4f1f946
|
data/README.md
CHANGED
@@ -14,17 +14,17 @@ Besides a quick way to make some kind of noise for fun or testing your speakers,
|
|
14
14
|
|
15
15
|
* `gem install feep`
|
16
16
|
|
17
|
-
Feep doesn't require any parameters, as it will play a 440Hz/A4 sine wave at 50% full volume for
|
17
|
+
Feep doesn't require any parameters, as it will play a 440Hz/A4 sine wave at 50% full volume for 100 milliseconds unless you supply one of the below options. Feep will only save the resulting WAV file(s) it creates if you specify the `--save` parameter.
|
18
18
|
|
19
19
|
The full usage looks like this:
|
20
20
|
|
21
|
-
`feep [-f, -n, --freq-or-note FREQUENCY|NOTE_NAME] [-s, --scale SCALE_ID] [-
|
21
|
+
`feep [-f, -n, --freq-or-note FREQUENCY|NOTE_NAME] [-s, --scale SCALE_ID] [-sd, --degrees SCALE_DEGREES] [-w, --waveform WAVEFORM_ID] [-a, --amplitude MAX_AMPLITUDE] [-d, --duration DURATION] [--save] [--loud]`
|
22
22
|
|
23
23
|
`-f, -n, --freq-or-note`: a number from 0 to 20000, or a valid note name from C0 to B9 (including sharps and flats). 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
|
|
25
|
-
`-s, -scale`: a scale ID that is part of the list that the gem understands
|
25
|
+
`-s, -scale`: a scale ID that is part of the list that the gem understands. If you put in an invalid one, it will list the valid ones.
|
26
26
|
|
27
|
-
`-
|
27
|
+
`-sd, --degrees`: the number of degrees of a scale you want to play. By default, the scale will play one octave.
|
28
28
|
|
29
29
|
`-w, --waveform`: a string equal to "sine", "square", "saw", "triangle", or "noise".
|
30
30
|
|
@@ -32,14 +32,15 @@ The full usage looks like this:
|
|
32
32
|
|
33
33
|
`-d, --duration`: number of milliseconds for the sound to last.
|
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
|
+
`--loud`: switch that displays note and file-making information.
|
38
38
|
|
39
39
|
## Examples
|
40
40
|
|
41
|
-
* `feep` - play a C4 sine wave note at 50% full volume for
|
41
|
+
* `feep` - play a C4 sine wave note at 50% full volume for 100 ms
|
42
42
|
* `feep -n Ab6 -w saw` - play a Ab6 sawtooth wave note at 50% full volume for 200 ms
|
43
43
|
* `feep -n C#5 -w square -a 0.4 -d 500` - play a C#5 square wave note at 40% full volume for 500 ms
|
44
44
|
* `feep -n 2000 -w triangle -a 0.8 -d 2000` - play a 2000Hz triangle wave note at 80% full volume for 2000 ms
|
45
45
|
* `feep -n C3 -s major` - play a major scale with C3 as the root note
|
46
|
+
* `feep -n D#5 -s whole_note -d 20` - play 20 degrees of a whole note scale with D#5 as the root note
|
data/bin/feep
CHANGED
@@ -1,78 +1,79 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require_relative '../lib/feep'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
optparse.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
puts "
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../lib/feep'
|
5
|
+
require_relative '../lib/feep/version'
|
6
|
+
|
7
|
+
def parse_options
|
8
|
+
options = {:freq_or_note => '440.000', :scale => nil, :waveform => 'sine', :volume => 0.5, :duration => 100, :save => false, :loud => false, :usage => nil}
|
9
|
+
|
10
|
+
optparse = OptionParser.new do |opts|
|
11
|
+
opts.banner = 'usage: feep [-f, -n, --freq-or-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] [--loud]'
|
12
|
+
|
13
|
+
opts.on('-f', '-n', '--freq-or-note FREQUENCY|NOTE_NAME', 'One or more frequencies or note names to play at once, e.g. 440 or A4 or 220,440,880') do |f_or_n|
|
14
|
+
options[:freq_or_note] = f_or_n
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on('-s', '--scale SCALE_ID', 'Name of a scale to play') do |s|
|
18
|
+
options[:scale] = s
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-sd', '--degrees SCALE_DEGREES', 'Number of degrees of the scale to play') do |sd|
|
22
|
+
options[:degrees] = sd
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('-w', '--waveform WAVEFORM', 'Waveform type to use for the sound') do |w|
|
26
|
+
options[:waveform] = w
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on('-a', '--amplitude MAX_AMPLITUDE', 'Amplitude/volume (0.0 - 1.0) to play the sound(s) at') do |a|
|
30
|
+
options[:volume] = a.to_f
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on('-d', '--duration DURATION', 'Duration in ms to play the sound(s)') do |d|
|
34
|
+
options[:duration] = d.to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on('--save', 'Save the resulting WAV file in the current directory') do
|
38
|
+
options[:save] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on('--loud', 'Displays information about note(s) being played') do
|
42
|
+
options[:loud] = true
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on('-v', '--version', 'Display version number and exit') do
|
46
|
+
puts "feep #{Feep::VERSION}"
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.on('-h', '--help', 'Display this screen and exit') do
|
51
|
+
puts opts
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
options[:usage] = optparse.to_s
|
57
|
+
optparse.parse!()
|
58
|
+
|
59
|
+
return options
|
60
|
+
end
|
61
|
+
|
62
|
+
def print_error(error)
|
63
|
+
case error
|
64
|
+
when OptionParser::InvalidOption
|
65
|
+
puts "#{$PROGRAM_NAME}: illegal option #{error.args.join(' ')}"
|
66
|
+
else
|
67
|
+
puts "An unexpected error occurred while running #{$PROGRAM_NAME}:"
|
68
|
+
puts " #{error}\n"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
begin
|
73
|
+
options = parse_options
|
74
|
+
|
75
|
+
Feep::Base.new(options)
|
76
|
+
rescue => error
|
77
|
+
print_error(error)
|
78
|
+
exit(false)
|
79
|
+
end
|
data/lib/feep/constants.rb
CHANGED
@@ -250,7 +250,7 @@ module Feep
|
|
250
250
|
ERROR_MSG = Hash[
|
251
251
|
:invalid_note => 'Note name argument is invalid.',
|
252
252
|
:invalid_scale => "Scale ID is invalid. Valid IDs are: #{SCALES.keys}",
|
253
|
-
:invalid_waveform =>
|
253
|
+
:invalid_waveform => "Waveform type is invalid. Valid waveform types are: #{WAVE_TYPES}",
|
254
254
|
:scale_needs_note => 'You need to enter a valid note (-n) if you want to play a scale.'
|
255
255
|
]
|
256
256
|
end
|
data/lib/feep/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '0.0.
|
1
|
+
module Feep
|
2
|
+
VERSION = '0.0.8'
|
3
3
|
end
|
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.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wavefile
|
@@ -163,4 +163,7 @@ rubygems_version: 2.4.6
|
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Make your computer feep with Ruby
|
166
|
-
test_files:
|
166
|
+
test_files:
|
167
|
+
- spec/feep_spec.rb
|
168
|
+
- spec/spec_helper.rb
|
169
|
+
has_rdoc:
|