npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kiddio

v1.0.6

Published

Author: hanguangtian Date: 2019/04/23

Readme

音频基础工具库

Author: hanguangtian Date: 2019/04/23

一、参数:

option = {
    url: 'http://xxxx.com/xxx.mp3' // 必填项,音频地址
    container: node           // 必填项,容器的selector或者node
    axisHeight: number        // 选填,频谱图区域高度,默认值 250
    axisXHeight: number       // 选填,x轴区域高度,默认值 30
    coordinatesColor: color   // 选填,频谱图区域(坐标系)背景色,默认值 #000
    frequencyColor: color     // 选填,频谱颜色,默认值 #56dda2
    axisXColor: color         // 选填,坐标系X轴背景色,默认值 #424242
    maxScale: number          // 选填,最大放大倍数,默认值 10
    perSeconds: number        // 选填,每屏显示秒数,默认值 10
}

二、例子:

1.基础:

let kedAudio = new KedAudio({
    url: '',
    container: this.$refs[ 'audioContainer' ]
});

2.选填:

let kedAudio = new KedAudio({
    url: '',
    container: this.$refs[ 'audioContainer' ],
    axisHeight: 350,
    axisXHeight: 30,
    coordinatesColor: '#000',
    frequencyColor: '#56dda2',
    axisXColor: '#424242’,
    maxScale: 10,
    perSeconds: 10
});

三、方法:

###1.play(): 播放功能 ###2.stop(): 停止播放 ###3.enableDraw(): 允许绘制标注框 ###4.disableDraw(): 禁止绘制标注框

参数:

when 延迟播放时间,单位为秒(非必填,默认值为0)

offset 定位音频到第几秒开始播放

duration 从开始播放结束时长,当经过设置秒数后自动结束音频播放

例子:

四、属性

1.url :// 音频地址。

2.container: // 容器标签

3.axisHeight: // 坐标系高度

4.axisXHeight: // 坐标系X轴高度

5.coordinatesColor: // 坐标系背景色

6.frequencyColor: // 频谱颜色

7.axisXColor: // 坐标系X轴的背景色

8.maxScale: // 最大放大倍数

9.minScale: // 最小缩小倍数

10.perScale: // 每次缩放的倍数

11.context: // 音频文件上下文环境

12.buffer: // 音频数据

13.containerWidth: // 容器的宽度

14.containerHeight: // 容器的高度

15.scale: // 放大倍数

16.duration: // 音频时长

17.playLine: // 播放线

五、事件

添加事件方式,引入event组件。

Event.add(type, cb); // 添加事件

Event.fire(type, param); // 触发事件

1.audioLoad:音频加载完毕事件。

Event.add('audioLoad', cb);

2.audioDrawn: 频谱绘制完毕事件。

Event.add('audioDrawn', cb);