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

lfo-for-modv

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lfo-for-modv

LFOs in JavaScript

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

LFO JS

This project is a little and simple JavaScript library that will implement LFOs in JavaScript.

What is an LFO

LFO stands for Low Frequency Oscillator. It's basically just a device which oscillates between two values on a certain frequency and following a given waveform.

Note: In this library, there is no limitation concerning the frequency, but it can behave strangely at a high frequency

How to use it

Instantiation

First of all, include the LFO script before your other scripts.

<script src="LFO.js"></script>

To create an LFO, you just have to create a new instace of LFO :

var my_lfo = new LFO ();

The LFO function take an object as argument, containing these parameters :

  • freq : the frequency of the oscillator
  • amplitude : the amplitude of the oscillator
  • waveform : the custom waveform function. This function take a number between 0 and 2PI as argument and must return a number between 0 and 1.

Example :

var my_lfo = new LFO ({
	freq: 1.3,
	amplitude: 2,
	waveform: function (x) {
		if (x <= Math.PI) {
			return -1;
		} else {
			return 1;
		}
	}
	//Same as :
	//waveform: "square"
});

This code will create a new LFO with a frequency of 1.3Hz, an amplitude of 2 and which will produce a square signal.

Note: Every parameter is optional

Waveform functions

There are some waveform functions that are preset in the library : sine (default value), triangle, square, sawtooth and noise.

Getting the current value

To retrieve the current value of an LFO, just use the value function :

var v = my_lfo.value();
Changing parameters

To change parameters of an LFO, use the set function which takes the same argument as the constructor of the class :

my_lfo.set({
	freq: 0.7
});

TODO

  • Clean up the code
  • Make an ES6 module (that's going to be fun)

Keywords

FAQs

Package last updated on 17 Jul 2017

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