1.1.1 • Published 2 years ago

song-viz v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

propertydescriptiontypedefaultisRequired
audioRefRef of the audio player which is made with useRef hookuseRef object-true
centerImageSrcImport name of the image that will be placed in the circleimage-false
rotationControls whether the center image will rotate or notbooleantruefalse
bounceMultiplierControls the how much the circle will bouncenumber1false
barsNumber of bars that will appear on the circlenumber200false
barWidthWidth of the barnumber4false
barHeightMultiplierControls the height of the barsnumber1false
barColorThe color of the bars that will visualize the frequenciesobject{ hslColor: [2, 100, 50] }false
circlePropsProps of the circle on which the bars will appearobject{ circleWidth: 4, circleColor: 'black' }false
centerColorColor of the circle if no image is providedstring (color)'white'false
canvasBackgroundBackground color behind the visualizerstring (color)'white'false
baseRadiusValueMinimum radius of the center circlenumber150false
fftSizeValueMust be a power of 2 between 2^5 and 2^15.number512false
smoothingTimeConstantSmoothness of the bar visualization.number (0-1)0.8false
canvasWidthWidth of the canvasnumber1200false
canvasHeightHeight of the canvasnumber1000false

License

MIT © d-e-v-esh

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago