duo_splitter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +32 -0
  3. data/data/labels/01.txt +10 -0
  4. data/data/labels/02.txt +13 -0
  5. data/data/labels/03.txt +15 -0
  6. data/data/labels/04.txt +11 -0
  7. data/data/labels/05.txt +18 -0
  8. data/data/labels/06.txt +14 -0
  9. data/data/labels/07.txt +17 -0
  10. data/data/labels/08.txt +10 -0
  11. data/data/labels/09.txt +14 -0
  12. data/data/labels/10.txt +13 -0
  13. data/data/labels/11.txt +12 -0
  14. data/data/labels/12.txt +10 -0
  15. data/data/labels/13.txt +11 -0
  16. data/data/labels/14.txt +11 -0
  17. data/data/labels/15.txt +12 -0
  18. data/data/labels/16.txt +10 -0
  19. data/data/labels/17.txt +13 -0
  20. data/data/labels/18.txt +15 -0
  21. data/data/labels/19.txt +13 -0
  22. data/data/labels/20.txt +18 -0
  23. data/data/labels/21.txt +16 -0
  24. data/data/labels/22.txt +18 -0
  25. data/data/labels/23.txt +10 -0
  26. data/data/labels/24.txt +13 -0
  27. data/data/labels/25.txt +11 -0
  28. data/data/labels/26.txt +11 -0
  29. data/data/labels/27.txt +16 -0
  30. data/data/labels/28.txt +14 -0
  31. data/data/labels/29.txt +13 -0
  32. data/data/labels/30.txt +13 -0
  33. data/data/labels/31.txt +18 -0
  34. data/data/labels/32.txt +11 -0
  35. data/data/labels/33.txt +12 -0
  36. data/data/labels/34.txt +16 -0
  37. data/data/labels/35.txt +15 -0
  38. data/data/labels/36.txt +17 -0
  39. data/data/labels/37.txt +9 -0
  40. data/data/labels/38.txt +10 -0
  41. data/data/labels/39.txt +12 -0
  42. data/data/labels/40.txt +16 -0
  43. data/data/labels/41.txt +16 -0
  44. data/data/labels/42.txt +12 -0
  45. data/data/labels/43.txt +14 -0
  46. data/data/labels/44.txt +18 -0
  47. data/data/labels/45.txt +14 -0
  48. data/exe/duo_splitter +6 -0
  49. data/lib/duo_splitter.rb +24 -0
  50. data/lib/duo_splitter/aac_encoder.rb +13 -0
  51. data/lib/duo_splitter/album.rb +21 -0
  52. data/lib/duo_splitter/encoder.rb +71 -0
  53. data/lib/duo_splitter/mp3_encoder.rb +13 -0
  54. data/lib/duo_splitter/runner.rb +93 -0
  55. data/lib/duo_splitter/section.rb +30 -0
  56. data/lib/duo_splitter/sentence.rb +22 -0
  57. data/lib/duo_splitter/version.rb +3 -0
  58. data/lib/duo_splitter/wav_encoder.rb +13 -0
  59. metadata +143 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 29142faa6db1a28c4729cfa2c84006ec5de9e7f57cf47ad5d14bdd450d05017b
4
+ data.tar.gz: e788f6c989a1f852443f130f7c2cff7d2543798f2ae4563ca47964630df95231
5
+ SHA512:
6
+ metadata.gz: 0a6a9cfa9406970d34f0a746f4ccb776bc3a126cf17e198f37344b76e887bd783c9ec1b57a54433a308e741a97d9a143fbb312b243e6fbfeb7f4556b69b1c0bc
7
+ data.tar.gz: 8bcf3160dec0573f8151835fc521176e0e336846a74a8f370e251ef4d9dff6943c4700fed32771d7c4add8466093a56a212ade14417b9c1de8c487f31fe6da30
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # `duo_splitter`
2
+
3
+ This gem provides a command to split the tracks into each sentences from [DUO 3.0 CD](https://www.amazon.co.jp/dp/4900790079)
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ $ gem install duo_splitter
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ Usage: duo_splitter [options] "01 Track 01.wav" "02 Track 02.wav" ... "45 Track 45.wav"
15
+ -d, --output-dir=PATH Output directory (default: /Users/yzn/Desktop/DUO 3.0)
16
+ -f, --format=FORMAT Output format (default: wav; one of aac, mp3, wav)
17
+ --[no-]output-intro Output intro track (default: true)
18
+ --[no-]section-number Add section number to output name (default: true)
19
+ --ffmpeg-path=PATH Path to ffmpeg command (default: ffmpeg)
20
+ ```
21
+
22
+ ## Development
23
+
24
+ Run `bin/rspec` to run the specs.
25
+
26
+ ## Contributing
27
+
28
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/healthypackrat/duo_splitter>.
29
+
30
+ ## License
31
+
32
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,10 @@
1
+ 2.960000 2.960000 1
2
+ 6.930000 6.930000 2
3
+ 12.440000 12.440000 3
4
+ 19.740000 19.740000 4
5
+ 26.630000 26.630000 5
6
+ 31.490000 31.490000 6
7
+ 37.220000 37.220000 7
8
+ 45.100000 45.100000 8
9
+ 49.700000 49.700000 9
10
+ 57.293333 57.293333 END
@@ -0,0 +1,13 @@
1
+ 1.860000 1.860000 10
2
+ 7.780000 7.780000 11
3
+ 14.900000 14.900000 12
4
+ 20.550000 20.550000 13
5
+ 27.110000 27.110000 14
6
+ 32.480000 32.480000 15
7
+ 38.700000 38.700000 16
8
+ 43.620000 43.620000 17
9
+ 49.230000 49.230000 18
10
+ 55.610000 55.610000 19
11
+ 62.850000 62.850000 20
12
+ 69.350000 69.350000 21
13
+ 76.333333 76.333333 END
@@ -0,0 +1,15 @@
1
+ 2.230000 2.230000 22
2
+ 9.420000 9.420000 23
3
+ 15.880000 15.880000 24
4
+ 21.910000 21.910000 25
5
+ 28.080000 28.080000 26
6
+ 36.020000 36.020000 27
7
+ 41.990000 41.990000 28
8
+ 48.040000 48.040000 29
9
+ 53.850000 53.850000 30
10
+ 61.270000 61.270000 31
11
+ 66.560000 66.560000 32
12
+ 74.830000 74.830000 33
13
+ 81.890000 81.890000 34
14
+ 87.300000 87.300000 35
15
+ 95.106667 95.106667 END
@@ -0,0 +1,11 @@
1
+ 1.660000 1.660000 36
2
+ 6.430000 6.430000 37
3
+ 11.370000 11.370000 38
4
+ 16.330000 16.330000 39
5
+ 22.330000 22.330000 40
6
+ 30.440000 30.440000 41
7
+ 36.060000 36.060000 42
8
+ 41.950000 41.950000 43
9
+ 49.280000 49.280000 44
10
+ 54.440000 54.440000 45
11
+ 61.800000 61.800000 END
@@ -0,0 +1,18 @@
1
+ 2.200000 2.200000 46
2
+ 6.610000 6.610000 47
3
+ 12.560000 12.560000 48
4
+ 17.080000 17.080000 49
5
+ 22.880000 22.880000 50
6
+ 27.980000 27.980000 51
7
+ 32.350000 32.350000 52
8
+ 38.210000 38.210000 53
9
+ 45.260000 45.260000 54
10
+ 48.940000 48.940000 55
11
+ 54.750000 54.750000 56
12
+ 61.610000 61.610000 57
13
+ 67.450000 67.450000 58
14
+ 72.880000 72.880000 59
15
+ 76.820000 76.820000 60
16
+ 83.330000 83.330000 61
17
+ 90.880000 90.880000 62
18
+ 98.733333 98.733333 END
@@ -0,0 +1,14 @@
1
+ 2.060000 2.060000 63
2
+ 7.560000 7.560000 64
3
+ 14.580000 14.580000 65
4
+ 21.890000 21.890000 66
5
+ 27.480000 27.480000 67
6
+ 32.850000 32.850000 68
7
+ 42.270000 42.270000 69
8
+ 47.250000 47.250000 70
9
+ 55.330000 55.330000 71
10
+ 60.000000 60.000000 72
11
+ 66.090000 66.090000 73
12
+ 73.710000 73.710000 74
13
+ 79.710000 79.710000 75
14
+ 87.800000 87.800000 END
@@ -0,0 +1,17 @@
1
+ 2.010000 2.010000 76
2
+ 8.460000 8.460000 77
3
+ 15.580000 15.580000 78
4
+ 21.050000 21.050000 79
5
+ 25.750000 25.750000 80
6
+ 31.140000 31.140000 81
7
+ 38.530000 38.530000 82
8
+ 45.040000 45.040000 83
9
+ 51.250000 51.250000 84
10
+ 58.200000 58.200000 85
11
+ 64.260000 64.260000 86
12
+ 71.250000 71.250000 87
13
+ 78.210000 78.210000 88
14
+ 85.780000 85.780000 89
15
+ 90.850000 90.850000 90
16
+ 96.190000 96.190000 91
17
+ 104.026667 104.026667 END
@@ -0,0 +1,10 @@
1
+ 1.740000 1.740000 92
2
+ 6.460000 6.460000 93
3
+ 12.190000 12.190000 94
4
+ 18.840000 18.840000 95
5
+ 24.190000 24.190000 96
6
+ 29.770000 29.770000 97
7
+ 35.510000 35.510000 98
8
+ 42.010000 42.010000 99
9
+ 46.390000 46.390000 100
10
+ 52.506667 52.506667 END
@@ -0,0 +1,14 @@
1
+ 2.000000 2.000000 101
2
+ 7.440000 7.440000 102
3
+ 12.140000 12.140000 103
4
+ 16.600000 16.600000 104
5
+ 21.000000 21.000000 105
6
+ 26.560000 26.560000 106
7
+ 30.730000 30.730000 107
8
+ 36.710000 36.710000 108
9
+ 41.960000 41.960000 109
10
+ 50.840000 50.840000 110
11
+ 59.420000 59.420000 111
12
+ 66.080000 66.080000 112
13
+ 72.070000 72.070000 113
14
+ 77.800000 77.800000 END
@@ -0,0 +1,13 @@
1
+ 1.630000 1.630000 114
2
+ 5.830000 5.830000 115
3
+ 11.970000 11.970000 116
4
+ 19.110000 19.110000 117
5
+ 25.740000 25.740000 118
6
+ 30.440000 30.440000 119
7
+ 36.980000 36.980000 120
8
+ 41.740000 41.740000 121
9
+ 48.190000 48.190000 122
10
+ 54.680000 54.680000 123
11
+ 60.150000 60.150000 124
12
+ 67.180000 67.180000 125
13
+ 74.066667 74.066667 END
@@ -0,0 +1,12 @@
1
+ 1.980000 1.980000 126
2
+ 7.620000 7.620000 127
3
+ 14.200000 14.200000 128
4
+ 19.820000 19.820000 129
5
+ 25.020000 25.020000 130
6
+ 31.210000 31.210000 131
7
+ 37.370000 37.370000 132
8
+ 44.270000 44.270000 133
9
+ 51.420000 51.420000 134
10
+ 56.270000 56.270000 135
11
+ 63.370000 63.370000 136
12
+ 72.560000 72.560000 END
@@ -0,0 +1,10 @@
1
+ 1.940000 1.940000 137
2
+ 7.310000 7.310000 138
3
+ 13.440000 13.440000 139
4
+ 19.700000 19.700000 140
5
+ 25.590000 25.590000 141
6
+ 32.290000 32.290000 142
7
+ 39.420000 39.420000 143
8
+ 44.000000 44.000000 144
9
+ 49.900000 49.900000 145
10
+ 55.906667 55.906667 END
@@ -0,0 +1,11 @@
1
+ 2.310000 2.310000 146
2
+ 9.410000 9.410000 147
3
+ 12.760000 12.760000 148
4
+ 17.920000 17.920000 149
5
+ 26.370000 26.370000 150
6
+ 31.890000 31.890000 151
7
+ 36.970000 36.970000 152
8
+ 43.670000 43.670000 153
9
+ 49.040000 49.040000 154
10
+ 54.050000 54.050000 155
11
+ 63.400000 63.400000 END
@@ -0,0 +1,11 @@
1
+ 2.290000 2.290000 156
2
+ 9.550000 9.550000 157
3
+ 15.090000 15.090000 158
4
+ 21.410000 21.410000 159
5
+ 25.870000 25.870000 160
6
+ 32.960000 32.960000 161
7
+ 40.940000 40.940000 162
8
+ 46.240000 46.240000 163
9
+ 52.780000 52.780000 164
10
+ 57.470000 57.470000 165
11
+ 64.333333 64.333333 END
@@ -0,0 +1,12 @@
1
+ 2.070000 2.070000 166
2
+ 6.280000 6.280000 167
3
+ 12.410000 12.410000 168
4
+ 16.540000 16.540000 169
5
+ 21.480000 21.480000 170
6
+ 26.790000 26.790000 171
7
+ 35.990000 35.990000 172
8
+ 44.590000 44.590000 173
9
+ 50.060000 50.060000 174
10
+ 55.690000 55.690000 175
11
+ 61.240000 61.240000 176
12
+ 68.426667 68.426667 END
@@ -0,0 +1,10 @@
1
+ 2.240000 2.240000 177
2
+ 12.140000 12.140000 178
3
+ 21.100000 21.100000 179
4
+ 29.160000 29.160000 180
5
+ 34.000000 34.000000 181
6
+ 39.460000 39.460000 182
7
+ 45.700000 45.700000 183
8
+ 51.680000 51.680000 184
9
+ 57.800000 57.800000 185
10
+ 62.973333 62.973333 END
@@ -0,0 +1,13 @@
1
+ 2.280000 2.280000 186
2
+ 9.320000 9.320000 187
3
+ 19.210000 19.210000 188
4
+ 24.930000 24.930000 189
5
+ 31.230000 31.230000 190
6
+ 39.090000 39.090000 191
7
+ 43.280000 43.280000 192
8
+ 49.500000 49.500000 193
9
+ 55.020000 55.020000 194
10
+ 59.660000 59.660000 195
11
+ 65.880000 65.880000 196
12
+ 72.520000 72.520000 197
13
+ 81.160000 81.160000 END
@@ -0,0 +1,15 @@
1
+ 2.190000 2.190000 198
2
+ 9.180000 9.180000 199
3
+ 15.650000 15.650000 200
4
+ 22.800000 22.800000 201
5
+ 29.600000 29.600000 202
6
+ 34.770000 34.770000 203
7
+ 42.130000 42.130000 204
8
+ 48.690000 48.690000 205
9
+ 56.730000 56.730000 206
10
+ 65.790000 65.790000 207
11
+ 74.610000 74.610000 208
12
+ 79.570000 79.570000 209
13
+ 84.340000 84.340000 210
14
+ 90.840000 90.840000 211
15
+ 101.506667 101.506667 END
@@ -0,0 +1,13 @@
1
+ 2.230000 2.230000 212
2
+ 11.090000 11.090000 213
3
+ 16.860000 16.860000 214
4
+ 22.390000 22.390000 215
5
+ 30.430000 30.430000 216
6
+ 35.830000 35.830000 217
7
+ 41.690000 41.690000 218
8
+ 50.810000 50.810000 219
9
+ 56.100000 56.100000 220
10
+ 62.970000 62.970000 221
11
+ 71.640000 71.640000 222
12
+ 77.500000 77.500000 223
13
+ 84.533333 84.533333 END
@@ -0,0 +1,18 @@
1
+ 2.280000 2.280000 224
2
+ 7.110000 7.110000 225
3
+ 12.480000 12.480000 226
4
+ 17.840000 17.840000 227
5
+ 23.950000 23.950000 228
6
+ 28.300000 28.300000 229
7
+ 33.600000 33.600000 230
8
+ 38.960000 38.960000 231
9
+ 44.510000 44.510000 232
10
+ 49.920000 49.920000 233
11
+ 55.900000 55.900000 234
12
+ 60.880000 60.880000 235
13
+ 66.170000 66.170000 236
14
+ 75.090000 75.090000 237
15
+ 81.660000 81.660000 238
16
+ 87.080000 87.080000 239
17
+ 93.980000 93.980000 240
18
+ 100.533333 100.533333 END
@@ -0,0 +1,16 @@
1
+ 2.300000 2.300000 241
2
+ 10.380000 10.380000 242
3
+ 14.960000 14.960000 243
4
+ 20.560000 20.560000 244
5
+ 27.170000 27.170000 245
6
+ 32.230000 32.230000 246
7
+ 37.450000 37.450000 247
8
+ 42.410000 42.410000 248
9
+ 48.150000 48.150000 249
10
+ 53.720000 53.720000 250
11
+ 59.130000 59.130000 251
12
+ 66.520000 66.520000 252
13
+ 71.040000 71.040000 253
14
+ 78.370000 78.370000 254
15
+ 86.210000 86.210000 255
16
+ 94.093333 94.093333 END
@@ -0,0 +1,18 @@
1
+ 2.030000 2.030000 256
2
+ 7.830000 7.830000 257
3
+ 14.990000 14.990000 258
4
+ 19.580000 19.580000 259
5
+ 25.240000 25.240000 260
6
+ 32.980000 32.980000 261
7
+ 38.620000 38.620000 262
8
+ 45.370000 45.370000 263
9
+ 51.590000 51.590000 264
10
+ 57.980000 57.980000 265
11
+ 63.890000 63.890000 266
12
+ 69.460000 69.460000 267
13
+ 75.970000 75.970000 268
14
+ 85.050000 85.050000 269
15
+ 91.700000 91.700000 270
16
+ 100.840000 100.840000 271
17
+ 106.580000 106.580000 272
18
+ 115.306667 115.306667 END
@@ -0,0 +1,10 @@
1
+ 2.080000 2.080000 273
2
+ 7.190000 7.190000 274
3
+ 13.200000 13.200000 275
4
+ 17.480000 17.480000 276
5
+ 25.510000 25.510000 277
6
+ 32.530000 32.530000 278
7
+ 39.540000 39.540000 279
8
+ 49.170000 49.170000 280
9
+ 57.080000 57.080000 281
10
+ 64.160000 64.160000 END
@@ -0,0 +1,13 @@
1
+ 1.960000 1.960000 282
2
+ 8.970000 8.970000 283
3
+ 15.190000 15.190000 284
4
+ 22.150000 22.150000 285
5
+ 31.350000 31.350000 286
6
+ 36.700000 36.700000 287
7
+ 43.100000 43.100000 288
8
+ 49.500000 49.500000 289
9
+ 57.530000 57.530000 290
10
+ 64.940000 64.940000 291
11
+ 71.430000 71.430000 292
12
+ 76.740000 76.740000 293
13
+ 85.333333 85.333333 END
@@ -0,0 +1,11 @@
1
+ 2.260000 2.260000 294
2
+ 7.090000 7.090000 295
3
+ 14.360000 14.360000 296
4
+ 21.480000 21.480000 297
5
+ 26.640000 26.640000 298
6
+ 31.790000 31.790000 299
7
+ 37.810000 37.810000 300
8
+ 43.740000 43.740000 301
9
+ 49.030000 49.030000 302
10
+ 54.370000 54.370000 303
11
+ 60.773333 60.773333 END
@@ -0,0 +1,11 @@
1
+ 2.150000 2.150000 304
2
+ 8.170000 8.170000 305
3
+ 12.620000 12.620000 306
4
+ 17.320000 17.320000 307
5
+ 24.020000 24.020000 308
6
+ 30.920000 30.920000 309
7
+ 38.170000 38.170000 310
8
+ 43.020000 43.020000 311
9
+ 48.390000 48.390000 312
10
+ 55.350000 55.350000 313
11
+ 61.693333 61.693333 END
@@ -0,0 +1,16 @@
1
+ 2.380000 2.380000 314
2
+ 7.870000 7.870000 315
3
+ 14.080000 14.080000 316
4
+ 19.430000 19.430000 317
5
+ 24.850000 24.850000 318
6
+ 31.200000 31.200000 319
7
+ 35.770000 35.770000 320
8
+ 41.190000 41.190000 321
9
+ 47.370000 47.370000 322
10
+ 53.660000 53.660000 323
11
+ 59.000000 59.000000 324
12
+ 64.100000 64.100000 325
13
+ 69.600000 69.600000 326
14
+ 77.880000 77.880000 327
15
+ 84.530000 84.530000 328
16
+ 90.106667 90.106667 END
@@ -0,0 +1,14 @@
1
+ 2.350000 2.350000 329
2
+ 9.110000 9.110000 330
3
+ 13.850000 13.850000 331
4
+ 20.880000 20.880000 332
5
+ 28.460000 28.460000 333
6
+ 35.560000 35.560000 334
7
+ 41.530000 41.530000 335
8
+ 48.580000 48.580000 336
9
+ 54.060000 54.060000 337
10
+ 59.550000 59.550000 338
11
+ 64.800000 64.800000 339
12
+ 70.630000 70.630000 340
13
+ 79.210000 79.210000 341
14
+ 88.626667 88.626667 END
@@ -0,0 +1,13 @@
1
+ 2.220000 2.220000 342
2
+ 8.400000 8.400000 343
3
+ 13.730000 13.730000 344
4
+ 18.880000 18.880000 345
5
+ 24.680000 24.680000 346
6
+ 30.760000 30.760000 347
7
+ 35.620000 35.620000 348
8
+ 42.700000 42.700000 349
9
+ 50.040000 50.040000 350
10
+ 54.600000 54.600000 351
11
+ 60.110000 60.110000 352
12
+ 65.610000 65.610000 353
13
+ 72.573333 72.573333 END
@@ -0,0 +1,13 @@
1
+ 1.920000 1.920000 354
2
+ 8.980000 8.980000 355
3
+ 18.860000 18.860000 356
4
+ 24.380000 24.380000 357
5
+ 30.280000 30.280000 358
6
+ 36.720000 36.720000 359
7
+ 44.520000 44.520000 360
8
+ 51.850000 51.850000 361
9
+ 58.140000 58.140000 362
10
+ 66.450000 66.450000 363
11
+ 71.560000 71.560000 364
12
+ 77.070000 77.070000 365
13
+ 87.826667 87.826667 END
@@ -0,0 +1,18 @@
1
+ 1.880000 1.880000 366
2
+ 8.870000 8.870000 367
3
+ 15.410000 15.410000 368
4
+ 22.530000 22.530000 369
5
+ 28.550000 28.550000 370
6
+ 34.840000 34.840000 371
7
+ 39.800000 39.800000 372
8
+ 46.120000 46.120000 373
9
+ 52.800000 52.800000 374
10
+ 59.950000 59.950000 375
11
+ 66.160000 66.160000 376
12
+ 70.450000 70.450000 377
13
+ 77.600000 77.600000 378
14
+ 86.910000 86.910000 379
15
+ 93.670000 93.670000 380
16
+ 100.350000 100.350000 381
17
+ 106.840000 106.840000 382
18
+ 113.666667 113.666667 END
@@ -0,0 +1,11 @@
1
+ 2.110000 2.110000 383
2
+ 7.020000 7.020000 384
3
+ 13.340000 13.340000 385
4
+ 19.910000 19.910000 386
5
+ 25.680000 25.680000 387
6
+ 31.340000 31.340000 388
7
+ 38.610000 38.610000 389
8
+ 43.570000 43.570000 390
9
+ 49.440000 49.440000 391
10
+ 56.220000 56.220000 392
11
+ 62.240000 62.240000 END
@@ -0,0 +1,12 @@
1
+ 2.790000 2.790000 393
2
+ 7.700000 7.700000 394
3
+ 15.040000 15.040000 395
4
+ 23.570000 23.570000 396
5
+ 30.540000 30.540000 397
6
+ 36.590000 36.590000 398
7
+ 46.610000 46.610000 399
8
+ 53.040000 53.040000 400
9
+ 60.380000 60.380000 401
10
+ 66.620000 66.620000 402
11
+ 73.340000 73.340000 403
12
+ 80.600000 80.600000 END
@@ -0,0 +1,16 @@
1
+ 2.100000 2.100000 404
2
+ 9.540000 9.540000 405
3
+ 17.500000 17.500000 406
4
+ 24.080000 24.080000 407
5
+ 29.580000 29.580000 408
6
+ 35.190000 35.190000 409
7
+ 43.210000 43.210000 410
8
+ 49.660000 49.660000 411
9
+ 57.130000 57.130000 412
10
+ 62.240000 62.240000 413
11
+ 68.310000 68.310000 414
12
+ 74.160000 74.160000 415
13
+ 79.280000 79.280000 416
14
+ 84.760000 84.760000 417
15
+ 91.870000 91.870000 418
16
+ 99.733333 99.733333 END
@@ -0,0 +1,15 @@
1
+ 2.340000 2.340000 419
2
+ 8.000000 8.000000 420
3
+ 14.460000 14.460000 421
4
+ 20.490000 20.490000 422
5
+ 26.600000 26.600000 423
6
+ 32.180000 32.180000 424
7
+ 38.420000 38.420000 425
8
+ 47.010000 47.010000 426
9
+ 52.820000 52.820000 427
10
+ 59.310000 59.310000 428
11
+ 64.510000 64.510000 429
12
+ 69.190000 69.190000 430
13
+ 75.710000 75.710000 431
14
+ 82.840000 82.840000 432
15
+ 88.760000 88.760000 END
@@ -0,0 +1,17 @@
1
+ 2.120000 2.120000 433
2
+ 7.700000 7.700000 434
3
+ 13.540000 13.540000 435
4
+ 18.720000 18.720000 436
5
+ 23.920000 23.920000 437
6
+ 29.040000 29.040000 438
7
+ 37.480000 37.480000 439
8
+ 43.270000 43.270000 440
9
+ 48.550000 48.550000 441
10
+ 56.200000 56.200000 442
11
+ 60.970000 60.970000 443
12
+ 66.690000 66.690000 444
13
+ 73.370000 73.370000 445
14
+ 78.930000 78.930000 446
15
+ 84.000000 84.000000 447
16
+ 90.360000 90.360000 448
17
+ 96.533333 96.533333 END
@@ -0,0 +1,9 @@
1
+ 2.490000 2.490000 449
2
+ 9.450000 9.450000 450
3
+ 15.740000 15.740000 451
4
+ 22.890000 22.890000 452
5
+ 28.480000 28.480000 453
6
+ 36.740000 36.740000 454
7
+ 41.690000 41.690000 455
8
+ 48.030000 48.030000 456
9
+ 54.906667 54.906667 END
@@ -0,0 +1,10 @@
1
+ 1.840000 1.840000 457
2
+ 6.160000 6.160000 458
3
+ 12.100000 12.100000 459
4
+ 17.820000 17.820000 460
5
+ 24.680000 24.680000 461
6
+ 30.210000 30.210000 462
7
+ 38.220000 38.220000 463
8
+ 43.890000 43.890000 464
9
+ 48.900000 48.900000 465
10
+ 55.960000 55.960000 END
@@ -0,0 +1,12 @@
1
+ 2.490000 2.490000 466
2
+ 11.430000 11.430000 467
3
+ 16.950000 16.950000 468
4
+ 22.210000 22.210000 469
5
+ 28.040000 28.040000 470
6
+ 35.040000 35.040000 471
7
+ 41.190000 41.190000 472
8
+ 48.920000 48.920000 473
9
+ 56.620000 56.620000 474
10
+ 63.500000 63.500000 475
11
+ 69.510000 69.510000 476
12
+ 75.466667 75.466667 END
@@ -0,0 +1,16 @@
1
+ 1.680000 1.680000 477
2
+ 7.380000 7.380000 478
3
+ 13.050000 13.050000 479
4
+ 19.460000 19.460000 480
5
+ 25.270000 25.270000 481
6
+ 30.770000 30.770000 482
7
+ 35.840000 35.840000 483
8
+ 42.220000 42.220000 484
9
+ 48.630000 48.630000 485
10
+ 52.910000 52.910000 486
11
+ 60.190000 60.190000 487
12
+ 66.020000 66.020000 488
13
+ 72.660000 72.660000 489
14
+ 79.300000 79.300000 490
15
+ 85.910000 85.910000 491
16
+ 94.066667 94.066667 END
@@ -0,0 +1,16 @@
1
+ 2.650000 2.650000 492
2
+ 8.030000 8.030000 493
3
+ 15.650000 15.650000 494
4
+ 21.010000 21.010000 495
5
+ 25.850000 25.850000 496
6
+ 30.410000 30.410000 497
7
+ 35.710000 35.710000 498
8
+ 42.200000 42.200000 499
9
+ 46.900000 46.900000 500
10
+ 52.310000 52.310000 501
11
+ 57.730000 57.730000 502
12
+ 62.920000 62.920000 503
13
+ 67.340000 67.340000 504
14
+ 75.140000 75.140000 505
15
+ 80.710000 80.710000 506
16
+ 88.866667 88.866667 END
@@ -0,0 +1,12 @@
1
+ 2.170000 2.170000 507
2
+ 7.700000 7.700000 508
3
+ 14.750000 14.750000 509
4
+ 19.560000 19.560000 510
5
+ 24.880000 24.880000 511
6
+ 32.930000 32.930000 512
7
+ 37.410000 37.410000 513
8
+ 43.240000 43.240000 514
9
+ 49.050000 49.050000 515
10
+ 56.030000 56.030000 516
11
+ 63.270000 63.270000 517
12
+ 69.173333 69.173333 END
@@ -0,0 +1,14 @@
1
+ 2.140000 2.140000 518
2
+ 8.620000 8.620000 519
3
+ 14.610000 14.610000 520
4
+ 22.650000 22.650000 521
5
+ 29.220000 29.220000 522
6
+ 36.780000 36.780000 523
7
+ 43.350000 43.350000 524
8
+ 50.370000 50.370000 525
9
+ 55.120000 55.120000 526
10
+ 63.080000 63.080000 527
11
+ 68.530000 68.530000 528
12
+ 79.800000 79.800000 529
13
+ 89.260000 89.260000 530
14
+ 95.226667 95.226667 END
@@ -0,0 +1,18 @@
1
+ 3.110000 3.110000 531
2
+ 8.480000 8.480000 532
3
+ 13.320000 13.320000 533
4
+ 17.850000 17.850000 534
5
+ 26.270000 26.270000 535
6
+ 34.080000 34.080000 536
7
+ 39.180000 39.180000 537
8
+ 50.460000 50.460000 538
9
+ 59.520000 59.520000 539
10
+ 68.400000 68.400000 540
11
+ 73.820000 73.820000 541
12
+ 83.080000 83.080000 542
13
+ 88.780000 88.780000 543
14
+ 93.020000 93.020000 544
15
+ 102.540000 102.540000 545
16
+ 109.410000 109.410000 546
17
+ 115.300000 115.300000 547
18
+ 120.666667 120.666667 END
@@ -0,0 +1,14 @@
1
+ 2.790000 2.790000 548
2
+ 8.470000 8.470000 549
3
+ 14.180000 14.180000 550
4
+ 21.850000 21.850000 551
5
+ 27.850000 27.850000 552
6
+ 35.540000 35.540000 553
7
+ 42.200000 42.200000 554
8
+ 49.490000 49.490000 555
9
+ 54.520000 54.520000 556
10
+ 63.140000 63.140000 557
11
+ 70.580000 70.580000 558
12
+ 76.210000 76.210000 559
13
+ 82.640000 82.640000 560
14
+ 88.666667 88.666667 END
data/exe/duo_splitter ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "duo_splitter"
4
+
5
+ runner = DuoSplitter::Runner.new(ARGV)
6
+ runner.run
@@ -0,0 +1,24 @@
1
+ require "duo_splitter/album"
2
+ require "duo_splitter/section"
3
+ require "duo_splitter/sentence"
4
+
5
+ require "duo_splitter/encoder"
6
+ require "duo_splitter/aac_encoder"
7
+ require "duo_splitter/mp3_encoder"
8
+ require "duo_splitter/wav_encoder"
9
+
10
+ require "duo_splitter/runner"
11
+
12
+ require "duo_splitter/version"
13
+
14
+ require 'pathname'
15
+
16
+ module DuoSplitter
17
+ class Error < StandardError; end
18
+
19
+ DATA_DIR = Pathname.new(__dir__).parent.join('data')
20
+
21
+ NUMBER_OF_SECTIONS = 45
22
+
23
+ NUMBER_OF_SENTENCES = 560
24
+ end
@@ -0,0 +1,13 @@
1
+ module DuoSplitter
2
+ class AACEncoder < Encoder
3
+ attr_reader :ext, :encoding_options
4
+
5
+ def initialize(**)
6
+ super
7
+ @ext = 'm4a'
8
+ @encoding_options = ['-codec:a', 'aac', '-b:a', '256k']
9
+ end
10
+ end
11
+
12
+ Encoder.register(:aac, AACEncoder)
13
+ end
@@ -0,0 +1,21 @@
1
+ module DuoSplitter
2
+ class Album
3
+ attr_reader :sections
4
+
5
+ def initialize
6
+ @sections = load_sections
7
+ end
8
+
9
+ def sentences(intro: true)
10
+ sections.map(&:sentences).flatten.reject do |sentence|
11
+ !intro && sentence.intro?
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def load_sections
18
+ 1.upto(NUMBER_OF_SECTIONS).map {|n| Section.new(number: n) }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,71 @@
1
+ require 'pathname'
2
+
3
+ module DuoSplitter
4
+ class Encoder
5
+ class << self
6
+ def known_encoders
7
+ @known_encoders ||= {}
8
+ end
9
+
10
+ def register(key, encoder)
11
+ known_encoders[key] = encoder
12
+ end
13
+ end
14
+
15
+ def initialize(album:, output_dir:, output_intro:, add_section_prefix:, ffmpeg_path:)
16
+ @album = album
17
+ @output_dir = Pathname.new(output_dir)
18
+ @output_intro = output_intro
19
+ @add_section_prefix = add_section_prefix
20
+ @ffmpeg_path = ffmpeg_path
21
+ end
22
+
23
+ def run
24
+ commands = to_commands
25
+
26
+ return if commands.empty?
27
+
28
+ @output_dir.mkpath
29
+
30
+ commands.each.with_index(1) do |command, index|
31
+ $stderr.print "proccessing #{index}/#{commands.size}\r"
32
+
33
+ shell_output = IO.popen(command, err: [:child, :out]) {|io| io.read }
34
+
35
+ status = $?.exitstatus
36
+
37
+ unless status.zero?
38
+ $stderr.print "\n"
39
+ $stderr.print "#{shell_output}\n"
40
+ raise Error, "process exit with #{status}"
41
+ end
42
+ end
43
+
44
+ $stderr.print "\n"
45
+ $stderr.print "\u{1F37A} done.\n"
46
+ end
47
+
48
+ def to_commands
49
+ sentences = @album.sentences(intro: @output_intro).select {|sentence| sentence.section.source_path }
50
+
51
+ sentences.map do |sentence|
52
+ output_name = sentence.output_name(add_section_prefix: @add_section_prefix, ext: ext)
53
+
54
+ command = [@ffmpeg_path, '-y']
55
+ command += ['-i', sentence.section.source_path.to_s]
56
+ command += ['-ss', sentence.start_pos, '-to', sentence.end_pos]
57
+ command += encoding_options
58
+ command += [@output_dir.join(output_name).to_s]
59
+ command
60
+ end
61
+ end
62
+
63
+ def ext
64
+ raise NotImplementedError, '#ext must be defined in a sub class'
65
+ end
66
+
67
+ def encoding_options
68
+ raise NotImplementedError, '#encoding_options must be defined in a sub class'
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,13 @@
1
+ module DuoSplitter
2
+ class MP3Encoder < Encoder
3
+ attr_reader :ext, :encoding_options
4
+
5
+ def initialize(**)
6
+ super
7
+ @ext = 'mp3'
8
+ @encoding_options = ['-codec:a', 'libmp3lame', '-q:a', '0']
9
+ end
10
+ end
11
+
12
+ Encoder.register(:mp3, MP3Encoder)
13
+ end
@@ -0,0 +1,93 @@
1
+ require 'optparse'
2
+ require 'pathname'
3
+
4
+ module DuoSplitter
5
+ class Runner
6
+ attr_reader :output_dir, :format, :output_intro, :add_section_prefix, :ffmpeg_path, :album
7
+
8
+ def initialize(argv)
9
+ @output_dir = Pathname.new('~/Desktop/DUO 3.0').expand_path
10
+ @format = :wav
11
+ @known_formats = Encoder.known_encoders.keys.sort
12
+ @output_intro = true
13
+ @add_section_prefix = true
14
+ @ffmpeg_path = 'ffmpeg'
15
+ @album = Album.new
16
+
17
+ parse_options(argv)
18
+ handle_source_paths(argv)
19
+ end
20
+
21
+ def run
22
+ encoder_class = Encoder.known_encoders[@format]
23
+
24
+ encoder = encoder_class.new(
25
+ album: @album,
26
+ output_dir: @output_dir,
27
+ output_intro: @output_intro,
28
+ add_section_prefix: @add_section_prefix,
29
+ ffmpeg_path: @ffmpeg_path
30
+ )
31
+
32
+ encoder.run
33
+ end
34
+
35
+ private
36
+
37
+ def parse_options(argv)
38
+ parser = OptionParser.new
39
+
40
+ parser.banner = %(Usage: #{File.basename($PROGRAM_NAME)} [options] "01 Track 01.wav" "02 Track 02.wav" ... "45 Track 45.wav")
41
+
42
+ parser.on('-d', '--output-dir=PATH', "Output directory (default: #{@output_dir})") do |value|
43
+ @output_dir = Pathname.new(value)
44
+ end
45
+
46
+ parser.on('-f', '--format=FORMAT', @known_formats, "Output format (default: #{@format}; one of #{@known_formats.join(', ')})") do |value|
47
+ @format = value.to_sym
48
+ end
49
+
50
+ parser.on('--[no-]output-intro', "Output intro track (default: #{@output_intro})") do |flag|
51
+ @output_intro = flag
52
+ end
53
+
54
+ parser.on('--[no-]section-number', "Add section number to output name (default: #{@add_section_prefix})") do |flag|
55
+ @add_section_prefix = flag
56
+ end
57
+
58
+ parser.on('--ffmpeg-path=PATH', "Path to ffmpeg command (default: #{@ffmpeg_path})") do |value|
59
+ @ffmpeg_path = value
60
+ end
61
+
62
+ begin
63
+ parser.parse!(argv)
64
+ rescue OptionParser::ParseError => error
65
+ raise Error, error.message
66
+ end
67
+
68
+ unless @add_section_prefix
69
+ @output_intro = false
70
+ end
71
+ end
72
+
73
+ def handle_source_paths(argv)
74
+ argv.each do |source_path|
75
+ source_path = Pathname.new(source_path)
76
+
77
+ if /\A(\d+)/ =~ source_path.basename.to_s
78
+ section_number = $1.to_i
79
+
80
+ section = @album.sections.find {|section| section.number == section_number }
81
+
82
+ if section
83
+ section.source_path = source_path
84
+ else
85
+ raise Error, "invalid section number: #{section_number}"
86
+ end
87
+ else
88
+ raise Error, "input file name doesn't start with a section number: #{source_path}"
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,30 @@
1
+ module DuoSplitter
2
+ class Section
3
+ attr_reader :number, :sentences
4
+
5
+ attr_accessor :source_path
6
+
7
+ def initialize(number:)
8
+ @number = number
9
+ @sentences = load_sentences
10
+ end
11
+
12
+ private
13
+
14
+ def load_sentences
15
+ label_path = DATA_DIR.join('labels/%02d.txt' % number)
16
+
17
+ records = label_path.readlines.map {|line| line.chomp.split(/\t/) }
18
+
19
+ records.unshift(%w[0 0 0])
20
+
21
+ records.each_cons(2).map do |current_record, next_record|
22
+ sentence_number = current_record.last.to_i
23
+ start_pos = current_record.first
24
+ end_pos = next_record.first
25
+
26
+ Sentence.new(number: sentence_number, start_pos: start_pos, end_pos: end_pos, section: self)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ module DuoSplitter
2
+ class Sentence
3
+ attr_reader :number, :start_pos, :end_pos, :section
4
+
5
+ def initialize(number:, start_pos:, end_pos:, section:)
6
+ @number = number
7
+ @start_pos = start_pos
8
+ @end_pos = end_pos
9
+ @section = section
10
+ end
11
+
12
+ def intro?
13
+ number.zero?
14
+ end
15
+
16
+ def output_name(add_section_prefix: true, ext:)
17
+ name = '%03d.%s' % [number, ext]
18
+ name = ('%02d-' % section.number) + name if add_section_prefix
19
+ name
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module DuoSplitter
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,13 @@
1
+ module DuoSplitter
2
+ class WAVEncoder < Encoder
3
+ attr_reader :ext, :encoding_options
4
+
5
+ def initialize(**)
6
+ super
7
+ @ext = 'wav'
8
+ @encoding_options = ['-codec:a', 'pcm_s16le']
9
+ end
10
+ end
11
+
12
+ Encoder.register(:wav, WAVEncoder)
13
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: duo_splitter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - healthypackrat
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-02-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - healthypackrat@gmail.com
58
+ executables:
59
+ - duo_splitter
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - README.md
64
+ - data/labels/01.txt
65
+ - data/labels/02.txt
66
+ - data/labels/03.txt
67
+ - data/labels/04.txt
68
+ - data/labels/05.txt
69
+ - data/labels/06.txt
70
+ - data/labels/07.txt
71
+ - data/labels/08.txt
72
+ - data/labels/09.txt
73
+ - data/labels/10.txt
74
+ - data/labels/11.txt
75
+ - data/labels/12.txt
76
+ - data/labels/13.txt
77
+ - data/labels/14.txt
78
+ - data/labels/15.txt
79
+ - data/labels/16.txt
80
+ - data/labels/17.txt
81
+ - data/labels/18.txt
82
+ - data/labels/19.txt
83
+ - data/labels/20.txt
84
+ - data/labels/21.txt
85
+ - data/labels/22.txt
86
+ - data/labels/23.txt
87
+ - data/labels/24.txt
88
+ - data/labels/25.txt
89
+ - data/labels/26.txt
90
+ - data/labels/27.txt
91
+ - data/labels/28.txt
92
+ - data/labels/29.txt
93
+ - data/labels/30.txt
94
+ - data/labels/31.txt
95
+ - data/labels/32.txt
96
+ - data/labels/33.txt
97
+ - data/labels/34.txt
98
+ - data/labels/35.txt
99
+ - data/labels/36.txt
100
+ - data/labels/37.txt
101
+ - data/labels/38.txt
102
+ - data/labels/39.txt
103
+ - data/labels/40.txt
104
+ - data/labels/41.txt
105
+ - data/labels/42.txt
106
+ - data/labels/43.txt
107
+ - data/labels/44.txt
108
+ - data/labels/45.txt
109
+ - exe/duo_splitter
110
+ - lib/duo_splitter.rb
111
+ - lib/duo_splitter/aac_encoder.rb
112
+ - lib/duo_splitter/album.rb
113
+ - lib/duo_splitter/encoder.rb
114
+ - lib/duo_splitter/mp3_encoder.rb
115
+ - lib/duo_splitter/runner.rb
116
+ - lib/duo_splitter/section.rb
117
+ - lib/duo_splitter/sentence.rb
118
+ - lib/duo_splitter/version.rb
119
+ - lib/duo_splitter/wav_encoder.rb
120
+ homepage: https://github.com/healthypackrat/duo_splitter
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubygems_version: 3.0.1
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Split "DUO 3.0 CD" into separate tracks
143
+ test_files: []