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 void set_loop (Audio::LoopType loop_type,
int loop_start,
int loop_end);
164 void set_loop_seconds (Audio::LoopType loop_type,
double loop_start,
double loop_end);
166 Error save (
const std::string& filename);
167 Audio *save_as_audio();
int zeropad
Definition: smencoder.hh:41
std::vector< float > window
Definition: smencoder.hh:59
Encoder parameters.
Definition: smencoder.hh:22
void setup_params(const WavData &wav_data, double fundamental_freq)
Definition: smencoder.cc:196
std::vector< float > original_fft
original zeropadded FFT data - for debugging only
Definition: smencoder.hh:97
size_t block_size
Definition: smencoder.hh:50
Audio sample containing many blocks.
Definition: smaudio.hh:79
Definition: smutils.hh:87
Definition: smencoder.hh:90
Definition: smencoder.hh:79
std::vector< EncoderBlock > audio_blocks
current state, and end result of the encoding algorithm
Definition: smencoder.hh:152
void set_kill_function(const std::function< bool()> &kill_function)
Definition: smencoder.cc:235
std::vector< float > phases
phases of the sine components
Definition: smencoder.hh:96
size_t frame_size
Definition: smencoder.hh:47
float frame_size_ms
Definition: smencoder.hh:38
Definition: smadsrenvelope.hh:8
double fundamental_freq
Definition: smencoder.hh:53
float mix_freq
Definition: smencoder.hh:32
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 > debug_samples
original audio samples for this frame - for debugging only
Definition: smencoder.hh:98
Encoder producing SpectMorph parametric data from sample data.
Definition: smencoder.hh:109
size_t frame_step
Definition: smencoder.hh:44
std::function< bool()> kill_function
Definition: smencoder.hh:62
bool enable_phases
Definition: smencoder.hh:56
std::vector< float > noise
noise envelope, representing the original signal minus sine components
Definition: smencoder.hh:93
Definition: smwavdata.hh:16
float frame_step_ms
Definition: smencoder.hh:35