Documentation ¶
Index ¶
- Constants
- func CarveSeams(img *image.RGBA, newWidthInPercentage float64) (*image.RGBA, error)
- func CreateAudioFromSpectrogram(img *image.RGBA) ([]int16, error)
- func CreateSpectrogramFromAudio(int16s []int16) (*image.RGBA, error)
- func WriteWavFile(filePath string, int16s []int16, header WAVHeader) error
- type WAVHeader
Constants ¶
View Source
const ( // Assume 44100 Hz sample rate SampleRate = 44100 // Assume 16-bit depth BitsPerSample = 16 // Assume mono audio NumChannels = 1 // Assume PCM audio AudioFormat = 1 // Compute other header values ByteRate = SampleRate * NumChannels * BitsPerSample / 8 BlockAlign = NumChannels * BitsPerSample / 8 // Size of the FFT FFTSize = 1024 )
Variables ¶
This section is empty.
Functions ¶
func CarveSeams ¶
CarveSeams removes seams from the image to reduce its width by the given percentage.
func CreateAudioFromSpectrogram ¶
CreateAudioFromSpectrogram creates audio from a spectrogram and extracts the length of the audio data from the image.
func CreateSpectrogramFromAudio ¶
CreateSpectrogramFromAudio creates a spectrogram from an []int16 and encodes the length of the audio data into the image.
Types ¶
type WAVHeader ¶
type WAVHeader struct { ChunkID [4]byte ChunkSize uint32 Format [4]byte Subchunk1ID [4]byte Subchunk1Size uint32 AudioFormat uint16 NumChannels uint16 SampleRate uint32 ByteRate uint32 BlockAlign uint16 BitsPerSample uint16 Subchunk2ID [4]byte Subchunk2Size uint32 }
WAVHeader represents the header of a WAV file.
Click to show internal directories.
Click to hide internal directories.