Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SpectMorph::Audio Class Reference

Audio sample containing many blocks. More...

#include <smaudio.hh>

Public Types

enum  LoopType {

Public Member Functions

Error load (const std::string &filename, AudioLoadOptions load_options=AUDIO_LOAD_DEBUG)
Error load (SpectMorph::GenericIn *file, AudioLoadOptions load_options=AUDIO_LOAD_DEBUG)
Error save (const std::string &filename) const
Error save (SpectMorph::GenericOut *file) const
Audioclone () const

Static Public Member Functions

static bool loop_type_to_string (LoopType loop_type, std::string &s)
static bool string_to_loop_type (const std::string &s, LoopType &loop_type)

Public Attributes

float fundamental_freq = 0
 fundamental frequency (note which was encoded), or 0 if not available
float mix_freq = 0
 mix freq (sampling rate) of the original audio data
float frame_size_ms = 0
 length of each audio frame in milliseconds
float frame_step_ms = 0
 stepping of the audio frames in milliseconds
float attack_start_ms = 0
 start of attack in milliseconds
float attack_end_ms = 0
 end of attack in milliseconds
int zeropad = 0
 FFT zeropadding used during analysis.
LoopType loop_type = LOOP_NONE
 type of loop to be used during sustain phase of playback
int loop_start = 0
 loop point to be used during sustain phase of playback
int loop_end = 0
 loop point to be used during sustain phase of playback
int zero_values_at_start = 0
 number of zero values added by encoder (strip during decoding)
int sample_count = 0
 number of samples encoded (including zero_values_at_start)
std::vector< float > original_samples
 original time domain signal as samples (debugging only)
float original_samples_norm_db = 0
 normalization factor to be applied to original samples
std::vector< AudioBlockcontents
 the actual frame data

Static Public Attributes

static constexpr size_t N_NOISE_BANDS = 32

Detailed Description

Audio sample containing many blocks.

This class contains the information the SpectMorph::Encoder creates for a wav file. The time dependant parameters are stored in contents, as a vector of audio frames; the parameters that are the same for all frames are stored in this class.

Member Function Documentation

◆ load()

Error SpectMorph::Audio::load ( const std::string &  filename,
AudioLoadOptions  load_options = AUDIO_LOAD_DEBUG 

This function loads a SM-File.

filenamethe name of the SM-File to be loaded
load_optionsspecify whether to load or skip debug information
a SpectMorph::Error indicating whether loading was successful

◆ save()

Error SpectMorph::Audio::save ( const std::string &  filename) const

This function saves a SM-File.

filenamethe name of the SM-File to be written
a SpectMorph::Error indicating saving loading was successful

The documentation for this class was generated from the following files: