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

apple-loops-meta-reader

v0.0.2

Published

Apple Loops(.caf) meta information reader for node.js

Downloads

2

Readme

apple-loops-meta-reader

Apple Loops(*.caf) metadata reader for node.js.

Build

    npm install
    gulp

Test

    gulp test

Usage

synchronous read operation

var reader = require('apple-loops-meta-reader'),
    beautify = require('js-beautify');

var data = reader.read('Behold Brass & Wind 03.caf');
console.log(beautify(JSON.stringify(data), { indent_size: 2 }));

asynchronous read operation

var reader = require('apple-loops-meta-reader'),
    beautify = require('js-beautify');

reader.open('Behold Brass & Wind 03.caf')
    .on('data', function(data){
        console.log(beautify(JSON.stringify(data), { indent_size: 2 }));
    })
    .on('error', function(error){
        console.error(error);
    });

gulp task

path        = require 'path'
gulp        = require 'gulp'
data        = require 'gulp-data'
exec        = require 'gulp-exec'
appleLoops  = require 'apple-loops-meta-reader'

gulp.task 'default', ->
  gulp.src ["#{$.appleLoopsDir}/**/*.caf"]
    .pipe data (file) ->
      data =  appleLoops.read (file.path)

      # categolize using folder
      folder = $.distDir
      if data.meta.genre
        folder += "/#{data.meta.genre.replace('/',' ')}"
      else
        folder += '/unknown'
      if data.meta.category
        folder += "/#{data.meta.category.replace('/',' ')}"
      if data.meta.subcategory
        folder += "/#{data.meta.subcategory.replace('/',' ')}"
      data.m4aFolder = folder

      # add bpm and key to filename
      name = path.basename file.path, '.caf'
      if data.meta.tempo
        name += " #{data.meta.tempo}bpm"
      if data.meta.keySignature
        name += " #{data.meta.keySignature}"
      if data.meta.keyType
        name += " #{data.meta.keyType}"
      name += '.m4a'
      data.m4aFilePath = folder + '/' + name
      data
    .pipe exec [
      'mkdir -p "<%= file.data.m4aFolder %>"'
      'afconvert -v -f m4af -d 0 "<%= file.path %>" "<%= file.data.m4aFilePath %>"'
      ].join ' && '
    , $.exec.opts
    .pipe exec.reporter $.exec.reportOpts

example output

{
  "fileType": "caff",
  "fileVersion": 1,
  "fileFlags": 0,
  "audioFormat": {
    "sampleRate": 44100,
    "formatId": "aac ",
    "formatFlags": 0,
    "bytesPerPacket": 0,
    "framesPerPacket": 1024,
    "channelsPerFrames": 2,
    "bitsPerChannel": 0
  },
  "packetTableHeader": {
    "numberPackets": 347,
    "numberValidFrames": 352800,
    "primingFrames": 2112,
    "remainderFrames": 416
  },
  "meta": {
    "beatCount": 8,
    "keySignature": "C#",
    "keyType": "major",
    "timeSignature": "4/4",
    "category": "Horn/Wind",
    "genre": "Orchestral",
    "descriptors": ["Ensemble", "Part", "Acoustic", "Dry", "Clean", "Cheerful", "Relaxed", "Grooving", "Melodic"],
    "tempo": 60
  },
  "information": {
    "copyright": "2004 PowerFX Systems AB",
    "artist": "EgoWorks"
  },
  "transients": {
    "unknown": "00000000000100000000000000000000",
    "markers": [{
      "unknown": 65536,
      "framePosition": 0
    }, {
      "unknown": 65536,
      "framePosition": 20805
    }, {
      "unknown": 65536,
      "framePosition": 40780
    }, {
      "unknown": 65536,
      "framePosition": 61585
    }, {
      "unknown": 65536,
      "framePosition": 176400
    }, {
      "unknown": 65536,
      "framePosition": 192775
    }, {
      "unknown": 65536,
      "framePosition": 212674
    }, {
      "unknown": 65536,
      "framePosition": 235495
    }, {
      "unknown": 65536,
      "framePosition": 352800
    }]
  }
}