tildebyte / ChucK-plugin-for-ST3

A Sublime Text 3 plugin for ChucK (http://chuck.cs.princeton.edu).
19 stars 2 forks source link

This is essentially unmaintained, but issues/PRs are certainly welcomed.

ChucK-plugin-for-ST3

A Sublime Text 3 plugin for ChucK, featuring syntax highlighting, tab completion, snippets (and maybe REPL-ish sessions).

Installation

  1. Open Sublime Text 3.
  2. Go to Preferences/Browse Packages.
  3. Unpack the archive into the Packagers folder which should appear.
  4. Change ChucK path in ChucK.sublime-settings specific to your platform.
  5. Restart Sublime Text 3.

Usage

Currently to get sounds out of Sublime Text 3 + ChucK we've set up a simple build script. If you are new to SublimeText, the menu to look for is located in Tools -> Build System. If automatic is not ticked then tick it, or you can set it manually by selecting ChucK from this list. To hear some sounds:

Features

Summary

Build command

Syntax Highlighting

Syntax definition/coloring of all major language constructs (types, syntax etc). If your code looks OK, this is a good first indication that your syntax is correct. There are a few subtle bugs listed at the end in the bugs section, but they do not impede beyond aesthetics.

Completions

We've included many objects and methods which appear in the ChucK language. This helps you type less and shows correct spelling for the built-in stuff. Very much a work in progress.

Snippets.

Some short, commonly used, syntactical structures (e.g. while loops) can be inserted with only a few keystrokes.

Doc Search

chuck_doc_search.py: searches the ChucK online help for the currently selected word. It takes:

Iternotate

iternotate.py: despite the awkward name, this saves you from typing full for-loops. Enter the shorthand and press the keyboard shortcut and watch it expand.

// i..5
for(0 => int i; i<5; i++){
    i;
}

// i..num_times
for(0 => int i; i<num_times; i++){
    i;
}

// i..iterable[  or  i..iterable[]
for(0 => int i; i<iterable.cap(); i++){
    iterable[i];
}

Wav Writer

default shortcut: "ctrl+shift+w"

Writes the current ChucK file as stereo wav to disk. We use the concept of an inline console to tell chuck_wav_writer.py what to do. An inline console is a specific set of instructions in the form of a comment. For example:

SinOsc d => dac;
20::second => now;  // %> 20:demo_sound

or, add a gain value. Range 0.0 and upwards. The default, when omitted, is 1.0

SinOsc d => dac;
20::second => now;  // %> 20:demo_sound:0.67

If the cursor caret is on the line with the comment using the %> token it will try to parse what is after it. "20" means you want that many seconds, demo_sound is the name of the output stereo wav you will record.

Context Menu additions

TODO

Issue Tracker

The issue tracker is a good place to look if you encounter a bug, or to justify/defend a feature request. It's where we go to discuss ideas and resolve bugs.

Tools > ChucK sub menu:

The menu is implemented but currently it is a stub, so avoid using it for now. There are renovations going on in the code for those menu items. We have no clear timeframe for this todo, it may even happen that the ChucK menu is ditched in favour of the REPL as a console, or inline console comment-commands as implemented in chuck_wav_writer.py.

The list:

Notes

The default keybinds for chuck_doc_search and iternotate conflict with Fold/Unfold.

Known bugs

Probably many, but we are aware of these:

Authors

Thanks

Testing:

[1] CTRL+BREAK doesn't seem to work with all keyboards.