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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vudio.js

v1.0.3

Published

仅供娱乐,开心就好

Downloads

25

Readme

vudio.js

一个简单的音频数据可视化模块


概述:

  • 支持诸多样式调整
  • 动画效果基于Canvas和requestAnimationFrame,丝般顺滑
  • 仅供娱乐,开心就好

使用方法

var vudio = new Vudio(HTMLAudioElement/MediaStream, HTMLCanvasElement, [option]);
vudio.dance();

第一个参数用于指定音频源,可以是一个Audio标签,或者一个Audio对象,也可以是通过navigator.mediaDevices.getUserMedia获取到的音频MediaStream对象

第二个参数用于指定显示可视化内容的Canvas,

第三个参数用于指定显示效果的个性化配置

示例

在你的HTML文件中放入canvas和audio标签

<canvas width="256px" height="100px" id="canvas"></canvas>
<audio src="./path/to/audio.mp3" controls id="audio"></audio>

引入Vudio.js

<script src="path/to/vudio.js"></script>

注意,因为浏览器的同源策略,所以跨域情况下无法使用本模块(可在服务端进行控制)

开始搅基

var audioObj = document.querySelector('#audio');
var canvasObj = document.querySelector('#canvas');
var vudio = new Vudio(audioObj, canvasObj, {
    effect : 'waveform', // 当前只有'waveform'这一个效果,哈哈哈
    accuracy : 128, // 精度,实际表现为波形柱的个数,范围16-16348,必须为2的N次方
    width : 256, // canvas宽度,会覆盖canvas标签中定义的宽度
    height : 100, // canvas高度,会覆盖canvas标签中定义的高度
    waveform : {
        maxHeight : 80, // 最大波形高度
        minHeight : 1, // 最小波形高度
        spacing: 1, // 波形间隔
        color : '#f00', // 波形颜色,可以传入数组以生成渐变色
        shadowBlur : 0, // 阴影模糊半径
        shadowColor : '#f00', // 阴影颜色
        fadeSide : true, // 渐隐两端
        horizontalAlign : 'center', // 水平对齐方式,left/center/right
        verticalAlign: 'middle' // 垂直对齐方式 top/middle/bottom
    }
});

// 调用dance方法开始得瑟吧
vudio.dance();

// 也可随时停止得瑟
vudio.pause();

// 中途换个姿势得瑟也是可以的
vudio.setOption({
    waveform : {
        color : '#06f',
        verticalAlign: 'bottom'
    }
});

在线示例: http://margox.github.io/vudio.js/