easyaudio_utils 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/easyaudio_utils.rb +50 -42
- data.tar.gz.sig +0 -0
- metadata +43 -42
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2db36bcf3b91cd313debbd7f100e00ab90e616b3aa96fc40c62bbc29cf62e92f
|
|
4
|
+
data.tar.gz: 812c13474110e1e5e0c36858a7a714d15aede16c343d57a919112110c1d444d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 628009f593d4a04d1443a11b66d811db1cdc29e6f15fcff306c92cc7e02453c19928acbbe3336da81e124a8cd094f5c10d10b027fb4fd112131ba38b2a1c1629
|
|
7
|
+
data.tar.gz: 2a6368bdb9e99b5b05c916349a8c27b992ed959bc465fb507e84167d72269d08d55bee67a3dfc5dfecd25a44ef2be06c34c11e42d3712f43b3162ccc9a31d9a8
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/easyaudio_utils.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'ogginfo'
|
|
|
9
9
|
# `apt-get install mplayer sox vorbis-tools ffmpeg
|
|
10
10
|
|
|
11
11
|
# installing youtube-dl:
|
|
12
|
-
#
|
|
12
|
+
#
|
|
13
13
|
# `sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/bin/youtube-dl`
|
|
14
14
|
#
|
|
15
15
|
# `sudo chmod a+rx /usr/bin/youtube-dl`
|
|
@@ -20,7 +20,7 @@ require 'ogginfo'
|
|
|
20
20
|
|
|
21
21
|
module CommandHelper
|
|
22
22
|
using ColouredText
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
def list(a=@commands)
|
|
25
25
|
|
|
26
26
|
format_command = ->(s) do
|
|
@@ -48,16 +48,17 @@ class EasyAudioUtils
|
|
|
48
48
|
* concat_files # stiches wav files together
|
|
49
49
|
* convert # converts a file from 1 format to another #wav #ogg
|
|
50
50
|
* cut # cuts the audio into a new file as defined by start time and duration
|
|
51
|
-
* duration # return the duration for a wav or ogg
|
|
51
|
+
* duration # return the duration for a wav or ogg
|
|
52
52
|
* generate_silence # generates silence in a wav file
|
|
53
53
|
* play # plays using mplayer
|
|
54
54
|
* record # alias for capture_desktop
|
|
55
55
|
* split # split the wav file by silence
|
|
56
|
+
* volume # increase or decrease (0.50 is equal to 50%)
|
|
56
57
|
* youtube_dl # downloads audio in Ogg (opus) format
|
|
57
58
|
".strip.lines.map {|x| x[/(?<=\* ).*/]}.sort
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
def initialize(audio_in=nil, audio_out='audio.wav', out: audio_out,
|
|
61
|
+
def initialize(audio_in=nil, audio_out='audio.wav', out: audio_out,
|
|
61
62
|
working_dir: '/tmp')
|
|
62
63
|
|
|
63
64
|
@file_in, @file_out, @working_dir = audio_in, out, working_dir
|
|
@@ -69,42 +70,42 @@ class EasyAudioUtils
|
|
|
69
70
|
#
|
|
70
71
|
def capture(show: false)
|
|
71
72
|
|
|
72
|
-
command = "rec -c 1 -r 8000 -t alsa default #{@file_out} " +
|
|
73
|
+
command = "rec -c 1 -r 8000 -t alsa default #{@file_out} " +
|
|
73
74
|
"silence 1 0.1 5% 5 1.0 5%"
|
|
74
75
|
run command, show
|
|
75
76
|
|
|
76
77
|
end
|
|
77
|
-
|
|
78
|
-
def concat_files(files=[])
|
|
79
|
-
WavTool.new(out: @file_out, ).concat files
|
|
78
|
+
|
|
79
|
+
def concat_files(files=[], sample_rate: nil)
|
|
80
|
+
WavTool.new(out: @file_out, sample_rate: sample_rate).concat files
|
|
80
81
|
end
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
alias concat concat_files
|
|
83
|
-
|
|
84
|
+
|
|
84
85
|
# convert either wav to ogg or ogg to wav
|
|
85
86
|
#
|
|
86
87
|
def convert()
|
|
87
|
-
|
|
88
|
+
|
|
88
89
|
if File.extname(@file_in) == '.ogg' then
|
|
89
|
-
ogg_to_wav() if File.extname(@file_out) == '.wav'
|
|
90
|
+
ogg_to_wav() if File.extname(@file_out) == '.wav'
|
|
90
91
|
else
|
|
91
|
-
wav_to_ogg() if File.extname(@file_out) == '.ogg'
|
|
92
|
+
wav_to_ogg() if File.extname(@file_out) == '.ogg'
|
|
92
93
|
end
|
|
93
|
-
|
|
94
|
+
|
|
94
95
|
end
|
|
95
|
-
|
|
96
|
+
|
|
96
97
|
# cut a section of audio and save it to file
|
|
97
98
|
#
|
|
98
|
-
def cut(starttime, duration)
|
|
99
|
-
|
|
99
|
+
def cut(starttime, duration)
|
|
100
|
+
|
|
100
101
|
command = "avconv -i %s -ss %s -t %s %s" % \
|
|
101
102
|
[@file_in, starttime, duration, @file_out]
|
|
102
|
-
run command, show
|
|
103
|
-
|
|
103
|
+
run command, show
|
|
104
|
+
|
|
104
105
|
end
|
|
105
|
-
|
|
106
|
+
|
|
106
107
|
def duration()
|
|
107
|
-
|
|
108
|
+
|
|
108
109
|
case File.extname(@file_in)
|
|
109
110
|
when '.ogg'
|
|
110
111
|
OggInfo.open(@file_in).length
|
|
@@ -112,64 +113,71 @@ class EasyAudioUtils
|
|
|
112
113
|
WavTool.new().duration(@file_in)
|
|
113
114
|
when '.mp3'
|
|
114
115
|
Mp3Info.new(@file_in).length
|
|
115
|
-
end
|
|
116
|
-
|
|
116
|
+
end
|
|
117
|
+
|
|
117
118
|
end
|
|
118
|
-
|
|
119
|
+
|
|
119
120
|
# silence duration in seconds
|
|
120
121
|
#
|
|
121
122
|
def generate_silence(duration)
|
|
122
123
|
WavTool.new(out: @file_out).silence duration: duration
|
|
123
124
|
end
|
|
124
|
-
|
|
125
|
+
|
|
125
126
|
alias record capture
|
|
126
|
-
|
|
127
|
+
|
|
127
128
|
def play(show: false)
|
|
128
129
|
command = "mplayer #{@file_out}"
|
|
129
130
|
run command, show
|
|
130
131
|
end
|
|
131
|
-
|
|
132
|
+
|
|
132
133
|
# split by silence
|
|
133
134
|
#
|
|
134
|
-
def split(show: false)
|
|
135
|
+
def split(show: false)
|
|
135
136
|
command = "sox -V3 #{@file_in} #{@file_out} silence -l 0 " +
|
|
136
137
|
" 1 0.5 0.1% : newfile : restart"
|
|
137
138
|
run command, show
|
|
138
139
|
end
|
|
139
|
-
|
|
140
|
+
|
|
141
|
+
# volume increase or decrease
|
|
142
|
+
#
|
|
143
|
+
def volume(amount=1.0, show: false)
|
|
144
|
+
command = "sox -v #{amount} #{@file_in} #{@file_out}"
|
|
145
|
+
run command, show
|
|
146
|
+
end
|
|
147
|
+
|
|
140
148
|
# Download and extract audio from a video on YouTube
|
|
141
149
|
#
|
|
142
150
|
# By default, Youtube-dl will save the audio in Ogg (opus) format.
|
|
143
151
|
#
|
|
144
|
-
def youtube_dl(show: false)
|
|
145
|
-
|
|
152
|
+
def youtube_dl(show: false)
|
|
153
|
+
|
|
146
154
|
command = "youtube-dl -x #{url=@file_in}"
|
|
147
155
|
command += ' -o ' + @file_out if @file_out
|
|
148
|
-
run command, show
|
|
156
|
+
run command, show
|
|
149
157
|
|
|
150
|
-
end
|
|
158
|
+
end
|
|
151
159
|
|
|
152
160
|
|
|
153
161
|
private
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def ogg_to_wav()
|
|
157
|
-
`oggdec #{@file_in} #{@file_out}`
|
|
158
|
-
end
|
|
159
|
-
|
|
162
|
+
|
|
163
|
+
|
|
160
164
|
def ogg_to_wav()
|
|
165
|
+
`oggdec #{@file_in} -o #{@file_out}`
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def wav_to_ogg()
|
|
161
169
|
`sox -V #{@file_in} #{@file_out}`
|
|
162
|
-
end
|
|
170
|
+
end
|
|
163
171
|
|
|
164
172
|
def run(command, show=false)
|
|
165
173
|
|
|
166
|
-
if show then
|
|
174
|
+
if show then
|
|
167
175
|
command
|
|
168
176
|
else
|
|
169
177
|
puts "Using ->" + command
|
|
170
178
|
system command
|
|
171
179
|
end
|
|
172
180
|
|
|
173
|
-
end
|
|
181
|
+
end
|
|
174
182
|
|
|
175
183
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easyaudio_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -10,73 +10,74 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
13
|
+
MIIEljCCAv6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBIMRIwEAYDVQQDDAlnZW1t
|
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
|
15
|
+
8ixkARkWAmV1MB4XDTIyMDcxNTA3NTAxNVoXDTIzMDcxNTA3NTAxNVowSDESMBAG
|
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
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rgBIwcqbXtmK5DSpABzPSHQe0rCtLwCJ4JdXgTuo7oFjZT2vooZw8xYvLBzQO
|
|
32
|
+
QbNYfvo0f/hiC33cgQRGzvdjUxXfUrAVfYGQ4ojidfoSEwRqbOk5ZKAc+VFp1Z+t
|
|
33
|
+
iGG8j7K5IxgKs/AMr58nOTmBhzi/s5l4d/b0Xpfzl6MZ8dvb3mcERlY9An5OinOL
|
|
34
|
+
23PTux9AbbfhpMICrfC+LiXbpSDXnitszninLiw4xXoGuqhCtYBfgyYVih8hWD4I
|
|
35
|
+
vu0cR2nfbXRVexqRSfFr1v8temeuL9ruS53Y2+I0erFTUwGux8iL8RuyDZ6v44NE
|
|
36
|
+
F3apwi0l6qdwAskTEyAeMXR7LY7B6wFhidkOS3+jnhOZp9HJZ+YtpDLMYYPDndKG
|
|
37
|
+
3I3tmYQyMHrny9W25zsC7d5azh5HCfjexAo=
|
|
37
38
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
39
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
|
39
40
|
dependencies:
|
|
40
41
|
- !ruby/object:Gem::Dependency
|
|
41
42
|
name: c32
|
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
|
43
44
|
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.2.0
|
|
47
45
|
- - "~>"
|
|
48
46
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '0.
|
|
47
|
+
version: '0.3'
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 0.3.0
|
|
50
51
|
type: :runtime
|
|
51
52
|
prerelease: false
|
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
54
|
requirements:
|
|
54
|
-
- - ">="
|
|
55
|
-
- !ruby/object:Gem::Version
|
|
56
|
-
version: 0.2.0
|
|
57
55
|
- - "~>"
|
|
58
56
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '0.
|
|
57
|
+
version: '0.3'
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 0.3.0
|
|
60
61
|
- !ruby/object:Gem::Dependency
|
|
61
62
|
name: wavtool
|
|
62
63
|
requirement: !ruby/object:Gem::Requirement
|
|
63
64
|
requirements:
|
|
64
|
-
- - ">="
|
|
65
|
-
- !ruby/object:Gem::Version
|
|
66
|
-
version: 0.1.0
|
|
67
65
|
- - "~>"
|
|
68
66
|
- !ruby/object:Gem::Version
|
|
69
67
|
version: '0.1'
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 0.1.0
|
|
70
71
|
type: :runtime
|
|
71
72
|
prerelease: false
|
|
72
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
74
|
requirements:
|
|
74
|
-
- - ">="
|
|
75
|
-
- !ruby/object:Gem::Version
|
|
76
|
-
version: 0.1.0
|
|
77
75
|
- - "~>"
|
|
78
76
|
- !ruby/object:Gem::Version
|
|
79
77
|
version: '0.1'
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: 0.1.0
|
|
80
81
|
- !ruby/object:Gem::Dependency
|
|
81
82
|
name: ruby-mp3info
|
|
82
83
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -118,7 +119,7 @@ dependencies:
|
|
|
118
119
|
- !ruby/object:Gem::Version
|
|
119
120
|
version: 0.7.2
|
|
120
121
|
description:
|
|
121
|
-
email:
|
|
122
|
+
email: digital.robertson@gmail.com
|
|
122
123
|
executables: []
|
|
123
124
|
extensions: []
|
|
124
125
|
extra_rdoc_files: []
|
|
@@ -143,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
143
144
|
- !ruby/object:Gem::Version
|
|
144
145
|
version: '0'
|
|
145
146
|
requirements: []
|
|
146
|
-
rubygems_version: 3.
|
|
147
|
+
rubygems_version: 3.3.7
|
|
147
148
|
signing_key:
|
|
148
149
|
specification_version: 4
|
|
149
150
|
summary: A wrapper for various command-line audio utilities under GNU/Linux.
|
metadata.gz.sig
CHANGED
|
Binary file
|