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

wav-file-info

v0.0.10

Published

Lightweight Node.js WAV file info helper

Downloads

17,819

Readme

WAV File Info for Node.JS

A lightweight module that parses WAV information data from a wav file into a Javascript Object. Basically retrieves file and header meta data information from a WAV file.

Used for:

  • Determining the validity of a .wav file
  • Detecting the bit depth / bit rate / bits per sample of a .wav file
  • Detecting the Sample Rate of a .wav file
  • Detecting the number of channels in a .wav file
  • Retrieving the file information, including file size, created date etc

Usage

npm install wav-file-info --save
var wavFileInfo = require('wav-file-info');

wavFileInfo.infoByFilename('./test.wav', function(err, info){
  if (err) throw err;
  console.log(info);
});

if err is not null, the WAV file is valid.

From the command line you can run:

node wfi.js <filename>

Result

{ header:
   { riff_head: 'RIFF',
     chunk_size: 1697504,
     wave_identifier: 'WAVE',
     fmt_identifier: 'fmt ',
     subchunk_size: 16,
     audio_format: 1,
     num_channels: 2,
     sample_rate: 44100,
     byte_rate: 45328,
     block_align: 4,
     bits_per_sample: 16,
     data_identifier: 'PAD ' },
  stats:
   { dev: 16777220,
     mode: 33184,
     nlink: 1,
     uid: 501,
     gid: 20,
     rdev: 0,
     blksize: 4096,
     ino: 71128242,
     size: 1697512,
     blocks: 3320,
     atime: Sun Nov 29 2015 10:13:15 GMT-0700 (MST),
     mtime: Sat May 23 2015 12:45:00 GMT-0600 (MDT),
     ctime: Thu Nov 12 2015 14:31:37 GMT-0700 (MST),
     birthtime: Sat May 23 2015 12:44:55 GMT-0600 (MDT)
  },
  duration: 9.623038548752834
}

Example errors

{ error: true,
  invalid_reasons:
   [ 'Expected "RIFF" string at 0',
     'Expected "WAVE" string at 4',
     'Expected "fmt " string at 8',
     'Unknwon format: 25711',
     'chunk_size does not match file size' ] }

Duration is in seconds. Stats come from Node raw fs.statSync() result.

References: http://soundfile.sapp.org/doc/WaveFormat/

TODO: Deep scan [avg amplitude, max amplitude], fork for AIFF