synthdef 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/bin/synthdef +4 -1
- data/lib/synthdef.rb +19 -10
- data/lib/synthdef/version.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: d37a515d073dae65541a0d175d2c86332b10d96e
|
4
|
+
data.tar.gz: 18aa402610ceccb1bdb67ee77fbd0aecfaec3d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce0d99d8bf7bc43949fff5581495c43b6007f4c3bab2c24d24d0d41551fb26887334811a9d62646a7f8dab78be4a1fe57136503b849a41f8da9b76bf3fe5d332
|
7
|
+
data.tar.gz: 31bdd62ce2a628cab2cf52996dc4e335c479c65f65edd678ce1e282552d4142f1c6d0e69c46f2d480fde03db08d8033071c968fff35e664aa7cf31f659db018b
|
data/README.md
CHANGED
@@ -44,6 +44,13 @@ The gem ships with a command line tool to print the contents of a synthdef file
|
|
44
44
|
|
45
45
|
```
|
46
46
|
$ gem install synthdef
|
47
|
+
$ synthdef -v
|
48
|
+
synthdef gem version 0.0.5
|
49
|
+
Manipulate SuperCollider synthdef files from the command line
|
50
|
+
Usage: synthdef [options] [path]
|
51
|
+
-c, --convert [VERSION] Specify synthdef version of output
|
52
|
+
-f, --format [FORMAT] Specify output format: json, raw
|
53
|
+
-v, --version Show version
|
47
54
|
$ synthdef /path/to/synthdefs/foo.scsyndef
|
48
55
|
=> {
|
49
56
|
"file_type_id": "SCgf",
|
@@ -56,6 +63,18 @@ $ synthdef /path/to/synthdefs/foo.scsyndef
|
|
56
63
|
"constants": [
|
57
64
|
0.0,
|
58
65
|
...
|
66
|
+
$ synthdef --convert 2 /path/to/synthdefs/foo.scsyndef
|
67
|
+
=> {
|
68
|
+
"file_type_id": "SCgf",
|
69
|
+
"file_version": 2,
|
70
|
+
"no_of_synthdefs": 1,
|
71
|
+
"synthdefs": [
|
72
|
+
{
|
73
|
+
"name": "sonic-pi-pretty_bell",
|
74
|
+
"no_of_constants": 15,
|
75
|
+
"constants": [
|
76
|
+
0.0,
|
77
|
+
...
|
59
78
|
```
|
60
79
|
|
61
80
|
## Usage
|
data/bin/synthdef
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'synthdef'
|
3
3
|
require 'json'
|
4
4
|
require 'optparse'
|
5
|
+
require 'pp'
|
5
6
|
|
6
7
|
ARGV << '-h' if ARGV.empty?
|
7
8
|
|
@@ -13,7 +14,7 @@ OptionParser.new do |opts|
|
|
13
14
|
options[:convert] = c
|
14
15
|
end
|
15
16
|
|
16
|
-
opts.on("-f", "--format [FORMAT]", ["json", "raw"], "Specify output format: json, raw") do |f|
|
17
|
+
opts.on("-f", "--format [FORMAT]", ["json", "ruby", "raw"], "Specify output format: json, ruby, raw") do |f|
|
17
18
|
options[:format] = f
|
18
19
|
end
|
19
20
|
|
@@ -42,6 +43,8 @@ options[:format] ||= "json"
|
|
42
43
|
case options[:format]
|
43
44
|
when "json"
|
44
45
|
puts JSON.pretty_generate(sdef.snapshot)
|
46
|
+
when "ruby"
|
47
|
+
pp sdef.snapshot
|
45
48
|
when "raw"
|
46
49
|
puts sdef.to_binary_s
|
47
50
|
else
|
data/lib/synthdef.rb
CHANGED
@@ -9,6 +9,15 @@ class PascalString < BinData::Primitive
|
|
9
9
|
def set(v) self.data = v; end
|
10
10
|
end
|
11
11
|
|
12
|
+
class SynthInt < BinData::Choice
|
13
|
+
endian :big
|
14
|
+
default_parameter :selection => :check_version
|
15
|
+
default_parameter :copy_on_change => true
|
16
|
+
|
17
|
+
int16 0
|
18
|
+
int32 1
|
19
|
+
end
|
20
|
+
|
12
21
|
class Synthdef < BinData::Record
|
13
22
|
def check_version
|
14
23
|
# Returns zero based index for choices
|
@@ -24,35 +33,35 @@ class Synthdef < BinData::Record
|
|
24
33
|
array :synthdefs, initial_length: lambda { no_of_synthdefs } do
|
25
34
|
pascal_string :name
|
26
35
|
|
27
|
-
|
36
|
+
synth_int :no_of_constants
|
28
37
|
array :constants, initial_length: lambda { no_of_constants } do
|
29
38
|
float :constant
|
30
39
|
end
|
31
40
|
|
32
|
-
|
41
|
+
synth_int :no_of_params
|
33
42
|
array :params, initial_length: lambda { no_of_params } do
|
34
43
|
float :initial_parameter_value
|
35
44
|
end
|
36
45
|
|
37
|
-
|
46
|
+
synth_int :no_of_param_names
|
38
47
|
array :param_names, initial_length: lambda { no_of_param_names } do
|
39
48
|
pascal_string :param_name
|
40
|
-
|
49
|
+
synth_int :param_index
|
41
50
|
end
|
42
51
|
|
43
|
-
|
52
|
+
synth_int :no_of_ugens
|
44
53
|
array :ugens, initial_length: lambda { no_of_ugens } do
|
45
54
|
pascal_string :ugen_name
|
46
55
|
int8 :rate
|
47
|
-
|
48
|
-
|
56
|
+
synth_int :no_of_inputs
|
57
|
+
synth_int :no_of_outputs
|
49
58
|
int16 :special, initial_value: 0
|
50
59
|
array :inputs, initial_length: lambda { no_of_inputs } do
|
51
|
-
|
60
|
+
synth_int :src
|
52
61
|
if lambda { src == -1 }
|
53
|
-
|
62
|
+
synth_int :input_constant_index
|
54
63
|
else
|
55
|
-
|
64
|
+
synth_int :input_ugen_index
|
56
65
|
end
|
57
66
|
end
|
58
67
|
array :outputs, initial_length: lambda { no_of_outputs } do
|
data/lib/synthdef/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synthdef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.6.7
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Work with SuperCollider's binary synthdef format
|