promises, promises

June 13, 2015

OMG - I think I am grokking it!!! Very useful articles http://www.2ality.com/2014/10/es6-promises-api.html https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise http://www.html5rocks.com/en/tutorials/es6/promises/

Ok, I did a simple little example. In this example, I am going to read in the contents of a file using async fs.readfile.

coffee fs = require 'fs' {Promise} = require 'es6-promise'

Ok, so we are using the es6-promise module - we need to import Promise (which we are doing with destructured assignement).

coffee myReadFile = (file) -> new Promise (resolve, reject) -> fs.readFile file, (err, data) -> if data? resolve data.toString() else reject err

Create a function with a new Promise object. The object returns two methods to use - resolve (call with data) and reject (call with an error). To passback data, call resolve data. Similarly, for errors, reject err.

To run the function once…

coffee myReadFile 'test.txt' .then (response) -> console.log response .catch (err) -> console.log err

The Promise.then method will be called when fs.readFile calls resolve method (with data as a parameter) and the Promise.catch method is invoked when reject is called (with err as a paramter).

Let’s extend this example to a list of files where the Promise.all method will run when all of the Promises are completed.

```coffee files2 = [‘test.txt’, ‘test2.txt’, ‘test3.txt’] allresponses = files.map myReadFile

Promise.all(allresponses) .then (response) -> console.log response .catch (err) -> console.log err ```

In this case, the Promise.all method is called when all of the Promise objects have been resovled.

Ok, let’s chain some functions together.

coffee myReadFile 'test.txt' .then (response) -> console.log 'single run test with chainables' console.log response # return response print response # call print function .then (response) -> console.log response jump response # call jump function .then (response) -> console.log response .catch (err) -> console.log err

This is the most simple promise

```coffee theMostSimplePromise = (phrase) -> new Promise (resolve) -> resolve phrase

theMostSimplePromise(‘print this’) .then (response) -> console.log response ```

when you create a new Promise, the constructor returns two functions, resolve and reject. The object exposes several methods to call, .then, .catch, .all, .race.

Read More

Hot Keys

May 30, 2015

image

I like to keep my hands on the keyboard. To that end, I have a bunch of shortcuts for quick navigation. There are lots of apps to create hotkeys - Keyboard Maestro, Alfred, BetterTouchTool, etc (those three are a part of my franken’mation (better than rube’n’mation)). In my setup, Seil is key (no pun). Seil lets you remap any key to another key. There are three keys that I never/rarely use caps lock, opt(left) and cmd(left). Remapping these specific keys in new hot keys means less chance of tromping over some already defined system or app specific hot key.

Read More

CornerClick

May 30, 2015

image

The corners are a fantastic trigger. Unfortunately, the “Hot Corners” option in Prefreneces is constrained to a handful of predefined actions. Enter CornerClick which allows you to take total control over your corners. The developer opensourced it in 2010, and it doesn’t look like any development has occured since then. That said, I am using it in Yosemite and it is working for me. I set the trigger to Hover which works well.

Read More

Blog design with jekyll

May 30, 2015

It is really easy to try out a new “theme” for your jekyll blog. In a nutshell…

  1. Copy your jekyll blog to a new directory
  2. Symlink your existing _posts folder to the new directory (this will allow you to build with all of your existing content)
  3. In the new directory, edit configuration to your heart’s content
  4. jekyll s and check it out
Read More

Maschine - custom graphics for plugins and sound libraries

May 27, 2015

image

By default, 3rd party plugins all share a boring graphic that does not provide any visual cue to tell them apart. But, that can be changed!

High level steps

  1. In the Maschine software, load up a 3rd party plugin, right-click and “Save As” to the User Library (more on this). This applies to both Instruments and Effects.
  2. Now, when browsing image the User section, the plugin will show up, as well as the developer (with boring graphic)
  3. Create a directory with the developer’s name (exactly as it is displayed in Browse) in /Users/Shared/NI Resources/image
    [e.g. /Users/Shared/NI Resources/image/Camel Audio]
  4. Copy the contents of another directory in /image to the new directory to use as a template (or use this template)
  5. Change the prefix of the file ending in .meta to match the directory name [e.g. Camel Audio.meta]. The contents of the directory should resemble this (again with Camel Audio as an example developer)
    image
  6. Replace the contents of each .png file with new custom graphics
  7. Start (or restart) Maschine
Read More

Maschine - a better way to browse plugins

May 27, 2015

Plugin sanity!

If you have a lot of 3rd party plugins, for the sake of sanity, “organize” them in the User section. With a lot of plugins, the dropdown in the software can be monstrously long/unwieldy (especially if you haven’t pruned it). You can access them on the controller by blah blah.

In a nutshell

  • Load up a 3rd party plugin
  • In the software, right click on the plugin and select Save As. Idea: save it with an _ in front of the name (e.g. _LFO Tool). The underscore signifies that the plugin’s parameters are in a default state (and this will sort the name to the top of the list).
  • Now, Browse with User selected to see a list of plugin vendors on the left screen (which can be used to hone in a specific vendor)
Read More

Managing Plugins

May 27, 2015

[insert a graphic here - maybe of a folder with shortcuts to the actual directories]

Getting organized

Plugins can seem mystical - they just show up in your various apps, some as VST, some as AU (mac) or AAX (Pro Tools). In the end, they are just files that can be moved, deleted and managed. Here are the paths (mac specific) and file extensions for each type.

  • VST /Library/Audio/Plug-Ins/VST, extension .vst
  • VST3 /Library/Audio/Plug-Ins/VST3, extension .vst3`
  • Audio Unit /Library/Audio/Plug-Ins/Components, extension .component
  • AAX /Library/Application Support/Avid/Audio/Plug-Ins, extension .aax

To really take control of your plugins, you will want to get your hands dirty. Create a “shortcut” directory with symbolic links for quick access (you can use this zipped folder).

Read More