Skip to content

ptigas/syro.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

syro.js

This is a javascript library for Korg Volca Sample, which uses SYRO SDK. You can play with it on https://hisschemoller.github.io/volca-freesound/ (thanks to https://github.com/hisschemoller/ for building this amazing tool on top of syro.js).

Read about the sdk here https://github.com/korginc/volcasample.

Projects using syro.js

https://github.com/hisschemoller/volca-freesound

Usage

Include Recorderjs and build\syro.js to your project. You can apply the functions below on an audio context to download a syro song for your volca sample.

function serializeData(audio, file)
{
  bufferToWav(audio, function(blob) {
    Syrialize(blob, function(a) {
      Recorder.forceDownload(a, 'syro.wav');
    });
  });  
}

where bufferToWav is a little helper

function bufferToWav(buffer, callback)
{
  var worker = new Worker('[path to Recorderjs]/recorderWorker.js');

  // initialize the new worker
  worker.postMessage({
    command: 'init',
    config: {sampleRate: 44100}
  });

  // callback for `exportWAV`
  worker.onmessage = function( e ) {
    blob = e.data;
    callback(blob);
    // this is would be your WAV blob
  };

  // send the channel data from our buffer to the worker
  worker.postMessage({
    command: 'record',
    buffer: [
      buffer.getChannelData(0),
      buffer.getChannelData(buffer.numberOfChannels-1)
    ]
  });

  // ask the worker for a WAV
  worker.postMessage({
    command: 'exportWAV',
    type: 'audio/wav'
  });
}

Build

First install emscripten.

Then, run make to build the minified js file. It should appear in build folder.

About

Javascript version of Korg's SYRO SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published