Typedefs | |
using | SampleValue = float |
using | SampleBuffer = std::vector< SampleValue > |
using | ControllerValue = float |
using | TimeValue = float |
using | DiscreteTimeValue = nap::uint64 |
Enumerations | |
enum | RampMode { Linear, Exponential } |
Functions | |
bool NAPAPI | readAudioFile (const std::string &fileName, MultiSampleBuffer &output, float &outSampleRate, nap::utility::ErrorState &errorState) |
unsigned int | wrap (unsigned int index, unsigned int bufferSize) |
template<typename T > | |
T | lerp (const T &v0, const T &v1, const T &t) |
template<typename T > | |
void | equalPowerPan (const T &panning, T &left, T &right) |
float | mtof (float pitch) |
float | toDB (float amplitude) |
float | dbToA (float db, float zero=-48) |
using ControllerValue = float |
Value of control parameter Change this to double to build with double precision sample calculation
using DiscreteTimeValue = nap::uint64 |
Time value in samples
using SampleBuffer = std::vector<SampleValue> |
A buffer of samples
using SampleValue = float |
Value of a single audio sample Change this to double to build with double precision sample calculation
using TimeValue = float |
Time value in milliseconds
enum RampMode |
float nap::audio::dbToA | ( | float | db, |
float | zero = -48 |
||
) |
Convert decibel value to amplitude.
db | in dB. |
zero | specifies the lowest possible dB input value, which will result in a zero return value. |
void nap::audio::equalPowerPan | ( | const T & | panning, |
T & | left, | ||
T & | right | ||
) |
Stereo equal power panning function.
panning | value between 0 and 1.0, 0 meaning far left, 0.5 center and 1.0 far right. |
left | left channel gain will be stored in this variable |
right | right channel gain will be stored in this variable |
T nap::audio::lerp | ( | const T & | v0, |
const T & | v1, | ||
const T & | t | ||
) |
Linear interpolation between two values.
v0 | start value of the interpolation which is returned when t = 0 |
v1 | end value of the interpolation which is returned when t = 1. |
t | value between 0 and zero |
float nap::audio::mtof | ( | float | pitch | ) |
Convert a midi notenumber format pitch (floating point for microtonal precision) to a frequency in Herz.
pitch | in semitones. A pitch of 57 equals 220Hz. |
bool NAPAPI nap::audio::readAudioFile | ( | const std::string & | fileName, |
MultiSampleBuffer & | output, | ||
float & | outSampleRate, | ||
nap::utility::ErrorState & | errorState | ||
) |
Utility to read an audio file from disk
fileName | the absolute path to the file |
output | the buffer to read the file into |
outSampleRate | sample rate of the audio file |
errorState | contains the error when reading fails |
float nap::audio::toDB | ( | float | amplitude | ) |
Convert amplitude to decibel value.
amplitude | Amplitude scaling factor. A value of 1.0 results in 0dB. |
unsigned int nap::audio::wrap | ( | unsigned int | index, |
unsigned int | bufferSize | ||
) |
Wraps index value within the range of a buffer size.
index | value to be wrapped |
bufferSize | size to be wrapped within, needs to be a power of two! |