Skip to content

Commit

Permalink
ATK fix: FoaProximity, FoaNFC conform FOA speed of sound to HOA
Browse files Browse the repository at this point in the history
FIX: #317

Update AtkFoa.speedOfSound == AtkHoa.speedOfSound == 343.0 m/s
  • Loading branch information
joslloand committed Jul 27, 2021
1 parent b55c295 commit 1d4cd02
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
24 changes: 14 additions & 10 deletions source/ATK/AtkUGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1944,9 +1944,10 @@ void FoaNFC_next_k(FoaNFC *unit, int inNumSamples)
float y1x = unit->m_y1x;
float y1y = unit->m_y1y;
float y1z = unit->m_y1z;

for(int i = 0; i < inNumSamples; i++){
float freq = 53.0 / distanceStart;
// AtkFoa.speedOfSound = 343.0 --> 343.0 / 2pi --> 54.59014548052
float freq = 54.59014548052 / distanceStart;
float wc = (twopi * freq) * SAMPLEDUR;

// a0 = (1 + (wc.cos.neg * 2 + 2).sqrt).reciprocal;
Expand Down Expand Up @@ -1994,9 +1995,10 @@ void FoaNFC_next_a(FoaNFC *unit, int inNumSamples)
float y1x = unit->m_y1x;
float y1y = unit->m_y1y;
float y1z = unit->m_y1z;

for(int i = 0; i < inNumSamples; i++){
float freq = 53.0 / distance[i];
// AtkFoa.speedOfSound = 343.0 --> 343.0 / 2pi --> 54.59014548052
float freq = 54.59014548052 / distance[i];
float wc = (twopi * freq) * SAMPLEDUR;
float a0 = 1 / (sqrt((cos(wc) * -2) + 2) + 1);

Expand Down Expand Up @@ -2058,9 +2060,10 @@ void FoaProximity_next_k(FoaProximity *unit, int inNumSamples)
float y1x = unit->m_y1x;
float y1y = unit->m_y1y;
float y1z = unit->m_y1z;

for(int i=0; i<inNumSamples;i++){
float freq = 53.0 / distanceStart;

for(int i = 0; i < inNumSamples;i++){
// AtkFoa.speedOfSound = 343.0 --> 343.0 / 2pi --> 54.59014548052
float freq = 54.59014548052 / distance[i];
float wc = (twopi * freq) * SAMPLEDUR;

// a0 = 1 + (wc.cos.neg * 2 + 2).sqrt;
Expand Down Expand Up @@ -2108,9 +2111,10 @@ void FoaProximity_next_a(FoaProximity *unit, int inNumSamples)
float y1x = unit->m_y1x;
float y1y = unit->m_y1y;
float y1z = unit->m_y1z;

for(int i = 0; i<inNumSamples; i++){
float freq = 53.0 / distance[i];

for(int i = 0; i < inNumSamples; i++){
// AtkFoa.speedOfSound = 343.0 --> 343.0 / 2pi --> 54.59014548052
float freq = 54.59014548052 / distance[i];
float wc = (twopi * freq) * SAMPLEDUR;
float a0 = 1 + sqrt((cos(wc) * -2) + 2);

Expand Down
7 changes: 6 additions & 1 deletion source/ATK/sc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ Ambisonic Toolkit.
List of Changes
---------------

Unreleased 3.9.0
Version 3.12.0

* Refactoring:
* Update AtkFoa.speedOfSound == AtkHoa.speedOfSound == 343.0 m/s

Version 3.9.0

* Refactoring:
* Quark-ify: classes, extension methods & documentation moved to
Expand Down

0 comments on commit 1d4cd02

Please sign in to comment.