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

brgndy-react-wave-form

v1.1.2

Published

react audio waveform library like soundcloud

Downloads

397

Readme

brgndy-react-wave-form

react audio waveform library like soundcloud

화면 기록 2024-04-10 오후 10 42 04

- install

npm install brgndy-react-wave-form

- Usage

import {
  AudioWaveForm,
  AudioWaveFormWrapper,
  PlayOrPauseButton,
} from "brgndy-react-wave-form";
import { buttonClass, waveFormClass, waveFormContainer, icon } from "./App.css";
import { ReactComponent as PlayIcon } from "../src/assets/play.svg";
import { ReactComponent as PauseIcon } from "../src/assets/pause.svg";

const mockMusicData = [
  {
    id: 1,
    src: "/music1.mp3",
  },
  {
    id: 2,
    src: "/music2.mp3",
  },
  {
    id: 3,
    src: "/music3.mp3",
  },
];

function App() {
  return (
    <>
      <AudioWaveFormWrapper>
        {musicData.map((music) => {
          return (
            <div key={music.id} className={waveFormContainer}>
              <PlayOrPauseButton
                src={music.src}
                className=""
                playOrPauseValues={[
                  <PlayIcon className={icon} />,
                  <PauseIcon className={icon} />,
                ]}
              />
              <AudioWaveForm
                waveFormWidth={800}
                barWidth={3}
                barGap={3}
                barVariability={0.5}
                waveFormClassName={waveFormClass}
                audioFileSrc={music.src}
                backgroundTopColor={"red"}
                backgroundBottomColor={"yellow"}
                barTopColor={"black"}
                barBottomColor={"gray"}
              />
            </div>
          );
        })}
      </AudioWaveFormWrapper>
    </>
  );
}

export default App;

AudioWaveForm Component Props

| Name | Datatype | Default | Description | | --------------------- | -------- | ------------------------ | -------------------------------------------------------------------------- | | audioFileSrc | string | "" | URL of the music file you want to convert to WaveForm | | waveFormClassName | string | "" | className you want to apply that canvas component. | | waveFormWidth | number | 500 | The basic width of the canvas you want to convert. default minimum is 500 | | waveFromHeight | number | 200 | The basic height of the canvas you want to convert. default minimum is 200 | | barWidth | number | 3 | Area of ​​the waveform bar you want to convert. default minimum is 3 | | barGap | number | 3 | gap between waveform bars. default minimum is 3 | | baseBarHeight | number | 0.2 | Bar height of basic waveform. default minimum is 0.2 | | barVariability | number | 0.6 | Change in height between waveform bars. default minimum is 0.6 | | backgroundTopColor | string | "rgb(92, 92, 92)" | Top of the default background color that has not been played yet | | backgroundBottomColor | string | "rgba(0, 128, 255, 0.7)" | The part below the default background color that has not yet been played. | | barTopColor | string | "rgb(0, 128, 255)" | The color of the top part when the song is played | | barBottomColor | string | "rgba(92, 92, 92, 0.7)" | The color of the bottom part when the song is played |

PlayOrPause Button Component Props

| Name | Datatype | Default | Description | | ----------------- | ------------------------------------------------------ | ----------------- | -------------------------------------------------------------------------------------------------------------- | | audioFileSrc | string | "" | src of the music you want to play | | className | string | "" | className you want to apply that component. | | playOrPauseValues | [string, string] or [React.ReactNode, React.ReactNode] | ["play", "pause"] | Contents to be included in the play and pause buttons, index 0 is related to play, index 1 is related to pause |

Pitfalls

If you want to insert content into a button as SVG, use a conversion tool like svgr to convert it into a component!

Author

License

MIT