New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pixeltone.js

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixeltone.js

An auditory creation tool that turns your images into sounds.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
0
Weekly downloads
 
Created
Source

PixeltoneJS — The Auditory Creation Tool

Discord npm Financial Contributors

PixeltoneJS is a JavaScript library that converts images into sound based on their RGB data. By interpreting the colors of the image, the library generates corresponding frequencies to create an audio representation of the image.

Please note that this library is actively evolving. Continuous improvements are imminent. Please check the logs down below;

Features

  • Convert any image to audio
  • Control the frequency ranges for red, green, and blue channels
  • Output audio in WAV format
  • Highly customizable options for fine-tuning the audio output

Installation

To install PixeltoneJS as an npm package, run:

npm install pixeltone.js

Usage

After installing, you can import and use PixeltoneJS in your project:

Example ESModule usage

import { Pixeltone } from 'pixeltone.js';
const pixeltone = new Pixeltone();
pixeltone.createAudioFromImage({ inputImagePath: 'input.png', outputAudioPath: 'output.wav' });

Example CommonJS usage

const { Pixeltone } = require('pixeltone.js');
const pixeltone = new Pixeltone();
pixeltone.createAudioFromImage({ inputImagePath: 'input.png', outputAudioPath: 'output.wav' });

Options

  • inputImagePath: Path to the input image (e.g., ./images/my-image.png).
  • outputAudioPath: Path to save the output audio file (e.g., ./output/audio.wav).
  • sampleRate: Optional, the sample rate for audio. Defaults to 44100.
  • duration: Optional, the duration of each pixel's audio. Defaults to 0.01 seconds.
  • rgbFrequencyRanges: Optional, frequency ranges for the red, green, and blue color channels. See below for default values:
{ r: { min: 30, max: 500, offset: 60 }, g: { min: 500, max: 2000, offset: 250 }, b: { min: 2000, max: 10000, offset: 1000 } }

Change Logs

1.0.0:

  • Major codebase improvement.
  • Transitioned to an object-oriented approach for better scalability and extensibility.
  • For future planned: Allows users to maintain state and extend functionality through the Pixeltone class.
Migration Guide from pre v0.1.1 to v1.0:
  • Replace processSound function imports with Pixeltone class imports.
  • Instantiate a new Pixeltone object using new Pixeltone().
  • Replace processSound calls with pixeltone.createAudioFromImage().
Previous API
import { processSound } from 'pixeltone.js';
processSound({ inputImagePath: 'input.png', outputAudioPath: 'output.wav' });
New API
import { Pixeltone } from 'pixeltone.js';
const pixeltone = new Pixeltone();
pixeltone.createAudioFromImage({ inputImagePath: 'input.png', outputAudioPath: 'output.wav' });

Example Result

Example result of the image down below.


Link to Soundcloud

License

Copyright (c) 2024 Mehmet Ergin Turk

Licensed under the MIT license. See the LICENSE file for details.

(Twitter/x: @papa_alpha_papa),

(Mastodon: @papa_alpha_papa)

(Bluesky: @erginturk.bsky.social)


🌟 Love PixeltoneJS? Contribute, leave feedback, or star our GitHub repo to show your support! 🎶🎨

📣 Join the conversation in our Discord channel and connect with the community! 🎶🎨

Keywords

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc