Huge Collections of Software Manuals and Knowledgebase

GreatManuals.com
Huge Collections of Software Manuals and Knowledgebase

 
Home Contact Us Request to publish your help manuals Request to remove your help manuals
Introduction
» ArtSong
» System Requirement
» What's New
» Upgrading Projects
ArtSong Basics
» Overview
» ArtSong Workspace
» Project Editors
» Control Mechanisms
» How To...
Tutorials
» First ArtSong MIDI
» Orchestration and Performance
» Beginning ArtSong Projects
» Using Component Events
Advanced Topics
» Rhythm and Meter
» Harmony
» Melody and Counterpoint
» Harmonizing Melody
» Accompaniment Patterns
» Arranging
Scripting
» ArtSong Scripting
» Basic Syntax
» Pascal Syntax
» Complex Numbers
» Music Objects Model
» Script Functions
» Script Objects
Scripting Tutorials
» Getting Started with Scripts
» Scripts as Algorithm
» Using Scripts with Composition Engine
» Graphic User Interfaces
ArtSong References
» Glossary
» Algorithms
» Components
» Devices
» Editors
Support Information
» Refer
» Contact Us
 

Getting Started with Scripts

ArtSong scripts are compiled and executed each time the Main Screen ‘Compose’ button or a script-editor ‘Run’ or ‘Debug’ button is clicked. After compiling, the script begins executing the MAIN SECTION of the script, if the section exists.

Script execution continues through the MAIN SECTION. The script ‘stops’ running after the MAIN code section is exited. After exiting the MAIN code section, functions defined in the FUNCTIONS section still remain accessible to the ArtSong Composition.

Example 1 – Creating and running your first script.

This first example takes you through the steps of adding scripts to a new composition project, introduces the project and track scripting objects, and demonstrates how to use the track function: AddNote(StartTime, Duration) to add a new note to a track.

drive recovery application recover data memory card data recovery
digital camera recovery software ipod reset mobile forensic
freeware windows undelete undelete software windows drive restore

Do this…

Set the default project view to ‘Project Editor’ and create a new blank project.

Select the top ‘Composition’ component in the Component Pane and click on either the Pascal or Basic Scripter Algorithm on the ‘General’ Tab of the Algorithms Palette to add an instance of the algorithm to the project.

Select the Algorithm in the Component Pane and open its property editor by right clicking and selecting the ‘Property Editor…’ from the pop-up menu. The algorithm’s Script Editor window should open.

Enter the appropriate following lines in the code window:

(Pascal)

this.clearall();

this.track[1].addnote(0, 240);

this.play(0,480);

(Basic)

this.clearall()

this.track[1].addnote(0, 240)

this.play(0,480)

Click on the code ‘Run’ script tool button (button with green arrow). The script is compiled and executed; you should hear the note played. If you receive an error message please go back and re-check your script.

How it works...

this is the ‘keyword’ referring to the current project.

this.clearall() is a function that creates an ‘undo’ event for the current project and then removes the current note and MIDI events from all the tracks.

this.track[index] refers to the project track at a specified index; the first project track is index = 0; index = 1 refers to the second track.

this.track[1].addnote(0, 240) adds a note to the second track starting at time = 0 and having a duration of 240 ticks.

this.play(0, 480) plays the contents of the ‘composition’ project starting from time = 0 to time = 480 ticks

Example 2 – Generate a sequence of random notes 1

Notes generated in ascending time order

This second example will generate a series of notes having random pitches, durations, and volumes. A new function RandomRange(low, high) is introduced for generating random values within a specified range.

Do this...

Either start a new project as described in Example 1, or starting from a previous example click on the New button at the far left of the script editor tool bar which clears the current script.

Enter the appropriate following script in the code window:

(Pascal)

var note, time, duration, n;

this.clearall();

for n = 0 to 19 do

begin

time = n * EIGHTH_NOTE;

duration := randomrange(1,5) * QUARTER_NOTE;

note := this.track[0].addnote(time, duration);

note.pitch := randomrange(C4, C6);

note.volume := randomrange(20, 110);

end;

this.play(0, 24 * EIGHTH_NOTE);

(Basic)

DIM note, time, duration, n

this.clearall()

FOR n = 0 TO 19

time = n * EIGHTH_NOTE

duration = randomrange(1,5) * QUARTER_NOTE

note = this.track[0].addnote(time, duration)

note.pitch = randomrange(C4, C6)

note.volume = randomrange(20, 110)

NEXT

this.play(0, 24 * EIGHTH_NOTE)

Compile and execute this code by clicking the ‘Run’ button. You should hear a sequence of 20 notes having varying pitches, volumes, and durations

« »

Home | Contact Us | Request to publish your help manuals | Request to remove your help manuals