Coder Social home page Coder Social logo

pharo-synthstromdeluge's Introduction

Synthstrom Deluge in Pharo

Aims to support creation of objects that represent Synthstrom's Deluge instruments.

Installing

Metacello new 
  baseline: 'SynthstromDeluge'; 
  repository: 'github://grype/Pharo-SynthstromDeluge'; 
  load.

Summary

It is possible to read and write Deluge's XML files, though only Kits are supported at the moment. Most of the code was generated, so it's possible to create additional structs, like synths and songs. This isn't too straight-forward, so see notes on Generating source code.

It isn't exactly clear how to create the right components of an instrument - i.e. Which DefaultParams to use, whicih default values to use, etc. So, it's always best to start with something that the device had created.

A note on class structure and naming:

All Deluge objects are subclasses of DelugeObject. Classes that represent files are suffixed with Container. So, you will have DelugeKitContainer represent contents of a e.g. KIT0001.XML, one of the children of that container will be the actual DelugeKit object.

Working with files

kit := DelugeSynthContainer fromFile: '/Volumes/NO NAME/KITS/MYKIT.XML' asFileReference.
...
kit toFile: '/Volumes/NO NAME/KITS/MYKIT 2.XML' asFileReference.

Creating kits from AKAI PGM files

Be sure to load the 'Akai' configuration:

Metacello new 
  baseline: 'SynthstromDeluge'; 
  repository: 'github://grype/Pharo-SynthstromDeluge'; 
  load: 'Akai'.

Then,

pgm := '/path/to/AKAI/ALIEN_DRUMS/ALIEN_DRUMS1.PGM' asFile.
kit := DelugeKitContainer fromAkaiProgramFile: pgm.
kit exportTo: '/Volumes/NO NAME/KITS' copyingSamplesFrom: pgm parent.

Note: the above assumes that samples and PGM files all live in the same directory. If that's not the case - adjust the argument to copyingSampleFrom:...

Generating source code

The source code represents the XML structure, in which Deluge stores instrument descriptions. For the most part, the source code was generated, making small additions here and there wherever object construction had to be tweaked (which is mostly in the intialize methods).

To (re-)generate the source code you need an XML file from which to model classes. Then,

file := '/Volumes/NO NAME/KITS/KIT0001.XML' asFileReference.
DelugeObject generateClassesFromFile: file containerNodeName: DelugeKitContainer xmlElementName.

If you're generating a new type of object, say a synth:

DelugeObject generateClassesFromFile: files first containerNodeName: 'synthContainer'.

Notice that the containerNodeName argument will determine the class name - we're not actually looking for a tag with that name.

The above snippet will essentially read the XML file, create classes for XML tags (i.e. translates to DelugeKit), capturing its properties and children, and create necessary magritte description methods to facilitate serialization.

It is also possible to scan those XML files for string values and capture them into configuring methods:

objects := fileReferences collect: [ :each | 
	DelugeObject generateClassesFromFile: each containerNodeName: 'kitContainer'.
	(Smalltalk at: #DelugeKitContainer) fromFile: each.
	].
DelugeObject generateConstantsAccessorsFromReferences: (objects flatCollect: #allReferencedConstants).

That will prompt to create various methods that configure properties of an object using found strings - i.e. `beLpfMode24dB'...

Note XML structure varries b/w instruments (kits, synths, songs) - Some finessing will be required when generating new classes. Be sure not to break existing class definitions, methods, especially those with magritte descriptions. In fact, when introducing a new model, it may require tweaking the magritte description files and initialization methods for some classes. In the latter case, follow DelugeKit>>#initialize. It's always best to leave classes that represent inner nodes w/o customized initialization, and configure their instances from the initialization of parent of container node's class (i.e. DelugeKit>>#initialize creates and configures DelugeDefaultParams instance.

pharo-synthstromdeluge's People

Contributors

grype avatar

Watchers

 avatar  avatar  avatar  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.