Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@jiaminghi/audio-fft
Advanced tools
插件将传入的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
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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.