Skip to content

Commit

Permalink
Docs/road map and docs update (#160)
Browse files Browse the repository at this point in the history
* docs: readme and api coverage update

* feat: added missing states

* style: yarn format

---------

Co-authored-by: Maciej Makowski <[email protected]>
  • Loading branch information
maciejmakowski2003 and Maciej Makowski authored Oct 18, 2024
1 parent a2d4086 commit 1dd896b
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 102 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ allowing developers to generate and modify audio in exact same way it is possibl
<br />
[MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) is usefull resource to get familiar with audio processing basics.

For development purposes there is also simplified description of already implemented interfaces as well as overview on Web Audio API coverage.
For development purposes there is overview on Web Audio API coverage.

- [Basic interfaces description](./internal-docs/basic-interfaces.md)
- [Web Audio API coverage](./internal-docs/web-audio-coverage.md)

## Examples
Expand Down
229 changes: 131 additions & 98 deletions internal-docs/web-audio-coverage.md
Original file line number Diff line number Diff line change
@@ -1,133 +1,166 @@
## Web Audio API coverage
# Web Audio API coverage

<details>
<summary><b>AudioContext</b><br/> Android: ✅ <br/>iOS: ✅</summary>

| Method / Property | iOS | Android |
| --------------------- | --- | ------- |
| 🔹 destination |||
| 🔹 sampleRate |||
| 🔹 state |||
| 🔹 currentTime |||
| 🔘 createGain |||
| 🔘 createOscillator |||
| 🔘 createStereoPanner |||
| 🔘 createBiquadFilter |||
| 🔘 close |||
## Completed Features (**5** out of 33 features)
![](https://geps.dev/progress/15?dangerColor=006600&warningColor=006600&successColor=006600)

</details>
- **AudioScheduledSourceNode**
- **AudioDestinationNode**
- **GainNode**
- **StereoPannerNode**
- **AudioNode**

<details>
<summary><b>AudioParam</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ------------------------------ | --- | ------- |
| 🔹value |||
| 🔹defaultValue |||
| 🔹minValue |||
| 🔹maxValue |||
| 🔘setValueAtTime |||
| 🔘linearRampToValueAtTime |||
| 🔘exponentialRampToValueAtTime |||

</details>
## In Progress (**7** out of 33 features)
![](https://geps.dev/progress/21?dangerColor=ff9900&warningColor=ff9900&successColor=ff9900)

<details>
<summary><b>AudioBuffer</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ------------------------------ | --- | ------- |
| 🔹sampleRate |||
| 🔹length |||
| 🔹duration |||
| 🔹numberOfChannels |||
| 🔘getChannelData |||
| 🔘setChannelData |||
<summary><b>AudioContext</b></summary>

| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹 baseLatency ||
| 🔹 outputLatency ||
| 🔹 sinkId ||
| 🔘 close ||
| 🔘 createMediaElementSource ||
| 🔘 createMediaStreamSource ||
| 🔘 createMediaStreamTrackSource ||
| 🔘 resume ||
| 🔘 setSinkId ||
| 🔘 suspend ||

</details>

<details>
<summary><b>AudioNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------------- | --- | ------- |
| 🔹context |||
| 🔹numberOfInputs |||
| 🔹numberOfOutputs |||
| 🔹channelCount |||
| 🔹channelCountMode |||
| 🔹channelInterpretation |||
| 🔘connect |||
| 🔘disconnect |||
<summary><b>AudioBuffer</b></summary>

| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹sampleRate ||
| 🔹length ||
| 🔹duration ||
| 🔹numberOfChannels ||
| 🔘getChannelData ||
| 🔘getChannelData ||
| 🔘setChannelData ||
| 🔘copyFromChannel ||
| 🔘copyToChannel ||

</details>

<details>
<summary><b>AudioScheduledSourceNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔘start |||
| 🔘stop |||
<summary><b>AudioBufferSourceNode</b></summary>

| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹buffer ||
| 🔹detune ||
| 🔹loop ||
| 🔹loopStart ||
| 🔹loopEnd ||
| 🔹playBackRate ||
| 🔘start(overridden) ||

</details>

<details>
<summary><b>AudioDestinationNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
<summary><b>AudioParam</b></summary>

| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹value ||
| 🔹defaultValue ||
| 🔹minValue ||
| 🔹maxValue ||
| 🔘setValueAtTime ||
| 🔘linearRampToValueAtTime ||
| 🔘setTargetAtTime ||
| 🔘setValueCurveAtTime ||
| 🔘cancelScheduledValues ||
| 🔘cancelAndHoldAtTime ||

</details>

<details>
<summary><b>OscillatorNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔹frequency |||
| 🔹detune |||
| 🔹type |||
<summary><b>BaseAudioContext</b></summary>

| Property 🔹/ Method 🔘 | state |
| --------------------------- | ----- |
| 🔹 audioWorklet ||
| 🔹 currentTime ||
| 🔹 destination ||
| 🔹 listener ||
| 🔹 sampleRate ||
| 🔹 state ||
| 🔘 createAnalyser ||
| 🔘 createBiquadFilter ||
| 🔘 createBuffer ||
| 🔘 createBufferSource ||
| 🔘 createConstantSource ||
| 🔘 createChannelMerger ||
| 🔘 createChannelSplitter ||
| 🔘 createConvolver ||
| 🔘 createDelay ||
| 🔘 createDynamicsCompressor ||
| 🔘 createGain ||
| 🔘 createIIRFilter ||
| 🔘 createOscillator ||
| 🔘 createPanner ||
| 🔘 createPeriodicWave ||
| 🔘 createStereoPanner ||
| 🔘 createWaveShaper ||
| 🔘 decodeAudioData ||

</details>

<details>
<summary><b>GainNode</b><br/> Android: ✅ <br />iOS: ✅</summary>
<summary><b>OscillatorNode</b></summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔹gain |||
| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹frequency ||
| 🔹detune ||
| 🔹type ||
| 🔘setPeriodicWave ||

</details>

<details>
<summary><b>StereoPannerNode</b><br/> Android: ✅ <br />iOS: ✅</summary>
<summary><b>BiquadFilterNodee</b></summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔹pan |||
| Property 🔹/ Method 🔘 | state |
| ------------------------------- | ----- |
| 🔹frequency ||
| 🔹detune ||
| 🔹Q ||
| 🔹gain ||
| 🔹type ||
| 🔘getFrequencyRespons ||

</details>

<details>
<summary><b>BiquadFilterNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔹frequency |||
| 🔹detune |||
| 🔹Q |||
| 🔹gain |||
| 🔹type |||

</details>

<details>
<summary><b>AudioBufferSourceNode</b><br/> Android: ✅ <br />iOS: ✅</summary>

| Method / Property | iOS | Android |
| ----------------- | --- | ------- |
| 🔹buffer |||
| 🔹loop |||

</details>
## Planned Features (**21** out of 33 features)

![](https://geps.dev/progress/64?dangerColor=800000&warningColor=800000&successColor=800000)

- **AudioParamMap**
- **MediaElementAudioSourceNode**
- **MediaStremAudioSourceNode**
- **MediaStremTrackAudioSourceNode**
- **MediaElementAudioSourceNode**
- **ConvolverNode**
- **DelayNode**
- **DynamicsCompressorNode**
- **WaveShaperNode**
- **PeriodicWave**
- **IRRFilterNode**
- **MediaStreamAudioDestinationNode**
- **AnalyserNode**
- **ChannelSplitterNode**
- **MergerNode**
- **AudioListener**
- **PannerNode**
- **AudioWorkletNode**
- **AudioWorkletProcessor**
- **AudioWorkletGlobalScope**
- **OfflineAudioContext**
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ class AudioContext {
std::function<void(float *, int)> renderAudio();

private:
enum class State { RUNNING, CLOSED };
enum class State { SUSPENDED, RUNNING, CLOSED };

static std::string toString(State state) {
switch (state) {
case State::SUSPENDED:
return "suspended";
case State::RUNNING:
return "running";
case State::CLOSED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OscillatorNode : public AudioScheduledSourceNode {
bool processAudio(float *audioData, int32_t numFrames) override;

private:
enum class WaveType { SINE, SQUARE, SAWTOOTH, TRIANGLE };
enum class WaveType { SINE, SQUARE, SAWTOOTH, TRIANGLE, CUSTOM };

static float sineWave(double wavePhase) {
return static_cast<float>(std::sin(wavePhase));
Expand Down Expand Up @@ -76,6 +76,8 @@ class OscillatorNode : public AudioScheduledSourceNode {
return WaveType::SAWTOOTH;
if (lowerType == "triangle")
return WaveType::TRIANGLE;
if (lowerType == "custom")
return WaveType::CUSTOM;

throw std::invalid_argument("Unknown wave type: " + type);
}
Expand All @@ -90,6 +92,8 @@ class OscillatorNode : public AudioScheduledSourceNode {
return "sawtooth";
case WaveType::TRIANGLE:
return "triangle";
case WaveType::CUSTOM:
return "custom";
default:
throw std::invalid_argument("Unknown wave type");
}
Expand Down

0 comments on commit 1dd896b

Please sign in to comment.