feep 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/README.md +5 -5
- data/lib/feep/sound_player.rb +10 -6
- data/lib/feep/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ce3097472490d2980637363ad9473134efdc92
|
4
|
+
data.tar.gz: be53e5714ea5f0fc1b58b44858374733a9ce6694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f949291db5d01fb823359d98991ad5b23a09a04e26e4ad9f62acec7be5789994eb208087db7bf1e43319f1264ee8b167d5dc89087543eae8499a3b99a4c7c40
|
7
|
+
data.tar.gz: 8121f241ce3085927311d2f911f3dc0c4b4007c9003b53f446bffc243271d995b48d9bbffe73db9aba8d7beb236bcd4966113a17871415e119460c280b42274e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,13 +18,13 @@ 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, -n, --
|
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] [--loud]`
|
22
22
|
|
23
|
-
`-f, -n, --
|
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
|
|
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.
|
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. If you try to use a frequency for the root note that doesn't map to a traditional note, you will get an error message (I may try to support arbitrary frequencies (microtones!) in the future).
|
26
26
|
|
27
|
-
|
27
|
+
`--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
|
|
@@ -43,4 +43,4 @@ The full usage looks like this:
|
|
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
|
46
|
+
* `feep -n D#5 -s whole_note --degrees 20` - play 20 degrees of a whole note scale with D#5 as the root note
|
data/lib/feep/sound_player.rb
CHANGED
@@ -20,12 +20,8 @@ module Feep
|
|
20
20
|
|
21
21
|
# use command line app to play wav file
|
22
22
|
def play_wav_file(file, duration)
|
23
|
-
delimiter = OS.windows? ? ';' : ':'
|
24
|
-
|
25
|
-
system_apps = ENV['PATH'].split(delimiter).collect { |d| Dir.entries d if Dir.exist? d }.flatten
|
26
|
-
|
27
23
|
if OS.windows?
|
28
|
-
if
|
24
|
+
if command_exists?(SNDPLAYER_WIN)
|
29
25
|
display_text_beep(duration)
|
30
26
|
system("#{SNDPLAYER_WIN} #{file}")
|
31
27
|
else
|
@@ -34,7 +30,7 @@ module Feep
|
|
34
30
|
end
|
35
31
|
|
36
32
|
if OS.mac? || OS.linux?
|
37
|
-
if
|
33
|
+
if command_exists?(SNDPLAYER_UNIX)
|
38
34
|
display_text_beep(duration)
|
39
35
|
system("#{SNDPLAYER_UNIX} #{file}")
|
40
36
|
else
|
@@ -81,6 +77,14 @@ module Feep
|
|
81
77
|
end
|
82
78
|
end
|
83
79
|
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def command_exists?(cmd)
|
84
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).collect { |d|
|
85
|
+
Dir.entries d if Dir.exist? d
|
86
|
+
}.flatten.include?(cmd)
|
87
|
+
end
|
84
88
|
|
85
89
|
end
|
86
90
|
end
|
data/lib/feep/version.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.1.
|
4
|
+
version: 0.1.1
|
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-06-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wavefile
|