neve 0.0.1 → 0.1.0

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: 9613a72ace63fa45343dbd6fd02999e678df40d2
4
- data.tar.gz: f8f1f1fad6958f0475e49ee4bc41ceba76b4df46
3
+ metadata.gz: 7714e64fbaf457649ef08a5883c70255b596f8b5
4
+ data.tar.gz: c98083dd190eb30ce2838e5eb6a8dc997393ea06
5
5
  SHA512:
6
- metadata.gz: e923d4f47fdded4e738de7071570ad577408c184ca852b72d89fe253664e9a95a4910cee56ec9276c1bd7e44ea1c0743d33438dcb7fd077f33e7dbc22a8c8ba5
7
- data.tar.gz: bd1e1b578f19c177e003ef89ea026f164c6d558f3ae9fc833ca9e76503394fdd22d223927ec1b3cb4e77afe75f98b0d331619414927d9a8ae3a1cce494348df6
6
+ metadata.gz: 45f62b653ffafb3da75363536113e44235a42397fa0d24ad6348fa6152805b76a2baac018520fbab1431f29f3085c80c7c3a4200c809113ae2e15c9e064a6c7a
7
+ data.tar.gz: 1f226b1dd8be7705a452adf1b01e45ba8c33a39d9445ac483767b3717c5f532b181d4d96c4661da00577349212ccbc9c4933e8da202c0291cd973dbb16736afd
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ spec/support/my_awesome_tune.wav
@@ -0,0 +1 @@
1
+ 2.1.1
data/README.md CHANGED
@@ -1,28 +1,60 @@
1
1
  # Neve
2
2
 
3
- TODO: Write a gem description
3
+ Friendly audio mixing, on your command line.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Neve depends on [ecasound](http://ecasound.seul.org/ecasound/download.php). On
8
+ a Mac, install via [Homebrew](http://brew.sh/):
8
9
 
9
- gem 'neve'
10
+ $ brew install ecasound
11
+ $ gem install neve
10
12
 
11
- And then execute:
13
+ ## Usage
12
14
 
13
- $ bundle
15
+ Neve expects your files to be organised like this, where `my_awesome_tune` is an
16
+ example song name:
14
17
 
15
- Or install it yourself as:
18
+ ├── my_awesome_tune
19
+ │   ├── bass.wav
20
+ │   ├── drums.wav
21
+ │   └── guitar.wav
22
+ └── my_awesome_tune.yml
16
23
 
17
- $ gem install neve
24
+ All mix settings are contained in `my_awesome_tune.yml`. For each track,
25
+ the `fader` and `pan` percentages can be set. Names are expected to match a
26
+ `wav` file within the folder of the same name.
18
27
 
19
- ## Usage
28
+ bass:
29
+ fader: 33
30
+ pan: 25
31
+ drums:
32
+ fader: 33
33
+ pan: 50
34
+ guitar:
35
+ fader: 33
36
+ pan: 75
37
+
38
+ `fader` is an optional value that represents a percentage of the track
39
+ level. Values below `100` will attenuate the track while values above `100` will
40
+ cause the track to be amplified. If no value is set, it will default to `100`.
41
+
42
+ __Please note that there is no limiting - please use caution when setting fader values,
43
+ especially with many tracks__
44
+
45
+ `pan` is an optional value that represents the left/right balance of the track.
46
+ `0` is fully left, `100` is fully right. If no value if set, it will default to `50`.
47
+
48
+ With the configuration and tracks in place, we can bounce the mix to file:
49
+
50
+ $ neve mix my_awesome_tune
20
51
 
21
- TODO: Write usage instructions here
52
+ The mixed file name will include a timestamp to avoid replacing any existing mixes,
53
+ so for example `my_awesome_tune_20140502132657.wav`
22
54
 
23
55
  ## Contributing
24
56
 
25
- 1. Fork it ( http://github.com/<my-github-username>/neve/fork )
57
+ 1. Fork it ( http://github.com/seenmyfate/neve/fork )
26
58
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
59
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
60
  4. Push to the branch (`git push origin my-new-feature`)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
3
+ $LOAD_PATH.unshift lib_dir if File.directory?(lib_dir)
4
+ require 'neve'
5
+
6
+ Neve::CLI.start
@@ -1,5 +1,5 @@
1
- require "neve/version"
1
+ require 'neve/cli'
2
2
 
3
3
  module Neve
4
- # Your code goes here...
4
+ # Friendly audio mixing, right on your command line.
5
5
  end
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require 'neve/mix'
3
+
4
+ module Neve
5
+ class CLI < Thor
6
+
7
+ desc 'mix FILENAME', 'mixes the tracks specified in FILENAME'
8
+ def mix(filename)
9
+ Mix.new(filename).run
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,46 @@
1
+ require 'neve/eca_sound/track'
2
+ module Neve
3
+ module ECASound
4
+ class Mix
5
+
6
+ def initialize(directory, configuration)
7
+ @directory, @configuration = directory, configuration
8
+ end
9
+
10
+ def to_s
11
+ [
12
+ ecasound,
13
+ mix,
14
+ output
15
+ ].join
16
+ end
17
+
18
+ private
19
+
20
+ def ecasound
21
+ 'ecasound '
22
+ end
23
+
24
+ def mix
25
+ tracks.each_with_index.inject('') do |string, (track, i)|
26
+ string << "-a:#{i+1} -i #{track} "
27
+ end
28
+ end
29
+
30
+ def output
31
+ "-a:#{track_list} -o #{@directory}.wav"
32
+ end
33
+
34
+ def track_list
35
+ (1..tracks.size).to_a.join(',')
36
+ end
37
+
38
+ def tracks
39
+ @tracks ||= @configuration.map do |track, options|
40
+ Track.new(@directory, track, options)
41
+ end
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,34 @@
1
+ require 'pathname'
2
+ module Neve
3
+ module ECASound
4
+ class Track
5
+
6
+ def initialize(directory, name, options)
7
+ @directory, @name, @options = directory, name, options
8
+ end
9
+
10
+ def to_s
11
+ [
12
+ filename,
13
+ mix,
14
+ pan
15
+ ].join(' ')
16
+ end
17
+
18
+ private
19
+
20
+ def filename
21
+ Pathname.new(@directory).join("#{@name}.wav")
22
+ end
23
+
24
+ def mix
25
+ "-ea:#{@options.fetch('fader', 100)}"
26
+ end
27
+
28
+ def pan
29
+ "-epp:#{@options.fetch('pan', 50)}"
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ require 'yaml'
2
+ module Neve
3
+ module LoadsYaml
4
+
5
+ def configuration
6
+ @configuration ||= YAML.load_file(file)
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ require 'neve/runs'
2
+ require 'neve/loads_yaml'
3
+ require 'neve/eca_sound/mix'
4
+
5
+ module Neve
6
+ class Mix
7
+ include Runs
8
+ include LoadsYaml
9
+
10
+ def initialize(filename)
11
+ @filename = filename
12
+ end
13
+
14
+ def file
15
+ "#{@filename}.yml"
16
+ end
17
+
18
+ def command
19
+ ECASound::Mix.new(@filename, configuration).to_s
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ require 'open3'
2
+
3
+ module Neve
4
+
5
+ class Error < StandardError;end;
6
+
7
+ module Runs
8
+
9
+ def self.included(includer)
10
+ includer.send(:attr_accessor, :output, :status)
11
+ includer.send(:private, :output, :status)
12
+ end
13
+
14
+ def run
15
+ self.output, self.status = Open3.capture2(command)
16
+ fail Neve::Error.new(output) unless status.success?
17
+ end
18
+
19
+ end
20
+ end
@@ -1,23 +1,25 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'neve/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "neve"
8
- spec.version = Neve::VERSION
9
- spec.authors = ["seenmyfate"]
10
- spec.email = ["seenmyfate@gmail.com"]
11
- spec.summary = %q{Command line mixing console}
12
- spec.description = %q{Command line mixing console}
13
- spec.homepage = "https://github.com/seenmyfate/neve"
14
- spec.license = "MIT"
6
+ spec.name = 'neve'
7
+ spec.version = '0.1.0'
8
+ spec.authors = ['seenmyfate']
9
+ spec.email = ['seenmyfate@gmail.com']
10
+ spec.summary = %q{Friendly audio mixing, right on your command line}
11
+ spec.description = %q{Friendly audio mixing, right on your command line}
12
+ spec.homepage = 'https://github.com/seenmyfate/neve'
13
+ spec.license = 'MIT'
15
14
 
16
15
  spec.files = `git ls-files`.split($/)
17
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
20
19
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake"
20
+ spec.add_runtime_dependency 'thor'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.5'
23
+ spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'rspec'
23
25
  end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+
5
+ describe CLI do
6
+ let(:mix) { double }
7
+ let(:filename) { double }
8
+
9
+ describe '#mix' do
10
+ it 'runs a new Mix instance' do
11
+ expect(Mix).to receive(:new).with(filename).and_return(mix)
12
+ expect(mix).to receive(:run)
13
+
14
+ CLI.new.mix(filename)
15
+ end
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+ module ECAsound
5
+ describe Mix do
6
+ let(:mix) { ECASound::Mix.new(directory, configuration) }
7
+ let(:directory) { 'spec/support/my_awesome_tune' }
8
+ let(:configuration) { YAML.load_file('spec/support/my_awesome_tune.yml') }
9
+
10
+ describe '.new' do
11
+ it 'takes the type, configuration' do
12
+ expect(mix)
13
+ end
14
+ end
15
+
16
+ describe '#to_s' do
17
+ let(:ecasound_command) {
18
+ 'ecasound ' \
19
+ '-a:1 -i spec/support/my_awesome_tune/bass.wav -ea:33 -epp:25 ' \
20
+ '-a:2 -i spec/support/my_awesome_tune/drums.wav -ea:33 -epp:50 ' \
21
+ '-a:3 -i spec/support/my_awesome_tune/guitar.wav -ea:33 -epp:75 ' \
22
+ '-a:1,2,3 -o spec/support/my_awesome_tune.wav'
23
+ }
24
+
25
+ it 'returns the ecasound string' do
26
+ expect(mix.to_s).to eq ecasound_command
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+ module ECASound
5
+
6
+ describe Track do
7
+ let(:track) { Track.new(directory, name, options) }
8
+ let(:directory) { 'spec/support/my_awesome_tune' }
9
+ let(:name) { 'guitar' }
10
+ let(:options) { YAML.load_file('spec/support/my_awesome_tune.yml')['guitar'] }
11
+
12
+ describe '.new' do
13
+ it 'takes a filename, options' do
14
+ expect(track)
15
+ end
16
+ end
17
+
18
+ describe '#to_s' do
19
+ let(:mix_string) { 'spec/support/my_awesome_tune/guitar.wav -ea:33 -epp:75' }
20
+
21
+ it 'returns the mix string' do
22
+ expect(track.to_s).to eq mix_string
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+
5
+ class ParsingExample
6
+ include LoadsYaml
7
+
8
+ def file
9
+ 'spec/support/my_awesome_tune.yml'
10
+ end
11
+ end
12
+
13
+ describe '#configuration' do
14
+ let(:configuration) { double }
15
+
16
+ it 'returns the parsed yaml' do
17
+ expect(YAML).to receive(:load_file).with('spec/support/my_awesome_tune.yml').
18
+ and_return(configuration)
19
+ expect(ParsingExample.new.configuration).to eq configuration
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+
5
+ describe Mix do
6
+ let(:mix) { Mix.new(filename) }
7
+ let(:filename) { 'spec/support/my_awesome_tune' }
8
+
9
+ describe '.new' do
10
+ it 'takes a filename' do
11
+ expect(mix)
12
+ end
13
+ end
14
+
15
+ describe '#file' do
16
+ it 'returns the name of the yaml file' do
17
+ expect(mix.file).to eq 'spec/support/my_awesome_tune.yml'
18
+ end
19
+ end
20
+
21
+ describe '#command' do
22
+ let(:command) { double }
23
+ let(:configuration) { double }
24
+
25
+ it 'returns a command object' do
26
+ expect(mix).to receive(:configuration).and_return(configuration)
27
+ expect(ECASound::Mix).to receive(:new).
28
+ with('spec/support/my_awesome_tune', configuration).
29
+ and_return(command)
30
+ expect(mix.command).to eq command.to_s
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ module Neve
4
+
5
+ class RunningExample
6
+ include Runs
7
+
8
+ def command
9
+ 'ls'
10
+ end
11
+
12
+ end
13
+
14
+ describe '#run' do
15
+ let(:command) { 'ls' }
16
+ let(:output) { double }
17
+ let(:status) { double(:status, success?: success) }
18
+ let(:success) { true }
19
+
20
+ subject { RunningExample.new.run }
21
+
22
+ it 'runs the command with `capture2`' do
23
+ expect(Open3).to receive(:capture2).with(command).
24
+ and_return([output, status])
25
+
26
+ subject
27
+ end
28
+
29
+ context 'where the command is unsuccessful' do
30
+ let(:success) { false }
31
+
32
+ it 'fails with an error' do
33
+ expect(Open3).to receive(:capture2).with(command).
34
+ and_return([output, status])
35
+
36
+ expect { subject }.to raise_error Neve::Error
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'fileutils'
3
+
4
+ module Neve
5
+
6
+ describe 'README example' do
7
+ let(:mix) { 'spec/support/mix.wav' }
8
+ let(:my_awesome_tune) { 'spec/support/my_awesome_tune.wav' }
9
+
10
+ before do
11
+ `./bin/neve mix spec/support/my_awesome_tune`
12
+ end
13
+
14
+ it 'bounces the mix' do
15
+ expect(FileUtils.compare_file(mix, my_awesome_tune)).to be_true
16
+ end
17
+
18
+ after do
19
+ FileUtils.remove(my_awesome_tune)
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,10 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ end
5
+
6
+ require 'neve'
7
+
8
+ RSpec.configure do |config|
9
+ config.order = 'random'
10
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ bass:
2
+ fader: 33
3
+ pan: 25
4
+ drums:
5
+ fader: 33
6
+ pan: 50
7
+ guitar:
8
+ fader: 33
9
+ pan: 75
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - seenmyfate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,21 +52,56 @@ dependencies:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
- description: Command line mixing console
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Friendly audio mixing, right on your command line
42
70
  email:
43
71
  - seenmyfate@gmail.com
44
- executables: []
72
+ executables:
73
+ - neve
45
74
  extensions: []
46
75
  extra_rdoc_files: []
47
76
  files:
48
77
  - ".gitignore"
78
+ - ".ruby-version"
49
79
  - Gemfile
50
80
  - LICENSE.txt
51
81
  - README.md
52
82
  - Rakefile
83
+ - bin/neve
53
84
  - lib/neve.rb
54
- - lib/neve/version.rb
85
+ - lib/neve/cli.rb
86
+ - lib/neve/eca_sound/mix.rb
87
+ - lib/neve/eca_sound/track.rb
88
+ - lib/neve/loads_yaml.rb
89
+ - lib/neve/mix.rb
90
+ - lib/neve/runs.rb
55
91
  - neve.gemspec
92
+ - spec/lib/neve/cli_spec.rb
93
+ - spec/lib/neve/eca_sound/mix_spec.rb
94
+ - spec/lib/neve/eca_sound/track_spec.rb
95
+ - spec/lib/neve/loads_yaml_spec.rb
96
+ - spec/lib/neve/mix_spec.rb
97
+ - spec/lib/neve/runs_spec.rb
98
+ - spec/lib/neve_spec.rb
99
+ - spec/spec_helper.rb
100
+ - spec/support/mix.wav
101
+ - spec/support/my_awesome_tune.yml
102
+ - spec/support/my_awesome_tune/bass.wav
103
+ - spec/support/my_awesome_tune/drums.wav
104
+ - spec/support/my_awesome_tune/guitar.wav
56
105
  homepage: https://github.com/seenmyfate/neve
57
106
  licenses:
58
107
  - MIT
@@ -76,5 +125,18 @@ rubyforge_project:
76
125
  rubygems_version: 2.2.2
77
126
  signing_key:
78
127
  specification_version: 4
79
- summary: Command line mixing console
80
- test_files: []
128
+ summary: Friendly audio mixing, right on your command line
129
+ test_files:
130
+ - spec/lib/neve/cli_spec.rb
131
+ - spec/lib/neve/eca_sound/mix_spec.rb
132
+ - spec/lib/neve/eca_sound/track_spec.rb
133
+ - spec/lib/neve/loads_yaml_spec.rb
134
+ - spec/lib/neve/mix_spec.rb
135
+ - spec/lib/neve/runs_spec.rb
136
+ - spec/lib/neve_spec.rb
137
+ - spec/spec_helper.rb
138
+ - spec/support/mix.wav
139
+ - spec/support/my_awesome_tune.yml
140
+ - spec/support/my_awesome_tune/bass.wav
141
+ - spec/support/my_awesome_tune/drums.wav
142
+ - spec/support/my_awesome_tune/guitar.wav
@@ -1,3 +0,0 @@
1
- module Neve
2
- VERSION = "0.0.1"
3
- end