GithubHelp home page GithubHelp logo

ekystra-a1 / vst-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ramirezd42/vst-js

0.0 1.0 0.0 8.6 MB

native node addon that allows for instantiation of natively installed VST3 audio plugins

CMake 0.01% C++ 66.55% Objective-C++ 3.61% C 21.55% Objective-C 7.82% R 0.06% Java 0.40% JavaScript 0.01%

vst-js's Introduction

What Is It?

vst.js is a native NodeJS addon that can be used to launch VST3 plugins (including GUI interface) in a separate process.

WARNING:

This library is in an extremely experimental state. Large portions of functionally have yet to be implemented and it is currently only buildable for OSX devices, although since everything is built with crossplatform libraries, building for other operating systems shouldn't be too difficult.

Additionally, If you have any criticisms on my approach or code quality I'd love to hear them.


Installation

Install CMake

vst.js uses CMake as its build system and requires it be present on your system before installing. On a Mac the easiest way to install CMake is via homebrew:

> brew install cmake

Install Boost 3.6+

vst.js makes use of the popular Boost C++ Framework. It expects that version 3.6 or higher is available on your system prior to installation. The easiset way to install the Boost framework on a Mac is via homebrew:

> brew install boost

Acquire the Steinberg VST3 SDK (3.6.7+)

Due to licensing concerns I am currently not bundling the VST3 SDK along with this project. You will need to download the SDK from Steinbergs's Website and place it at ~/SDKs/VST3

You can also specify the installed location of the VST3 SDK by setting a the VST3_SDK_PATH environment variable prior to installation

NPM Install

Once all the above dependencies have been satisfied you can install via npm:

> npm install vstjs

Usage Examples

The example below will play back an audio file via node-web-audio-api, and manipulate the audio via a VST3 plugin

const { AudioContext } = require('web-audio-api')
const Speaker = require('speaker')
const fs = require('fs')
const path = require('path')
const vstjs = require('vstjs')

const bufferSize = 512
const numChannels = 2
const pluginPath = process.argv[2]
const filePath = process.argv[3]

const pluginHost = vstjs.launchPlugin(pluginPath)
pluginHost.start()

// setup webaudio stuff
const audioContext = new AudioContext()
const sourceNode = audioContext.createBufferSource()
const scriptNode = audioContext.createScriptProcessor(bufferSize, numChannels, numChannels)


audioContext.outStream = new Speaker({
  channels: audioContext.format.numberOfChannels,
  bitDepth: audioContext.format.bitDepth,
  sampleRate: audioContext.sampleRate,
})

sourceNode.connect(scriptNode)
scriptNode.connect(audioContext.destination)


scriptNode.onaudioprocess = function onaudioprocess(audioProcessingEvent) {
  const inputBuffer = audioProcessingEvent.inputBuffer
  const channels = [...Array(numChannels).keys()]
    .map(i => audioProcessingEvent.inputBuffer.getChannelData(i))

  // process audio block via pluginHost
  pluginHost.processAudioBlock(numChannels, bufferSize, channels)
  audioProcessingEvent.outputBuffer = inputBuffer
}

fs.readFile(filePath, (err, fileBuf) => {
  console.log('reading file..')
  if (err) throw err
  audioContext.decodeAudioData(fileBuf, (audioBuffer) => {
    sourceNode.buffer = audioBuffer
    sourceNode.start(0)
  }, (e) => { throw e })
})

vst-js's People

Contributors

ramirezd42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.