Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i extract logmel spec using audioFlux in total C++ code #26

Open
SteveTanggithub opened this issue Aug 30, 2023 · 1 comment
Open

Comments

@SteveTanggithub
Copy link

No description provided.

@SteveTanggithub SteveTanggithub changed the title How can i do logmeluse audioFlux How can i extract logmel spec using audioFlux in total C++ code Aug 30, 2023
@wtq2255
Copy link
Member

wtq2255 commented Sep 5, 2023

@SteveTanggithub Hi, You can refer to the following code:

int main(int argc, char const *argv[]){
	SpectrogramObj spec=NULL;

	int status=0;

	int num=0;

	int samplate=32000;

	float lowFre=0;
	float highFre=16000;

	float *mDataArr=NULL;
	float *mDataArr2=NULL;

	int radix2Exp=12; // stft 4096
	WindowType windowType=Window_Hann;
	int slideLength=(1<<radix2Exp)/4;
	int isContinue=0;

	SpectralDataType dataType=SpectralData_Power;
	SpectralFilterBankScaleType filterBankType;
	SpectralFilterBankStyleType filterBankStyle;
	SpectralFilterBankNormalType filterNormalType;
	filterBankType=SpectralFilterBankScale_Mel;
	filterBankStyle=SpectralFilterBankStyle_Slaney;
	filterNormalType=SpectralFilterBankNormal_None;

	num=128;
	status=spectrogramObj_new(&spec,num,
				&samplate,&lowFre,&highFre,NULL,
				&radix2Exp,NULL,NULL,&isContinue,
				&dataType,&filterBankType,&filterBankStyle,&filterNormalType);

	timeLength=spectrogramObj_calTimeLength(spec,dataLength);
	mDataArr=__vnew(timeLength*num, NULL);
	mDataArr2=__vnew(timeLength*num, NULL);
	spectrogramObj_spectrogram(spec,dataArr,dataLength,mDataArr,NULL);
	util_powerToDB(mDataArr, timeLength*num, -80, mDataArr2);
}

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

No branches or pull requests

2 participants