SkillAgentSearch skills...

Pic2wav

Encode an image to sound (WAV file) and view it as a spectrogram. Optimized Python 3 version.

Install / Use

/learn @unreal79/Pic2wav
About this skill

Quality Score

0/100

Supported Platforms

Zed

README

pic2wav - Spectrogram from picture

Encode an image to sound (WAV file) and view it as a spectrogram in audio player.

Example

python3 pic2wav.py picture.png -d8 -r200

Source picture:

<img src="picture.png" alt="drawing" width="300"/>

Spectrogram of created WAV file:

<img src="picture.png.wav.spectrogram.png" alt="drawing" width="300"/>

Options

pic2wav.py [[-p] <picture>] [-w <output.wav>] [-d <seconds>] [-r <resolution>] [-e] [-i]
Options:
  -p - input picture file name (PNG, JPEG, etc.) (default is 'picture.png')
  -w - output WAV file name (default is 'input picture file' + '.wav')
  -d - output sound file duration in seconds (float) (default is 2)
  -r - spectrogram resolution (height) in pixels; affects work time (default is 256)
  -e - equalize image (enhances contrast)
  -i - invert image colors

Optimisation

The code is optimized for pefromance in Python 3 with math and Pillow (PIL) libraries.

I recommend running it under PyPy -- this gives about 30% speedup.

Thanks

Related Skills

View on GitHub
GitHub Stars11
CategoryProduct
Updated1y ago
Forks1

Languages

Python

Security Score

80/100

Audited on Aug 13, 2024

No findings