Tutorial and Walkthrough

This following is a quick tutorial showing some basic features of the Sattern JavaScript API. We'll cover the basics like creating a new project, get familiar with some of the objects and functions that are available inside Sattern and build a simple Arpeggiator program.

If you haven't already installed Sattern, head over to the Installation section. Upon successful installation, launch Sattern from the applications folder.

Sattern User Interface

Let's begin by creating a new project called "Arpeggiator" by clicking the (1) "Create New Project" icon. To keep things tidy, create a new folder called "Arpeggiator" and save "Arpeggiator.satternproj" there.

New Project macOS Panel

Now create a new JavaScript file by right clicking anywhere inside the (8) "File Explorer" area and name it "main.js".

New File macOS Panel

You will notice that the newly created JavaScript file has a ✅ next to it. This means that this file is the "Main" executable file for this project. The "Main" executable file is the file that gets loaded and parsed by the JavaScript engine.

You can change which file is the "Main" executable file by right clicking on the file and checking or un-checking the "Main" menu item. Sattern requires at least one "Main" executable file and this is why the first JavaScript file that's created is set to be the "Main" executable file.

Selecting "main.js" file inside the (8) "File Explorer" will open the (7) "Code Editor" and make it available for editing. You will see an empty JavaScript file that looks something like this.

// main.js
// Arpeggiator
// Created by Jacob Sologub on 23 Jul 2020.
// Copyright © 2020 Jacob Sologub. All rights reserved.

The first 7 lines are auto-generated by Sattern and will include the file name, project name and a simple copyright notice that includes your name with the current date. You can delete these lines if you want, but it's a good practice to have a "header" section like this in all of your source files.

You can use any external code/text editor to edit this file and Sattern will pick up any changes made to the file externally. To quickly open the file in your preferred external editor, right click the file and choose the "Open in external editor" menu item. This will launch an editor that's setup to be the default editor for this file type on your system.