3 #ifndef SPECTMORPH_ENCODER_HH
4 #define SPECTMORPH_ENCODER_HH
12 #include "smwavdata.hh"
25 std::vector<std::string> param_name_d;
26 std::map<std::string, double> param_value_d;
27 std::vector<std::string> param_name_s;
28 std::map<std::string, std::string> param_value_s;
64 bool add_config_entry (
const std::string& param,
const std::string& value);
66 bool load_config (
const std::string& filename);
67 bool get_param (
const std::string& param,
double& value)
const;
68 bool get_param (
const std::string& param, std::string& value)
const;
114 Audio::LoopType loop_type;
116 std::vector< std::vector<Tracksel> > frame_tracksels;
120 double attack_start_ms;
121 double attack_end_ms;
123 double attack_error (
const std::vector< std::vector<double> >& unscaled_signal,
const Attack& attack, std::vector<double>& out_scale);
126 void compute_stft (
const WavData& wav_data,
int channel);
127 void search_local_maxima();
128 void link_partials();
129 void validate_partials();
130 void optimize_partials (
int optimization_level);
131 void spectral_subtract();
133 void compute_attack_params();
137 killed (
const char *where, uint64_t z = 0)
147 Attack optimal_attack;
148 size_t zero_values_at_start;
153 std::vector<float> original_samples;
157 void debug_decode (
const std::string& filename);
160 bool encode (
const WavData& wav_data,
int channel,
int optimization_level,
161 bool attack,
bool track_sines);
163 static std::string version();
165 void set_loop (Audio::LoopType loop_type,
int loop_start,
int loop_end);
166 void set_loop_seconds (Audio::LoopType loop_type,
double loop_start,
double loop_end);
168 Error save (
const std::string& filename);
Audio sample containing many blocks.
Definition: smaudio.hh:80
Definition: smencoder.hh:91
std::vector< float > debug_samples
original audio samples for this frame - for debugging only
Definition: smencoder.hh:98
std::vector< float > freqs
frequencies of the sine components of this frame
Definition: smencoder.hh:94
std::vector< float > mags
magnitudes of the sine components
Definition: smencoder.hh:95
std::vector< float > original_fft
original zeropadded FFT data - for debugging only
Definition: smencoder.hh:97
std::vector< float > phases
phases of the sine components
Definition: smencoder.hh:96
std::vector< float > noise
noise envelope, representing the original signal minus sine components
Definition: smencoder.hh:93
Encoder parameters.
Definition: smencoder.hh:23
int zeropad
Definition: smencoder.hh:41
size_t frame_step
Definition: smencoder.hh:44
void set_kill_function(const std::function< bool()> &kill_function)
Definition: smencoder.cc:247
size_t block_size
Definition: smencoder.hh:50
double fundamental_freq
Definition: smencoder.hh:53
size_t frame_size
Definition: smencoder.hh:47
float mix_freq
Definition: smencoder.hh:32
bool enable_phases
Definition: smencoder.hh:56
float frame_step_ms
Definition: smencoder.hh:35
float frame_size_ms
Definition: smencoder.hh:38
std::function< bool()> kill_function
Definition: smencoder.hh:62
void setup_params(const WavData &wav_data, double fundamental_freq)
Definition: smencoder.cc:197
std::vector< float > window
Definition: smencoder.hh:59
Encoder producing SpectMorph parametric data from sample data.
Definition: smencoder.hh:110
Error save(const std::string &filename)
Definition: smencoder.cc:1506
bool encode(const WavData &wav_data, int channel, int optimization_level, bool attack, bool track_sines)
Definition: smencoder.cc:1376
Encoder(const EncoderParams &enc_params)
Definition: smencoder.cc:255
Audio * save_as_audio()
Definition: smencoder.cc:1518
std::vector< EncoderBlock > audio_blocks
current state, and end result of the encoding algorithm
Definition: smencoder.hh:152
Definition: smutils.hh:102
Definition: smwavdata.hh:17
Definition: smencoder.hh:79