WaveformPlayer - RoseAndres/gDAW GitHub Wiki
Inherits: Node < Object < AudioStreamPlayer
Plays an audio waveform non-positionally.
| Type | Name | Default |
|---|---|---|
| float | attack | 0.5 |
| float | attack_shape | 0.5 |
| float | decay | 0.5 |
| float | decay_shape | 0.5 |
| float | hz | 220 |
| float | last_level | |
| float | limit | 0.6 |
| bool | linear | false |
| Note | note | C |
| int | octave | 4 |
| bool | play | false |
| AudioStreamPlayback | playback | |
| float | release | 0.5 |
| float | release_shape | 0.5 |
| float | sustain | 0.5 |
| bool | use_hz | false |
| bool | was_playing | |
| Waveform | waveform | SINE |
| Type | Name(args) |
|---|---|
| void | finish ( ) |
| float | frequency ( ) |
| String | get_state ( ) |
| void | set_state ( String new_state ) |
| void | start ( ) |
| int | time_in_state ( ) |
-
state_changed ( String from, String to, int time_in_state )
Emitted when this WaveformPlayer's ADSR state is changed.
fromthe key of the State this WaveformPlayer transitioned from.
tothe key of the State this WaveformPlayer transitioned to.
time_in_statethe amount of time in ms this WaveformPlayer was in the from state.\
- C, D, E, F, G, A, B = 0, 2, 4, 5, 7, 9, 11 --- The musical note this WaveformPlayer will play.
-
CS, EB, FS, GS, BB = 1, 3, 6, 8, 10 ---
-Sand-Bindicate sharp and flat, respectively. Thus,CSandBBare equivalent to C# and Bb.
Note: The values of this enum are hard-coded; it does not account for equivalent notes (A# and Bb or Cb and B, for example).
- STOPPED = 0 --- Sound is not being generated.
- ATTACK = 1 --- The waveform is currently in the Attack phase.
- DECAY = 2 --- The waveform is currently in the Decay phase.
- SUSTAIN = 3 --- The waveform is currently in the Sustain phase.
- RELEASE = 3 --- The waveform is currently in the Release phase.
- SINE = 0 --- A Sine wave will be used to generate sound.
- TRIANGLE = 1 --- A Triangle wave will be used to generate sound.
- SQUARE = 2 --- A Square wave will be used to generate sound.
- SAW = 3 --- A Saw wave will be used to generate sound.
- WHITE_NOISE = 4 --- The generated noise will be White Noise (sounds like heavy rain).
- BROWN_NOISE = 5 --- The generated noise will be Brownian Noise (deeper than White Noise, akin to a thunderstorm).
-
float attack
Default:0.5
The length of time (in seconds) that the Attack phase will last.
-
float attack_shape
Default:0.5
A value between 0.0 and 1.0 that determines the shape of the Attack curve. Higher values will result in a more logarithmic curve, while lower values will appear more exponential. This value will be ignored iflinearis set totrue.
-
float decay
Default:0.5
The length of time (in seconds) that the Decay phase will last.
-
float decay_shape
Default:0.5
A value between 0.0 and 1.0 that determines the shape of the Decay curve. Higher values will result in a more logarithmic curve, while lower values will appear more exponential. This value will be ignored iflinearis set totrue.
-
float hz
Default:220
A raw Hz value. This will be used as the sound's frequency instead of finding it withnoteandoctave, ifuse_hzis set totrue.
-
float limit
Default:0.6
A value between 0.0 and 1.0 that determines percentage of the max GoDAW max volume that this WaveformPlayer will use as its own local max volume.
-
bool linear
Default:false
If true, the ADSR curves will be linear. Otherwise, the curves will be quadratic and use theattack_shape,decay_shape, andrelease_shapeproperties to calculate the curves.
-
Note note
Default:C
The note is to be played. Ignored ifuse_hzistrue.
-
int octave
Default:4
The octave the current note is to be played in. Ignored ifuse_hzistrue.
-
bool play
Default:false
If true, the WaveformPlayer will emit noise according to the envelope and frequency determined by its other vars. This will also cause the WaveformPlayer to emit sound when toggled in-editor.
-
float release
Default:0.5
The length of time (in seconds) that the Release phase will last.
-
float release_shape
Default:0.5
A value between 0.0 and 1.0 that determines the shape of the Release curve. Higher values will result in a more logarithmic curve, while lower values will appear more exponential. This value will be ignored iflinearis set totrue.
-
float sustain
Default:0.5
A value between 0.0 and 1.0 that determines percentage of this WaveformPlayer's local max volume (limit) that will be used as the volume during the sustain phase of the ADSR envelope.
-
bool use_hz
Default:false
If true, this WaveformPlayer will use thehzvalue directly as the frequency, otherwise the WaveformPlayer will calculate it using thenoteandoctavevalues.
-
Waveform waveform
Default:SINE
The waveform this WaveformPlayer will use to generate audio.
-
void finish ( )
Initiates the stopping of sound emission from the WaveformPlayer (starts the release).
-
bool is_playing ( )
Returnsfalseif the WaveformPlayer's state is equal toState.STOPPED. Returnstrueotherwise.
-
void set_state ( String
state_key)
Sets the WaveformPlayer's state to the State value corresponding to the givenstate_key. Emits astate_changedsignal.
-
int time_in_state ( )
Returns the amount of time (in milliseconds) that the WaveformPlayer has been in its current state.
-
float frequency ( )
Returns the raw frequency being used by the WaveformPlayer to generate audio.