PK gQ?H?U9 9 lib_mic_array/README.rstMicrophone array library
========================
.. rheader::
Microphone array library |version|
Microphone array library
------------------------
The XMOS microphone array library is designed to allow interfacing to PDM
microphones coupled with efficient decimation to user selectable output
sample rates. Additionally, a high resolution delay can be introduced to
each of the individual PDM microphones allowing for individual time shifts.
This library is only avaliable for XS2 devices.
Features
........
The microphone array library has the following features:
- 48kHz, 24kHz, 16kHz, 12kHz and 8kHz output sample rate by default (3.072MHz PDM clock),
- 44.1kHz, 22.05kHz, 14.7kHz, 11.025kHz and 7.35kHz output sample rate by default (2.8224MHz PDM clock),
- 4, 8, 12 or 16 PDM interfaces per tile,
- No less than 80dB of stop band attenuation for all output sample frequencies,
- Configurable latency, ripple and bandwidth,
- Framing, configurable frame size from 1 sample to 8192 samples plus 50% overlapping frames option,
- Windowing and sample index bit reversal within a frame,
- Individual microphone gain compensation,
- DC offset removal,
- Up to 3.072MHz input sample rate,
- High resolution (2.63 microsecond) microphone specific delay lines,
- Every task requires only a 62.5 MIPS core to run.
Components
...........
* PDM interface,
* Four channel decimators,
* High resolution delay block.
Software version and dependencies
.................................
.. libdeps::
Related application notes
.........................
None
PK gQ?H?Da a lib_mic_array/CHANGELOG.rstlib_mic_array change log
========================
2.0.0
-----
* Renamed all functions to match library structure
* Decimator interface functions now take the array of
mic_array_decimator_config structure rather than
mic_array_decimator_config_common
* All defines renames to match library naming policy
* DC offset simplified
* Added optional MIC_ARRAY_NUM_MICS define to save memory when using less than
16 microphones
1.0.1
-----
* Added dynamic DC offset removal at startup to eliminate slow convergance
* Mute first 32 samples to allow DC offset to adapt before outputting signal
* Fixed XTA scripte to ensure timing is being met
* Now use a 64-bit accumulator for DC offset removal
* Consolidated generators into a single python generator
* Produced output frequency response graphs
* Added 16 bit output mode
1.0.0
-----
* Major refactor
* FRAME_SIZE_LOG2 renamed MAX_FRAME_SIZE_LOG2
* Decimator interface now takes arrays of streaming channels
* Decimators now take channel count as a parameter
* Added filter designer script
* Documentation updates
* First stage now uses a FIR decimator
* Changed decimation flow
* Removed high res delay module
* Added generator for FIR coefficients
* Added ability to reduce number of channels active in a decimator
* Increased number of FIR taps
* Increased output dynamic range
0.0.2
-----
* Documentation fixes
* Fixed frame number fix
* Added frame metadata
0.0.1
-----
* Initial Release
* Changes to dependencies:
- lib_logging: Added dependency 2.0.0
- lib_xassert: Added dependency 2.0.0
PK gQ?H?-B?* ]* lib_mic_array/LICENSE.txtSoftware Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software in object code only with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS Microphone array library software
PK gQ?HPL? ? % lib_mic_array/lib_mic_array/.cproject
PK gQ?H,m?{ { - lib_mic_array/lib_mic_array/module_build_infoMODULE_XCC_XC_FLAGS = $(XCC_XC_FLAGS)
DEPENDENT_MODULES = lib_xassert(>=2.0.0) lib_logging(>=2.0.0)
VERSION = 2.0.0
PK gQ?Hm夥| | % lib_mic_array/lib_mic_array/.xproject
lib_mic_array2.0.0PK gQ?H啭
~? ? % lib_mic_array/lib_mic_array/.makefileall:
@echo "** Module only - only builds as part of application **"
clean:
@echo "** Module only - only builds as part of application **"
PK gQ?HU?菸 $ lib_mic_array/lib_mic_array/.project
lib_mic_arraycom.xmos.cdt.core.LegacyProjectCheckerBuildercom.xmos.cdt.core.ProjectInfoSyncBuildercom.xmos.cdt.core.ModulePathBuilderorg.eclipse.cdt.managedbuilder.core.genmakebuilderclean,full,incremental,org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilderfull,incremental,org.eclipse.cdt.core.cnatureorg.eclipse.cdt.managedbuilder.core.managedBuildNatureorg.eclipse.cdt.managedbuilder.core.ScannerConfigNaturecom.xmos.cdt.core.XdeProjectNature
PK gQ?H?-B?* ]* ' lib_mic_array/lib_mic_array/LICENSE.txtSoftware Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software in object code only with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS Microphone array library software
PK gQ?H2?%E . lib_mic_array/lib_mic_array/module_descriptionMicrophone array libraryPK gQ?H???l- l- + lib_mic_array/lib_mic_array/api/mic_array.h// Copyright (c) 2016, XMOS Ltd, All rights reserved
#ifndef MIC_ARRAY_H_
#define MIC_ARRAY_H_
#include
#include
#include "fir_coefs.h"
#include "mic_array_frame.h"
#ifndef MIC_ARRAY_HIRES_MAX_DELAY
#define MIC_ARRAY_HIRES_MAX_DELAY 256
#endif
/** PDM Microphone Interface component.
*
* This task handles the interface to up to 8 PDM microphones whilst also decimating
* the PDM data by a factor of 8. The output is sent via two channels to two receiving
* tasks.
*
* \param p_pdm_mics The 8 bit wide port connected to the PDM microphones.
* \param c_4x_pdm_mic_0 The channel where the decimated PDM of microphones 0-3 will
* be outputted.
* \param c_4x_pdm_mic_1 The channel where the decimated PDM of microphones 4-7 will
* be outputted. This can be null for 4 channel output.
*/
void mic_array_pdm_rx(
in buffered port:32 p_pdm_mics,
streaming chanend c_4x_pdm_mic_0,
streaming chanend ?c_4x_pdm_mic_1);
/** High resolution delay component.
*
* This task handles the application of individual delays for up to 16 channels.
* Each unit of delay represents one sample at the input sample rate, i.e. the rate
* at which the circular buffer is being updated. The maximum delay is given by the
* size of the circular buffer.
*
* \param c_from_pdm_frontend The channels connecting to the output of the PDM interface
* \param c_to_decimator The channels connecting to the input of the 4 channel decimators.
* \param n The size of the two channel arrays, they must be the same.
* \param c_cmd The channel connecting the application to this task used for
* setting the delays.
*/
void mic_array_hires_delay(
streaming chanend c_from_pdm_frontend[],
streaming chanend c_to_decimator[],
unsigned n,
streaming chanend c_cmd);
/** Application side interface to high resolution delay.
*
* This function is used by the client of the high resolution delay to set the delays.
*
* \param c_cmd The channel connecting the application to this task used for
* setting the delays.
* \param delays An array of the delays to be set. These must all be less than MIC_ARRAY_HIRES_MAX_DELAY.
* \param num_channels The number of microphones. This must be the same as the delays array.
*/
void mic_array_hires_delay_set_taps(streaming chanend c_cmd, unsigned delays[], unsigned num_channels);
/** Four Channel decimator buffering type.
*
* This type is used to describe the buffering mode. Note: to use a windowing function the constant-overlap-and-add property
* must be obeyed, i.e. Coef[n] = 1-Coef[N-n] where N is the array length. Only half the array need be
* specified as the windowing function is assumed to be symmetric.
*/
typedef enum {
DECIMATOR_NO_FRAME_OVERLAP, ///< The frames have no overlap.
DECIMATOR_HALF_FRAME_OVERLAP ///< The frames have a 50% overlap betweeen sequential frames.
} mic_array_decimator_buffering_t;
/** Four Channel decimator configuration structure.
*
* This is used to describe the configuration that the group of synchronous decimators will use to process the PCM audio.
*/
typedef struct {
unsigned frame_size_log2; /**< The output frame size log2, i.e. A frame will contain 2 to the power of frame_size_log2 samples of each channel. */
int apply_dc_offset_removal; /**< Remove the DC offset from the audio before the final decimation. Set to non-zero to enable. */
int index_bit_reversal; /**< If non-zero then bit reverse the index of the elements within the frame. Used in the case of preparing for an FFT.*/
int * unsafe windowing_function; /**< If non-null then this will apply a windowing function to the frame. Used in the case of preparing for an FFT. */
unsigned output_decimation_factor; /**< Final stage FIR Decimation factor. */
const int * unsafe coefs; /**< The coefficients for the FIR decimator. */
int apply_mic_gain_compensation; /**< Set to non-zero to apply microphone gain compensation. */
int fir_gain_compensation; /**< 5.27 format for the gain compensation for the three stages of FIR filter. */
mic_array_decimator_buffering_t buffering_type; /**< The buffering type used for frame exchange. */
unsigned number_of_frame_buffers; /**< The count of frames used between the decimators and the application. */
} mic_array_decimator_conf_common_t;
/** Configuration structure unique to each of the 4 channel deciamtors.
*
* This contains configuration that is channel specific, i.e. Gain compensation, etc.
*/
typedef struct {
mic_array_decimator_conf_common_t * unsafe dcc;
int * unsafe data; /**< The data for the FIR decimator */
int mic_gain_compensation[4]; /**< An array describing the relative gain compensation to apply to the microphones. The microphone with the least gain is defined as 0x7fffffff (INT_MAX), all others are given as INT_MAX*min_gain/current_mic_gain.*/
unsigned channel_count; /**< The count of enabled channels (0->4). */
} mic_array_decimator_config_t;
/** Four Channel Decimation component.
*
* This task decimates the four channel input down to the desired output sample rate.
* The decimator has a fixed divide by 4 followed by a divide by decimation_factor where
* decimation_factor is greater than or equal to 2.
* The channel c_frame_output is used to transfer data and control information between the
* application and this task. It relies of shared memory for so the client of this task must
* be on the same tile as this task.
*
* \param c_from_pdm_interface The channel where the decimated PDM from pdm_rx task will be inputted.
* \param c_frame_output The channel used to transfer data and control information between
* the client of this task and this task.
*/
void mic_array_decimate_to_pcm_4ch(
streaming chanend c_from_pdm_interface,
streaming chanend c_frame_output);
/** Four Channel Decimation initializer for raw audio frames.
*
* This function call sets up the four channel decimators. After this has been called there
* will be a real time requirement on this task, i.e. this task must call
* mic_array_get_next_time_domain_frame() at the output sample rate multiplied by the frame size.
*
* \param c_from_decimators The channels used to transfer pointers between the application and
* the mic_array_decimate_to_pcm_4ch() tasks.
* \param decimator_count The count of mic_array_decimate_to_pcm_4ch() tasks.
* \param buffer The buffer index. Always points to the index that is accessible to
* the application (initialized internally)
* \param audio An array of audio frames.
* \param dc The array cointaining the decimator configuration for each decimator.
*
*/
void mic_array_init_time_domain_frame(
streaming chanend c_from_decimators[], unsigned decimator_count,
unsigned &buffer, mic_array_frame_time_domain audio[],
mic_array_decimator_config_t dc[]);
/** Four Channel Decimation raw audio frame exchange function.
*
* This function handles the frame exchange between the mic_array_decimate_to_pcm_4ch() tasks and the
* application. It returns a pointer to the most recently written frame. After this point the oldest
* frame is assumed out of scope to the application.
*
* \param c_from_decimators The channels used to transfer pointers between the application and
* the mic_array_decimate_to_pcm_4ch() tasks.
* \param decimator_count The count of mic_array_decimate_to_pcm_4ch() tasks.
* \param buffer The buffer index (Used internally)
* \param audio An array of audio frames.
* \param dc The array cointaining the decimator configuration for each decimator.
*
* \returns A pointer to the frame now owned by the application. That is, the most
* recently written samples.
*/
mic_array_frame_time_domain * alias mic_array_get_next_time_domain_frame(
streaming chanend c_from_decimators[], unsigned decimator_count,
unsigned &buffer, mic_array_frame_time_domain * alias audio,
mic_array_decimator_config_t dc[]);
/** Four Channel Decimation initializer for complex frames.
*
* This function call sets up the four channel decimators. After this has been called there
* will be a real time requirement on this task, i.e. this task must call
* mic_array_get_next_frequency_domain_frame() at the output sample rate multiplied by the frame size.
*
* \param c_from_decimators The channels used to transfer pointers between the application and
* the mic_array_decimate_to_pcm_4ch() tasks.
* \param decimator_count The count of mic_array_decimate_to_pcm_4ch() tasks.
* \param buffer The buffer index. Always points to the index that is accessible to
* the application (initialized internally)
* \param f_fft_preprocessed An array of complex frames.
* \param dc The array cointaining the decimator configuration for each decimator.
*
*/
void mic_array_init_frequency_domain_frame(streaming chanend c_from_decimators[], unsigned decimator_count,
unsigned &buffer, mic_array_frame_fft_preprocessed f_fft_preprocessed[], mic_array_decimator_config_t dc[]);
/** Four Channel Decimation complex frame exchange function.
*
* This function handles the frame exchange between the mic_array_decimate_to_pcm_4ch() tasks and the
* application. It returns a pointer to the most recently written frame. After this point the oldest
* frame is assumed out of scope to the application.
*
* \param c_from_decimators The channels used to transfer pointers between the application and
* the mic_array_decimate_to_pcm_4ch() tasks.
* \param decimator_count The count of mic_array_decimate_to_pcm_4ch() tasks.
* \param buffer The buffer index (Used internally)
* \param f_fft_preprocessed An array of complex frames.
* \param dc The array cointaining the decimator configuration for each decimator.
*
* \returns A pointer to the frame now owned by the application. That is, the most
* recently written samples.
*/
mic_array_frame_fft_preprocessed * alias mic_array_get_next_frequency_domain_frame(
streaming chanend c_from_decimators[], unsigned decimator_count,
unsigned &buffer, mic_array_frame_fft_preprocessed * alias f_fft_preprocessed,
mic_array_decimator_config_t dc[]);
/** Decimator configuration
*
* This function initializes the decimators and configures them as per the decimator configuration
* structure thay are passed.
*
* \param c_from_decimators The channels used to transfer pointers between the application and
* the mic_array_decimate_to_pcm_4ch() task.
* \param decimator_count The count of mic_array_decimate_to_pcm_4ch() tasks.
* \param dc The array cointaining the decimator configuration for each decimator.
*/
void mic_array_decimator_configure(
streaming chanend c_from_decimators[],
unsigned decimator_count,
mic_array_decimator_config_t dc[]);
#endif /* MIC_ARRAY_H_ */
PK gQ?H?茵? ? 1 lib_mic_array/lib_mic_array/api/mic_array_frame.h// Copyright (c) 2016, XMOS Ltd, All rights reserved
#ifndef MIC_ARRAY_FRAME_H_
#define MIC_ARRAY_FRAME_H_
#include
#include "mic_array_conf.h"
#ifndef MIC_ARRAY_NUM_MICS
#warning Count of microphones not defined in mic_array_conf.h, defaulting to 16
#define MIC_ARRAY_NUM_MICS 16
#endif
//Frames of frequency domain audio always have even number of channels, this rounds up.
#define MIC_ARRAY_NUM_FREQ_CHANNELS ((MIC_ARRAY_NUM_MICS + 1)/2)
//This must have an even number of words
typedef struct {
int32_t min; /**