Skip to content

Conversation

@singalsu
Copy link
Collaborator

This patch adds sound direction tracking. TDFB component updates
the sound direction control to user space. User space may control
the beam direction with help of this.

Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com

@singalsu
Copy link
Collaborator Author

First draft, needs a lot of cleanup and testing and optimization. It tracked in simulated 2mic acoustics in testbench quite well a 360 degree rotating sound source within -90 .. +90 deg that the 2D array can handle.

@singalsu
Copy link
Collaborator Author

singalsu commented Oct 4, 2021

I just pushed a version that "worked" correctly in a notebook device. I will next tune it to be more responsive, now only fairly loud sounds trigger angle update. Also I should change the enum scale for line array topologies for better precision. Alsatplg allows 16 different values and now 12 is used to cover 0-330 degrees. I could use 15 steps for -90..0..+90 with ~13 degrees precision. Or 13 steps with exactly 15 degrees step.

@lgirdwood
Copy link
Member

I just pushed a version that "worked" correctly in a notebook device. I will next tune it to be more responsive, now only fairly loud sounds trigger angle update. Also I should change the enum scale for line array topologies for better precision. Alsatplg allows 16 different values and now 12 is used to cover 0-330 degrees. I could use 15 steps for -90..0..+90 with ~13 degrees precision. Or 13 steps with exactly 15 degrees step.

Best to use integer step size for alsamixer rendering.

@singalsu
Copy link
Collaborator Author

Best to use integer step size for alsamixer rendering.

Yep, my working version is using exact 15 degree step for line arrays now. I will share soon a testbench PR to enable testing of different input and output channels count in pipeline and improved TDFB test scripts. Then share the update to this PR.

@singalsu
Copy link
Collaborator Author

This PR needs #4941. I will meanwhile share related parts to this work (TDFB comp bug fixes, TDFB tool improvement, testbench improvement, TDFB test improvement). Also avoids huge single PR since I had to change plenty of things to be able to test this. This version with internal math functions remains [WIP].

@lgirdwood
Copy link
Member

@singalsu ok pls work with @ShriramShastry for #4941. Changes are localized so can be included for rc2

@lgirdwood
Copy link
Member

@singalsu ready for review now ?

@singalsu
Copy link
Collaborator Author

@singalsu ready for review now ?

Sorry, not yet. Need to solve issue in #4941 to compute square root, the power function there is not suitable for that. There's a another PR coming for square root. Backup is to convert power function part of DRC to math library.

@singalsu
Copy link
Collaborator Author

@lgirdwood I'm now testing this with PR #5034 .

@singalsu
Copy link
Collaborator Author

New WIP draft with Sriram's sqrt() lib patch temporarily included.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the same as ((a + 180) % 360) - 180? Maybe the below can be similarly simplified too, but be careful with division remainder of negative numbers

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that worked, and slightly different version for negative angles.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking: how about

cd->direction.rp = cd->direction.d;
cd->direction.wp = cd->direction.d + ch_count * (cd->direction.max_lag + 1);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this was a quick bug fix test that I forgot to clean up.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use goto for clean up

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd->direction.trigger <<= 1;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something above makes me suspicious. If the first test ds2 < ds1 was true, 360 was subtracted from az. And now you add 360 back to az for another test? An else missing somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be an else. The second squared error eval is unnecessary if the first 360 deg addition was done. The second test is false if first was true. One multiplication saved in that case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsigned int?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, changed!

@singalsu singalsu force-pushed the tdfb_direction branch 3 times, most recently from 310d25b to aa32c9f Compare December 22, 2021 18:49
@lgirdwood
Copy link
Member

@cujomalainey good for you ?

@singalsu
Copy link
Collaborator Author

I just updated the emphasis IIR response from 2nd order 2 kHz high-pass to 1 - 4 kHz 4th order band-pass. It prevents highest frequencies to alias spatially and add error to angle. The lower high-pass picks up a bit more voice signal while still attenuates lowest frequencies those are usually noise. No other changes.

@lgirdwood lgirdwood added this to the v2.1 milestone Jan 25, 2022
@lgirdwood
Copy link
Member

@singalsu any updates ?

The DF2T IIR core has been moved earlier to library but the
helper functions for configuring it were left to EQ component.
This patch eases use of IIR core from other components. The
file src/audio/eq_iir/iir.c is moved to src/math. There are no
changes except of remove iir.h since the contents specific
for DF2T type were merged to iir_df2t.h

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds function cross_product_s16(). Cross product is
commonly used function in computational geometry.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds sound direction estimation. TDFB component updates
the sound direction control to user space. User space may control
the beam direction towards the source with help of the reported
angle.

Sound direction estimation is based on cross correlation maximums
pattern and match of theoretical propagation delays to measured
pattern. Cross correlation search is triggered by short term
level when it exceeds the estimated background noise level. An
emphasis filter is used to filter out typical low frequency noise.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Comment text is added to tdfb.c to help find the settings
generator shell script.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
Copy link
Collaborator Author

singalsu commented Feb 2, 2022

I just added a commit that adds to tdfb.c a comment about settings generator script to help find it. No other changes done.

@lgirdwood
Copy link
Member

@cujomalainey good for you ?

@lgirdwood lgirdwood merged commit f753241 into thesofproject:main Feb 4, 2022
@singalsu singalsu deleted the tdfb_direction branch September 16, 2022 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants