ElectroPhone
ElectroPhone Library.
Example:
const AudioCtx = window.AudioContext || window.webkitAudioContext;
const synth = new ElectroPhone(new AudioCtx(), { spectrum: false });
Test:
Static Method Summary
| Static Public Methods | ||
| public static |
Describe all ElectroPhone modules with parameters configuration. |
|
| public static |
getFrequency(note: String, octave: Number): Number Get frequency float value calculated from given note and octave. |
|
| public static |
getModuleProperties(moduleType: String): Array Get module properties by type. |
|
| public static |
Get complete notes list. |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(audioContext: AudioContext, properties: ElectroPhoneProperties) Create a playable web synthesizer instance. |
|
Method Summary
| Public Methods | ||
| public |
adsr(properties: Object): ElectroPhone Update the ADSR module. |
|
| public |
create(id: String, type: String, properties: Object): ElectroPhone Create a new synth module. |
|
| public |
destroy(id: String): ElectroPhone Destroy the synth module by id. |
|
| public |
getModules(): Object Returns current synth modules configuration object. |
|
| public |
link(source: String, target: String): ElectroPhone Link two modules, connect source module to target module. |
|
| public |
master(properties: Object): ElectroPhone Update the master module. |
|
| public |
play(frequency: Number): ElectroPhone Start playing the input frequency. |
|
| public |
stop(frequency: Number): ElectroPhone Stop playing the input frequency. |
|
| public |
update(id: String, properties: Object): ElectroPhone Update the synth module by id. |
|
Static Public Methods
public static describeModules(): Array source
Describe all ElectroPhone modules with parameters configuration.
public static getFrequency(note: String, octave: Number): Number source
Get frequency float value calculated from given note and octave.
Public Constructors
public constructor(audioContext: AudioContext, properties: ElectroPhoneProperties) source
Create a playable web synthesizer instance.
Params:
| Name | Type | Attribute | Description |
| audioContext | AudioContext | Web Audio Context instance. |
|
| properties | ElectroPhoneProperties |
|
synth properties. |
Public Members
Public Methods
public adsr(properties: Object): ElectroPhone source
Update the ADSR module.
Params:
| Name | Type | Attribute | Description |
| properties | Object | ADSR (Envelope) properties |
public create(id: String, type: String, properties: Object): ElectroPhone source
Create a new synth module.
Throw:
throw error when module with id is already created. |
public destroy(id: String): ElectroPhone source
Destroy the synth module by id.
Params:
| Name | Type | Attribute | Description |
| id | String | the module identifier. |
Throw:
throw error when module with id is not found. |
public getModules(): Object source
Returns current synth modules configuration object.
Return:
| Object | current synth modules configuration. |
Return Properties:
| Name | Type | Attribute | Description |
| master | Object | the master ModuleProperties. |
|
| adsr | Object | the adsr ModuleProperties. |
|
| <module_id> | ModuleProperties | one ModuleProperties for each created module. |
public link(source: String, target: String): ElectroPhone source
Link two modules, connect source module to target module.
Throw:
throw error when source is master. |
|
throw error when source module is not found. |
|
throw error when target module is not found. |
public master(properties: Object): ElectroPhone source
Update the master module.
Params:
| Name | Type | Attribute | Description |
| properties | Object | master properties. |
public play(frequency: Number): ElectroPhone source
Start playing the input frequency.
Params:
| Name | Type | Attribute | Description |
| frequency | Number | the frequency value. |
public stop(frequency: Number): ElectroPhone source
Stop playing the input frequency.
Params:
| Name | Type | Attribute | Description |
| frequency | Number | the frequency value. |
public update(id: String, properties: Object): ElectroPhone source
Update the synth module by id.
Throw:
throw error when module with id is not found. |