home/ atoms/ spectrogram-to-audio-reconstruction

Converting a generated log-spectrogram to audio requires denormalizing, de-logging to amplitude, then an iSTFT

Neural audio models typically train on min-max normalized log-magnitude spectrograms, and add a channel dimension for convolutional layers. To turn a generated spectrogram back into a waveform, reverse each preprocessing step in order: (1) strip the extra channel dimension to restore a 2D (frequency × time) array; (2) denormalize using the per-sample original min and max stored during preprocessing; (3) de-log from decibels back to linear amplitude (librosa.db_to_amplitude); (4) apply the inverse STFT — here Griffin-Lim — passing the same hop_length used to analyse. Skipping the denormalize or de-log step scales amplitudes wrongly; the stored per-sample min/max values are therefore essential and must be persisted from preprocessing.

Examples

log_spec = spec[:, :, 0] (drop channel) → denorm = normalizer.denormalize(log_spec, mn, mx)lin = librosa.db_to_amplitude(denorm)signal = librosa.istft(lin, hop_length=hop_length).

Assessment

List, in order, the four steps to turn a normalized log-spectrogram (with a channel axis) into a playable waveform, and say why the original min/max must be stored during preprocessing.

“back here we'll do spec is equal to librosa dot decibels to amplitude and we'll pass the what's the name of this guy denormalized log spectrogram”
corpus · generating-sound-with-neural-networks-the-sound-of-ai-valeri · chunk 2