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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afb4a7dc316220898ac338ec8b9882084dd6c200
4
- data.tar.gz: 9de77f715508f1c8a8b63dfe51d37c9ac499cf16
3
+ metadata.gz: 89ce3097472490d2980637363ad9473134efdc92
4
+ data.tar.gz: be53e5714ea5f0fc1b58b44858374733a9ce6694
5
5
  SHA512:
6
- metadata.gz: e9ac4d7aaa80c2ae8052cd638bfd2a612ca6cf5765dc715ea1d7c6855d2cce3b1963dd500fedf1575bcc6ad9cff2f2ebe9b013634509adf0d2eafa10d4beba31
7
- data.tar.gz: 6b3e938e4d7dcbbdd43c4faadce2bfecf2348335cfa58c4e82387675e5f50e9bdb4f98aad1b5e3c6e7d3a39366770054cfffce9df73cf4127c20fac0e64aa9d8
6
+ metadata.gz: 0f949291db5d01fb823359d98991ad5b23a09a04e26e4ad9f62acec7be5789994eb208087db7bf1e43319f1264ee8b167d5dc89087543eae8499a3b99a4c7c40
7
+ data.tar.gz: 8121f241ce3085927311d2f911f3dc0c4b4007c9003b53f446bffc243271d995b48d9bbffe73db9aba8d7beb236bcd4966113a17871415e119460c280b42274e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- feep (0.0.9)
4
+ feep (0.1.1)
5
5
  os (~> 0.9, >= 0.9.6)
6
6
  wavefile (= 0.6.0)
7
7
 
@@ -73,3 +73,6 @@ DEPENDENCIES
73
73
  rake (~> 10.0)
74
74
  rspec (~> 3.0)
75
75
  rubocop (~> 0.29)
76
+
77
+ BUNDLED WITH
78
+ 1.10.3
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, --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]`
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, --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.
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
- `-sd, --degrees`: the number of degrees of a scale you want to play. By default, the scale will play one octave.
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 -d 20` - play 20 degrees of a whole note scale with D#5 as the root 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
@@ -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 system_apps.include? SNDPLAYER_WIN
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 system_apps.include? SNDPLAYER_UNIX
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
@@ -1,3 +1,3 @@
1
1
  module Feep
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
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.1.0
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-15 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wavefile