Abstract-Codex | index | works | bio |> memory | network | contact

Tactu5.
A Processing music assistant.


<< back to Tactu5 index

Name:

Note

Example:

import tactu5.*;
import tactu5.Tactu5SimpleSequencer;


// creating an instance of Tactu5
Tactu5 tactu5;

// creating an aggregator instance
Aggregator aggregator;

void setup() {
       
  
       Tactu5Utilities tactu5utilities = new Tactu5Utilities();
  
       // define various frequencies
  
        float freqA = 440.000;
        float freqC = tactu5utilities.noteToFreq ( T5Notes.C, 4 );
        float freqE = tactu5utilities.noteToFreq ( T5Notes.E, 4 );
        float freqG = tactu5utilities.noteToFreq ( T5Notes.G, 3 );

        // declaring some notes
        
        Note noteA = new Note(freqA,200,1,1,100,false);
        Note noteC = new Note(freqC,200,1,1,100,false);
        Note noteE = new Note(freqE,200,1,1,100,false);
        Note noteG = new Note(freqG,200,1,1,100,false);
        
        // declaring a sequence
        
        Sequence sequence = new Sequence();
        
        // add notes to sequence to create an arpeggio
        
        sequence.addNote(noteA);
        sequence.addNote(noteC);
        sequence.addNote(noteE);
        sequence.addNote(noteG);
        
        aggregator = new Aggregator();
        
        //add the sequence to aggregator
        
        aggregator.addSequence(sequence);
        
        // initializing and feed internal sequencer, boolean value inidicate if it will loop
        
        tactu5 = new Tactu5(this,aggregator.getScore(),true);
       
        // start sequencer
        tactu5.start();
  
  
  }
  
void draw() {
    
    // do something
    
}

void noteReceiver(Note n){
  
  // send data to a synth
  
 println(n.getFrequency());
println(n.getDuration());
println(n.getSustain());
println(n.getPan());

} void stop() { // eliminate Tactu5 sequencer tactu5.closeSequencer(); super.stop(); }
Description:

Class Note defines a single sound event.
It's possible to create a new instance of the object passing a variable numbers of parameters.
Though some parameters could seem arbitrary, because Tactu5 does not implement any sound generator, using them in the suggested way allows to utilize properly some advanced methods.

Constructor syntax:

Note(float d, boolean r);
Note(float d, boolean r, String c);
Note(float f, float d):
Note(float f, float d, float p);
Note(float f, float d, float p, boolean r);
Note(float f, float d, float p, float v, float s, boolean r);
Note(float f, float d, float p, float v, float s, boolean r, String c, int ch);


Parameters:

f.................float frequency in hz
d................float duration in milliseconds
s................float sustain in milliseconds
p................float pan (arbitrary value)
v................float velocity (arbitrary value)
ch...............int channel
c................String comment
r................booelan, is a rest?

Usage:

Web and application.

Releated:

Sequence

Methods:

> getChannel()
> getComment()
> getDuration()
> getFrequency()
> getPan()
> getSustain()
> getVelocity()
> invertRest()
> isThisARest()
> setChannel()
> setComment()
> setDuration()
> setFrequency()
> setPan()
> setSustain()
> setVelocity()



Name: getChannel()

Description:

Get the channel number, channel value is arbitray. It means you could get a value and use it to identify a synth, an action or anything else.

Syntax:

note.getChannel();

Return: int


^ up


Name:
getComment()

Description:

Get a comment.

Syntax:

note.getCommentl();

Return: String


^ up


Name: getDuration()

Description:

Get the duration value in milliseconds.

Syntax:

note.getDuration();

Return: float


^ up

Name:
getFrequency()

Description:

Get the frequency value in Hz.

Syntax:

note.getFrequency() ;

Return: float


^ up


Name:
getPan()

Description:

Get the pan value. It's an arbitrary value to define panpotting.

Syntax:

note.getFrequency() ;

Return: float


^ up


Name: getSustain()

Description:

Get the sustain value in milliseconds.

Syntax:

note.getSustain() ;

Return: float


^ up


Name: getVelocity()

Description:

Get the velocity value.

Syntax:

note.getVelocity() ;

Return: float


^ up

Name:
invertRest()

Description:

Invert the boolean value for identify a rest.

Syntax:

note.invertRest() ;

Return: nothing


^ up

Name: isThisARest()

Description:

Return a boolean value, true if the sound value is a rest, false if it is a note.

Syntax:

note.isThisaRest() ;

Return: boolean


^ up

Name: setChannel()

Description:

Set a channel id.

Syntax:

note.setChannel(int ch) ;

Return: nothing


^ up

Name: setComment()

Description:

Write a comment..

Syntax:

note.setComment(String c) ;

Return: nothing


^ up

Name: setDuration()

Description:

Set the duration value of an event in millisecond.

Syntax:

note.setDuration(float d) ;

Return: nothing


^ up

Name: setFrequency()

Description:

Set the the frequency value in Hz.

Syntax:

note.setFrequency(float f) ;

Return: nothing


^ up

Name: setPan()

Description:

Set the pan value of an event.

Syntax:

note.setChannel(float f) ;

Return: nothing


^ up

Name: setSustain()

Description:

Set a channel id.

Syntax:

note.setSustain(float s) ;

Return: nothing


^ up

Name: setVelocity()

Description:

Set the velocity value of an event.

Syntax:

note.setVelocity(float v) ;

Return: nothing


^ up

 

 





  << back^page-up
  > memory >Tatu5 > Note class