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

gulp-nks-replace-mapping

v0.0.9

Published

Gulp plugin for replacing mapping chunk of NKSF file.

Downloads

48

Readme

gulp-nks-replace-mapping

Gulp plugin for replacing the mapping chunk of NKSF file.

Installation

  npm install gulp-nks-replace-mapping --save-dev

Usage

print mapping.

const replace = require('gulp-nks-replace-mapping'),
      { src, dest } = require('gulp'),
      beautify = require('js-beautify')

function printMapping() {
  return src('src/**/*.nksf')
    .pipe(replace((file, mapping) => {
      console.log(beautify(JSON.stringify(mapping), { indent_size: 2 }))
      return undefined
    }))
}

use exists template .nksf file as mapping

const replace = require('gulp-nks-replace-mapping')
      { src, dest } = require('gulp')

function replaceMapping() {
  return src('src/Spier/**/*.nksf')
    .pipe(replace('Spire template.nksf', { type: 'NKSF' }))
    .pipe(dest('dist/Spire'))
}

edit original mapping

const replace = require('gulp-nks-replace-mapping')
      { src, dest } = require('gulp')

function swapPage1and2() {
  return src('src/**/*.nksf')
    .pipe(replace((file, mapping) => {
      const page1 = mapping.ni8[0]
      const page2 = mapping.ni8[1]
      mapping.ni8[0] = page2
      mapping.ni8[1] = page1
      return mapping
    }, { type: 'OBJECT' }))
    .pipe(dest('dist'))
}

API

replace(data [,options])

options [optional]

Type: Object Defalut: {type: 'NKSF'}

options.type [optional]

Type: String, Default: 'NKSF'

'NKSF'

The data arg should specify NKSF file path or function to provide NKSF file path.

'JSON'

The data arg should specify JSON file path or function to provide JSON file path.

'OBJECT'

The data arg should specify mapping object or function to provide mapping object.

data

Type: String or Object or function(file, mapping [,callback])

The replacement source file path or mapping object or function.

function (file, mapping [,callbak])

The function to provide file path or mapping object.

file

Type: vinyl file

mapping

Type: Object

The mapping object of source file.

callback

Type: function(err, data)

The callback function to support non-blocking function.

example mapping of .nksf

{
  "ni8": [
    [{
      "autoname": false,
      "id": 0,
      "name": "Level",
      "section": "Master",
      "vflag": false
    }, {
      "autoname": false,
      "id": 1,
      "name": "Tune",
      "vflag": false
    }, {
      "autoname": false,
      "id": 18,
      "name": "VCF Freq",
      "section": "Param",
      "vflag": false
    }, {
      "autoname": false,
      "id": 19,
      "name": "VCF Resonance",
      "vflag": false
    }, {
      "autoname": false,
      "id": 20,
      "name": "Lfo Speed",
      "vflag": false
    }, {
      "autoname": false,
      "id": 21,
      "name": "Vibrato Depth",
      "vflag": false
    }, {
      "autoname": false,
      "id": 22,
      "name": "VCF FM2",
      "vflag": false
    }, {
      "autoname": false,
      "id": 23,
      "name": "Env1 Decay",
      "vflag": false
    }],
    [{
      "autoname": false,
      "id": 24,
      "name": "Left Reverb",
      "section": "Param",
      "vflag": false
    }, {
      "autoname": false,
      "id": 25,
      "name": "Right Reverb",
      "vflag": false
    }, {
      "autoname": false,
      "id": 26,
      "name": "Chorus Dry/Wet",
      "section": "FX",
      "vflag": false
    }, {
      "autoname": false,
      "id": 27,
      "name": "Delay Dry/Wet",
      "vflag": false
    }, {
      "autoname": false,
      "id": 28,
      "name": "Env2 Attack",
      "section": "Env",
      "vflag": false
    }, {
      "autoname": false,
      "id": 29,
      "name": "Width Osc1",
      "vflag": false
    }, {
      "autoname": false,
      "id": 30,
      "name": "Audio2 Vca",
      "vflag": false
    }, {
      "autoname": false,
      "id": 31,
      "name": "Env2 Release",
      "vflag": false
    }],
    [{
      "autoname": false,
      "id": 32,
      "name": "Env1 Attack",
      "section": "Env",
      "vflag": false
    }, {
      "autoname": false,
      "id": 33,
      "name": "Env1 Decay",
      "vflag": false
    }, {
      "autoname": false,
      "id": 34,
      "name": "Env1 Sustain",
      "vflag": false
    }, {
      "autoname": false,
      "id": 35,
      "name": "Env1 Release",
      "vflag": false
    }, {
      "autoname": true,
      "vflag": false
    }, {
      "autoname": true,
      "vflag": false
    }, {
      "autoname": true,
      "vflag": false
    }, {
      "autoname": true,
      "vflag": false
    }]
  ]
}