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

song-viz

v1.1.1

Published

> React Song Visualizer

Downloads

58

Readme

song-viz

React Song Visualizer

NPM JavaScript Style Guide

Video Link

Install

npm

npm install song-viz

yarn

yarn add song-viz

Usage

Most of the props in this component have default values so you can get started with just the essential props:

import React, { useRef } from 'react'
import songFile from './songAudio.wav'
import imageFile from './img/imageFile.jpg'
import { RecordDisk } from 'song-viz'

const App = () => {
  const audioRef = useRef()
  return (
    <div>
      <RecordDisk audioRef={audioRef} centerImageSrc={imageFile} />
      <audio src={songFile} controls ref={audioRef} />
    </div>
  )
}

export default App

This component with all the props looks like this:

import React, { useRef } from 'react'
import songFile from './songAudio.wav'
import imageFile from './img/imageFile.jpg'
import { RecordDisk } from 'song-viz'

const App = () => {
  const audioRef = useRef()
  return (
    <div>
      <RecordDisk
        audioRef={audioRef}
        centerImageSrc={imageFile}
        rotation={true}
        bounceMultiplier={0.5}
        bars={200}
        barWidth={4}
        barHeightMultiplier={1}
        barColor={{
          // Either add one/two colors
          colorTwo: 'rgba(255,97,45,255)',
          colorOne: 'rgba(253,235,184,255)',

          // Or Add HSL Values, do not add both
          hslColor: [2, 100, 50]
        }}
        circleProps={{ circleWidth: 12, circleColor: 'black' }}
        centerColor='red'
        canvasBackground='white'
        baseRadiusValue={100}
        fftSizeValue={2048}
        smoothingTimeConstant={0.8}
				canvasWidth = {1200},
  			canvasHeight = {1000}
      />

      <audio src={songFile} controls ref={audioRef} />
    </div>
  )
}

export default App

Props and Default Values

| property | description | type | default | isRequired | | --------------------- | ---------------------------------------------------------- | -------------- | ------------------------------------------ | ---------- | | audioRef | Ref of the audio player which is made with useRef hook | useRef object | - | true | | centerImageSrc | Import name of the image that will be placed in the circle | image | - | false | | rotation | Controls whether the center image will rotate or not | boolean | true | false | | bounceMultiplier | Controls the how much the circle will bounce | number | 1 | false | | bars | Number of bars that will appear on the circle | number | 200 | false | | barWidth | Width of the bar | number | 4 | false | | barHeightMultiplier | Controls the height of the bars | number | 1 | false | | barColor | The color of the bars that will visualize the frequencies | object | { hslColor: [2, 100, 50] } | false | | circleProps | Props of the circle on which the bars will appear | object | { circleWidth: 4, circleColor: 'black' } | false | | centerColor | Color of the circle if no image is provided | string (color) | 'white' | false | | canvasBackground | Background color behind the visualizer | string (color) | 'white' | false | | baseRadiusValue | Minimum radius of the center circle | number | 150 | false | | fftSizeValue | Must be a power of 2 between 2^5 and 2^15. | number | 512 | false | | smoothingTimeConstant | Smoothness of the bar visualization. | number (0-1) | 0.8 | false | | canvasWidth | Width of the canvas | number | 1200 | false | | canvasHeight | Height of the canvas | number | 1000 | false |

License

MIT © d-e-v-esh