1SPECTROGRAPHIC(1) spectrographic SPECTROGRAPHIC(1)
2
3
4
6 spectrographic - spectrographic unknown
7
8 This is the documentation of spectrographic.
9
10 NOTE:
11 This is the main page of your project's Sphinx documentation. It is
12 formatted in reStructuredText. Add additional pages by creating
13 rst-files in docs and adding them to the toctree below. Use then
14 references in order to link them from this page, e.g. authors and
15 changes.
16
17 It is also possible to refer to the documentation of other Python
18 packages with the Python domain syntax. By default you can reference
19 the documentation of Sphinx, Python, NumPy, SciPy, matplotlib,
20 Pandas, Scikit-Learn. You can add more by extending the inter‐
21 sphinx_mapping in your Sphinx's conf.py.
22
23 The pretty useful extension autodoc is activated by default and lets
24 you include documentation from docstrings. Docstrings can be written
25 in Google style (recommended!), NumPy style and classical style.
26
28 License
29 The MIT License (MIT)
30
31 Copyright (c) 2019 Levi Borodenko
32
33 Permission is hereby granted, free of charge, to any person obtaining a
34 copy of this software and associated documentation files (the "Soft‐
35 ware"), to deal in the Software without restriction, including without
36 limitation the rights to use, copy, modify, merge, publish, distribute,
37 sublicense, and/or sell copies of the Software, and to permit persons
38 to whom the Software is furnished to do so, subject to the following
39 conditions:
40
41 The above copyright notice and this permission notice shall be included
42 in all copies or substantial portions of the Software.
43
44 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
45 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER‐
46 CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
47 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
48 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT‐
50 WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
52 Contributors
53 · Levi Borodenko <Levi.borodenko@gmail.com>
54
55 Changelog
56 Version 0.8.0
57 ·
58
59 The core implementation is done
60
61 · base.py contains a working implementation
62
63 of the spetrographic idea.
64
65 · Created some examples.
66
67 · Adding requirements
68
69 Version 0.8.1
70 · Wrote README.md
71
72 · test upload to testpypi
73
74 · create demonstrational video
75
76 Version 0.8.5
77 · quick fix of centering in README.md
78
79 Version 0.8.6
80 · added gitpython as dependency
81
82 Version 0.8.7
83 · removed dependencies from config file and moved to requirements
84
85 Version 0.9.0
86 · Release
87
88 · upload to the official pypi and making github repo public.
89
90 Version 0.9.3
91 · Put dependencies into setup.cfg so pip can pull them while installing
92
93 spectrographic
94 spectrographic package
95 Submodules
96 spectrographic.base module
97 class spectrographic.base.ColumnToSound(duration: int, sample_rate: int
98 = 44100, min_freq: int = 10000, max_freq: int = 17000, y_resolution:
99 int = 1000, num_tones: int = 3, contrast: float = 5)
100 Bases: object
101
102 Class to turn grey-scale image columns into a sound.
103
104 It takes a numpy array of grey intensities (in the range 0 to 1)
105 of length Y_RESOLUTION and turns them into a DURATION seconds
106 long sound in the frequency range between MIN_FREQ and MAX_FREQ.
107
108 Parameters
109 {int} -- Duration of sound in seconds (duration) --
110
111 Keyword Arguments
112
113 · {int} -- Sample rate of sound (default (sample_rate) --
114 {44100})
115
116 · {int} -- Minimal frequency in the spectrograph
117 (min_freq) --
118
119 · (default -- {10000})
120
121 · {int} -- Maximal frequency in the spectrograph
122 (max_freq) --
123
124 · (default -- {17000})
125
126 · {int} -- Number of pixels to plot (default (y_resolu‐
127 tion) -- {1000})
128
129 · {int} -- Number of tones to use to fill out each pixel
130 (num_tones) --
131
132 · (default -- {3})
133
134 · {float} -- Contrast between loud and quiet pixels (con‐
135 trast) --
136
137 · (default -- {5})
138
139 gen_soundwall(column: numpy.ndarray)
140 Takes a column of pixels and generates the sound wall.
141
142 [description]
143
144 Parameters
145
146 · {np.ndarray} -- Y_RESOLUTION long column of
147 (column) --
148
149 · pixels (values between 0 and 1) --
150
151 Returns
152 np.ndarray -- soundwall
153
154 pixel_to_sound(y: int, intensity: float = 1)
155 Takes a pixel in a imagae column at the y'th position
156 from the top and turns it into a sound at a corresponding
157 position in the spectrum.
158
159 [description]
160
161 Parameters
162 {int} -- position of pixel in column from the top.
163 (y) --
164
165 Keyword Arguments
166 {float} -- [description] (default (intensity) --
167 {1})
168
169 Returns
170 np.ndarray -- sound array
171
172 Raises ValueError --
173
174 class spectrographic.base.SpectroGraphic(path: pathlib.Path, height:
175 int = 100, duration: int = 20, min_freq: int = 1000, max_freq: int =
176 8000, sample_rate: int = 44100, num_tones: int = 3, contrast: float =
177 5, use_black_and_white: bool = False)
178 Bases: object
179
180 Takes an image file and creates a sound that draws that image on
181 a spectrogram.
182
183 [description] :param path {Path} -- Path to file (e.g.:
184 {"./data/python.png"})
185
186 Keyword Arguments
187
188 · {int} -- y-resolution in spectrogram (default (height)
189 -- {100})
190
191 · {int} -- duration of sound in seconds (default (dura‐
192 tion) -- {20})
193
194 · {int} -- minimal freq. for image (default (min_freq) --
195 {1000})
196
197 · {int} -- maximal freq. for image (default (max_freq) --
198 {8000})
199
200 · {int} -- Sample rate (default (sample_rate) -- {44100})
201
202 · {int} -- Number of tones to used to fill in each pixel
203 (num_tones) --
204
205 · (default -- {3})
206
207 · {float} -- Contrast between loud and quiet pixels (con‐
208 trast) --
209
210 · (default -- {5})
211
212 play() Plays the SpectroGraphic sound.
213
214 save(wav_file: pathlib.Path = 'SpectroGraphic.wav')
215 saves the spectrographic to a .wav file
216
217 We use the wavio module
218
219 property sound_array
220
221 spectrographic.cli module
222 This is a skeleton file that can serve as a starting point for a Python
223 console script. To run this script uncomment the following lines in the
224 [options.entry_points] section in setup.cfg:
225
226 console_scripts =
227 spectrographic = spectrographic.cli:run
228
229 Then run python setup.py install which will install the command spec‐
230 trographic inside your current environment.
231
232 spectrographic.cli.main(args)
233 Main entry point allowing external calls
234
235 Parameters
236 args ([str]) -- command line parameter list
237
238 spectrographic.cli.parse_args(args)
239 Parse command line parameters
240
241 Parameters
242 args ([str]) -- command line parameters as list of
243 strings
244
245 Returns
246 command line parameters namespace
247
248 Return type
249 argparse.Namespace
250
251 spectrographic.cli.run()
252 Entry point for console_scripts
253
254 Module contents
256 · genindex
257
258 · modindex
259
260 · search
261
263 unknown
264
266 2020, Levi Borodenko
267
268
269
270
271unknown Jul 29, 2020 SPECTROGRAPHIC(1)