NAP
Classes | Typedefs | Enumerations | Functions
nap::audio Namespace Reference

Classes

class  AsyncObserver
 
class  AudioBufferResource
 
class  AudioComponentBase
 
class  AudioComponentBaseInstance
 
class  AudioFileResource
 
class  AudioInputComponent
 
class  AudioInputComponentInstance
 
class  AudioService
 
class  BufferPlayerNode
 
class  ControlNode
 
class  Delay
 
class  DeletionQueue
 
class  DirtyFlag
 
class  EqualPowerTranslator
 
class  FilterNode
 
class  GainNode
 
class  IMultiChannelInput
 
class  IMultiChannelOutput
 
class  InputNode
 
class  InputPin
 
class  InputPinBase
 
class  LevelMeterComponent
 
class  LevelMeterComponentInstance
 
class  LevelMeterNode
 
class  LinearSmoothedValue
 
class  MixNode
 
class  MultiAudioFileResource
 
class  MultiInputPin
 
class  MultiplyNode
 
class  MultiSampleBuffer
 
class  MultiSampleBufferPlayerNode
 
class  Node
 
class  NodeManager
 
class  OutputComponent
 
class  OutputComponentInstance
 
class  OutputNode
 
class  OutputPin
 
class  ParentProcess
 
class  PlaybackComponent
 
class  PlaybackComponentInstance
 
class  PortAudioService
 
class  PortAudioServiceConfiguration
 
class  Process
 
class  PullNode
 
class  RampedValue
 
class  SafeOwner
 
class  SafeOwnerBase
 
class  SafePtr
 
class  SafePtrBase
 
class  SequencePlayerAudioOutputComponent
 
class  SequencePlayerAudioOutputComponentInstance
 
class  StereoPannerNode
 
class  TableTranslator
 
class  Translator
 
class  VideoAudioComponent
 
class  VideoAudioComponentInstance
 
class  VideoNode
 

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 >
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)
 

Typedef Documentation

◆ ControllerValue

using ControllerValue = float

Value of control parameter Change this to double to build with double precision sample calculation

◆ DiscreteTimeValue

Time value in samples

◆ SampleBuffer

using SampleBuffer = std::vector<SampleValue>

A buffer of samples

◆ SampleValue

using SampleValue = float

Value of a single audio sample Change this to double to build with double precision sample calculation

◆ TimeValue

using TimeValue = float

Time value in milliseconds

Enumeration Type Documentation

◆ RampMode

enum RampMode

Mode to calculate a ramp from one value to another in a certain amount of steps

Enumerator
Linear 
Exponential 

Function Documentation

◆ dbToA()

float nap::audio::dbToA ( float  db,
float  zero = -48 
)

Convert decibel value to amplitude.

Parameters
dbin dB.
zerospecifies the lowest possible dB input value, which will result in a zero return value.
Returns
amplitude scaling factor.

◆ equalPowerPan()

void nap::audio::equalPowerPan ( const T &  panning,
T &  left,
T &  right 
)

Stereo equal power panning function.

Parameters
panningvalue between 0 and 1.0, 0 meaning far left, 0.5 center and 1.0 far right.
leftleft channel gain will be stored in this variable
rightright channel gain will be stored in this variable

◆ lerp()

T nap::audio::lerp ( const T &  v0,
const T &  v1,
const T &  t 
)

Linear interpolation between two values.

Parameters
v0start value of the interpolation which is returned when t = 0
v1end value of the interpolation which is returned when t = 1.
tvalue between 0 and zero
Returns
the result of the interpolation

◆ mtof()

float nap::audio::mtof ( float  pitch)

Convert a midi notenumber format pitch (floating point for microtonal precision) to a frequency in Herz.

Parameters
pitchin semitones. A pitch of 57 equals 220Hz.
Returns
frequency in Hz.

◆ readAudioFile()

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

Parameters
fileNamethe absolute path to the file
outputthe buffer to read the file into
outSampleRatesample rate of the audio file
errorStatecontains the error when reading fails
Returns
true on success

◆ toDB()

float nap::audio::toDB ( float  amplitude)

Convert amplitude to decibel value.

Parameters
amplitudeAmplitude scaling factor. A value of 1.0 results in 0dB.
Returns
intensity in dB.

◆ wrap()

unsigned int nap::audio::wrap ( unsigned int  index,
unsigned int  bufferSize 
)

Wraps index value within the range of a buffer size.

Parameters
indexvalue to be wrapped
bufferSizesize to be wrapped within, needs to be a power of two!