spectrographic - Man Page

Name

spectrographic ā€” spectrographic 0.9.3

This is the documentation of spectrographic.

NOTE:

This is the main page of your project's Sphinx documentation. It is formatted in reStructuredText. Add additional pages by creating rst-files in docs and adding them to the toctree below. Use then references in order to link them from this page, e.g. Contributors and Changelog.

It is also possible to refer to the documentation of other Python packages with the Python domain syntax. By default you can reference the documentation of Sphinx, Python, NumPy, SciPy, matplotlib, Pandas, Scikit-Learn. You can add more by extending the intersphinx_mapping in your Sphinx's conf.py.

The pretty useful extension autodoc is activated by default and lets you include documentation from docstrings. Docstrings can be written in Google style (recommended!), NumPy style and classical style.

Contents

License

The MIT License (MIT)

Copyright (c) 2019 Levi Borodenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR Copyright HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors

  • Levi Borodenko <Levi.borodenko@gmail.com>

Changelog

Version 0.8.0

  • The core implementation is done
    • base.py contains a working implementation

    of the spetrographic idea.

  • Created some examples.
  • Adding requirements

Version 0.8.1

  • Wrote README.md
  • test upload to testpypi
  • create demonstrational video

Version 0.8.5

  • quick fix of centering in README.md

Version 0.8.6

  • added gitpython as dependency

Version 0.8.7

  • removed dependencies from config file and moved to requirements

Version 0.9.0

  • Release
  • upload to the official pypi and making github repo public.

Version 0.9.3

  • Put dependencies into setup.cfg so pip can pull them while installing

spectrographic

spectrographic package

Submodules

spectrographic.base module

class spectrographic.base.ColumnToSound(duration: int, sample_rate: int = 44100, min_freq: int = 10000, max_freq: int = 17000, y_resolution: int = 1000, num_tones: int = 3, contrast: float = 5)

Bases: object

Class to turn grey-scale image columns into a sound.

It takes a numpy array of grey intensities (in the range 0 to 1) of length Y_RESOLUTION and turns them into a DURATION seconds long sound in the frequency range between MIN_FREQ and MAX_FREQ.

Parameters

seconds (duration {int} -- Duration of sound in) --

Keyword Arguments
  • (default (y_resolution {int} -- Number of pixels to plot) -- {44100})
  • spectrograph (max_freq {int} -- Maximal frequency in the) --
  • (default -- {10000})
  • spectrograph --
  • (default -- {17000})
  • (default -- {1000})
  • pixel (num_tones {int} -- Number of tones to use to fill out each) --
  • (default -- {3})
  • pixels (contrast {float} -- Contrast between loud and quiet) --
  • (default -- {5})
gen_soundwall(column: ndarray)

Takes a column of pixels and generates the sound wall.

[description]

Parameters
  • of (column {np.ndarray} -- Y_RESOLUTION long column) --
  • pixels (values between 0 and 1) --
Returns

np.ndarray -- soundwall

pixel_to_sound(y: int, intensity: float = 1)

Takes a pixel in a imagae column at the y'th position from the top and turns it into a sound at a corresponding position in the spectrum.

[description]

Parameters

top. (y {int} -- position of pixel in column from the) --

Keyword Arguments

(default (intensity {float} -- [description]) -- {1})

Returns

np.ndarray -- sound array

Raises

ValueError --

class spectrographic.base.SpectroGraphic(path: Path, height: int = 100, duration: int = 20, min_freq: int = 1000, max_freq: int = 8000, sample_rate: int = 44100, num_tones: int = 3, contrast: float = 5, use_black_and_white: bool = False)

Bases: object

Takes an image file and creates a sound that draws that image on a spectrogram.

[description] :param path {Path} -- Path to file (e.g.: {"./data/python.png"})

Keyword Arguments
  • (default (sample_rate {int} -- Sample rate) -- {100})
  • (default -- {20})
  • (default -- {1000})
  • (default -- {8000})
  • (default -- {44100})
  • pixel (num_tones {int} -- Number of tones to used to fill in each) --
  • (default -- {3})
  • pixels (contrast {float} -- Contrast between loud and quiet) --
  • (default -- {5})
play()

Plays the SpectroGraphic sound.

save(wav_file: Path = 'SpectroGraphic.wav')

saves the spectrographic to a .wav file

We use the wavio module

property sound_array

spectrographic.cli module

This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the [options.entry_points] section in setup.cfg:

console_scripts =

spectrographic = spectrographic.cli:run

Then run python setup.py install which will install the command spectrographic inside your current environment.

spectrographic.cli.main(args)

Main entry point allowing external calls

Parameters

args ([str]) -- command line parameter list

spectrographic.cli.parse_args(args)

Parse command line parameters

Parameters

args ([str]) -- command line parameters as list of strings

Returns

command line parameters namespace

Return type

argparse.Namespace

spectrographic.cli.run()

Entry point for console_scripts

Module contents

Indices and Tables

Author

unknown

Info

Jan 27, 2024 0.9.3