Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@jiaminghi/audio-fft
Advanced tools
Readme
插件将传入的audio实例作为音频来源进行快速傅里叶变换得到实时频谱数据,使用Canvas将其绘出,支持多种频谱模式,可以动态切换audio实例,支持渐变色。
$ npm install @jiaminghi/audio-fft
import AudioFFT from '@jiaminghi/audio-fft'
const canvas = document.getElementById('canvas')
const audio = document.getElementById('audio')
const fft = new AudioFFT(canvas, {
// some config...
})
fft.setAudio(audio)
fft.draw()
Demo演示效果请移步Demo
/**
* @description Class AudioFft
* @param {Object} canvas Canvas 实例
* @param {Object} config 配置项
* @return {AudioFft} AudioFft实例
*/
export default class AudioFft {
//...
}
/**
* @description Analyser fast fourier transform
* @type {Number}
* @default analyserFFT = 2048
*/
/**
* @description 弹簧模式
* @type {Boolean}
* @default spring = false
*/
/**
* @description 波浪模式
* @type {Boolean}
* @default wave = false
*/
/**
* @description 对称模式
* @type {Boolean}
* @default symmetry = false
*/
/**
* @description 是否显示拨片(非弹簧模式下有效)
* @type {Boolean}
* @default pick = true
*/
/**
* @description 是否启用颜色渐变
* @type {Boolean}
* @default colorTransition = false
*/
/**
* @description 频谱颜色
* @type {Array<String>}
* @default colors = ['#6ed4d3', '#f5738f', '#4bb7e4']
* @example colors = ['red', '#6ed4d3', 'rgb(100, 100, 100)', 'rgba(100, 100, 100, 1)']
*/
/**
* @description 颜色透明度
* @type {Number}
* @default opacity = 1
*/
/**
* @description 颜色渐变过程帧数
* @type {Number}
* @default transitionFrame = 300
*/
/**
* @description 柱间间隙
* @type {Number}
* @default columnGap = 5
*/
/**
* @description 柱宽度
* @type {Number}
* @default columnWidth = 10
*/
/**
* @description 频谱高度缩放比例
* @type {Number}
* @default swingScale = 1
*/
Tip
colors
数组长度为1时,频谱单色绘制,长度大于1时,自动应用渐变色,启用colorTransition
则会产生不一样的效果。
/**
* @description 设置audio实例
* @param audio Audio实例
* @return {Undefined} Void
*/
AudioFFT.prototype.setAudio = function (audio) {
// ...
}
/**
* @description 开始绘制
* @return {Undefined} Void
*/
AudioFFT.prototype.draw = function () {
// ...
}
/**
* @description 停止绘制
* @return {Undefined} Void
*/
AudioFFT.prototype.stop = function () {
// ...
}
/**
* @description 更新配置项
* @return {Undefined} Void
*/
AudioFFT.prototype.updateConfig = function (config = {}) {
// ...
}
/**
* @description 清除Canvas
* @return {Undefined} Void
*/
AudioFFT.prototype.clear = function () {
// ...
}
FAQs
Audio frequency
The npm package @jiaminghi/audio-fft receives a total of 1 weekly downloads. As such, @jiaminghi/audio-fft popularity was classified as not popular.
We found that @jiaminghi/audio-fft demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.