1SPECTROGRAPHIC(1) spectrographic SPECTROGRAPHIC(1)
2
3
4
6 spectrographic - spectrographic 0.9.3
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. Contributors
15 and Changelog.
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 seconds (duration {int} -- Duration of sound in) --
110
111 Keyword Arguments
112
113 • (default (y_resolution {int} -- Number of pixels to
114 plot) -- {44100})
115
116 • spectrograph (max_freq {int} -- Maximal frequency in
117 the) --
118
119 • (default -- {10000})
120
121 • spectrograph --
122
123 • (default -- {17000})
124
125 • (default -- {1000})
126
127 • pixel (num_tones {int} -- Number of tones to use to
128 fill out each) --
129
130 • (default -- {3})
131
132 • pixels (contrast {float} -- Contrast between loud and
133 quiet) --
134
135 • (default -- {5})
136
137 gen_soundwall(column: ndarray)
138 Takes a column of pixels and generates the sound wall.
139
140 [description]
141
142 Parameters
143
144 • of (column {np.ndarray} -- Y_RESOLUTION long
145 column) --
146
147 • pixels (values between 0 and 1) --
148
149 Returns
150 np.ndarray -- soundwall
151
152 pixel_to_sound(y: int, intensity: float = 1)
153 Takes a pixel in a imagae column at the y'th position
154 from the top and turns it into a sound at a corresponding
155 position in the spectrum.
156
157 [description]
158
159 Parameters
160 top. (y {int} -- position of pixel in column from
161 the) --
162
163 Keyword Arguments
164 (default (intensity {float} -- [description]) --
165 {1})
166
167 Returns
168 np.ndarray -- sound array
169
170 Raises ValueError --
171
172 class spectrographic.base.SpectroGraphic(path: Path, height: int = 100,
173 duration: int = 20, min_freq: int = 1000, max_freq: int = 8000, sam‐
174 ple_rate: int = 44100, num_tones: int = 3, contrast: float = 5,
175 use_black_and_white: bool = False)
176 Bases: object
177
178 Takes an image file and creates a sound that draws that image on
179 a spectrogram.
180
181 [description] :param path {Path} -- Path to file (e.g.:
182 {"./data/python.png"})
183
184 Keyword Arguments
185
186 • (default (sample_rate {int} -- Sample rate) -- {100})
187
188 • (default -- {20})
189
190 • (default -- {1000})
191
192 • (default -- {8000})
193
194 • (default -- {44100})
195
196 • pixel (num_tones {int} -- Number of tones to used to
197 fill in each) --
198
199 • (default -- {3})
200
201 • pixels (contrast {float} -- Contrast between loud and
202 quiet) --
203
204 • (default -- {5})
205
206 play() Plays the SpectroGraphic sound.
207
208 save(wav_file: Path = 'SpectroGraphic.wav')
209 saves the spectrographic to a .wav file
210
211 We use the wavio module
212
213 property sound_array
214
215 spectrographic.cli module
216 This is a skeleton file that can serve as a starting point for a Python
217 console script. To run this script uncomment the following lines in the
218 [options.entry_points] section in setup.cfg:
219
220 console_scripts =
221 spectrographic = spectrographic.cli:run
222
223 Then run python setup.py install which will install the command spec‐
224 trographic inside your current environment.
225
226 spectrographic.cli.main(args)
227 Main entry point allowing external calls
228
229 Parameters
230 args ([str]) -- command line parameter list
231
232 spectrographic.cli.parse_args(args)
233 Parse command line parameters
234
235 Parameters
236 args ([str]) -- command line parameters as list of
237 strings
238
239 Returns
240 command line parameters namespace
241
242 Return type
243 argparse.Namespace
244
245 spectrographic.cli.run()
246 Entry point for console_scripts
247
248 Module contents
250 • Index
251
252 • Module Index
253
254 • Search Page
255
257 unknown
258
260 2022, Levi Borodenko
261
262
263
264
2650.9.3 Nov 22, 2022 SPECTROGRAPHIC(1)