Click here to Skip to main content
15,891,828 members
Articles / Web Development / HTML

How to change the pitch and tempo of a sound

Rate me:
Please Sign up or sign in to vote.
4.91/5 (34 votes)
24 Sep 2011LGPL36 min read 195.8K   14.9K   71  
This article shows how to change the pitch and tempo of a sound.
#ifndef CPCT_DLL_H
#define CPCT_DLL_H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DLL_EXPORTS
#define API_CPCT _declspec(dllexport)
#else 
#define API_CPCT _declspec(dllimport)
#endif

typedef void* HANDLE;

// create cpct-mstftm by default parameters
API_CPCT HANDLE createCpctByDefault();

// create cpct-mstftm by specific parameters
API_CPCT HANDLE createCpctByParams(int winlen, int hoplen, int nit);

// float* data is the input data, datalength is the length of data, nChannels is the number of channels
API_CPCT void setData(HANDLE h, const float* data, int datalength, int nChannels);

// set the tempo and pitch
API_CPCT void setParams(HANDLE h, float tempo, float pitch);

// get the output data, datalength is the length of data, nChannels is the number of channels
API_CPCT void getData(HANDLE h, float* data, int& datalength);

// destroy the cpct-mstftm instance
API_CPCT void destroyCpct(HANDLE h);

#ifdef __cplusplus
}
#endif

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
China China
E-mail:calinyara@gmail.com

Comments and Discussions