asgramf

ASCII spectral periodogram for computing and displaying an estimate of a signal's power spectrum with ASCII characters

Variants: asgramcf, asgramf

Public Functions

asgramf asgramf_create(unsigned int _nfft)
asgramf asgramf_copy(asgramf _q)
int asgramf_destroy(asgramf _q)
int asgramf_reset(asgramf _q)
int asgramf_set_scale(asgramf _q, float _ref, float _div)
int asgramf_set_display(asgramf _q, const char * _ascii)
int asgramf_push(asgramf _q, float _x)
int asgramf_write(asgramf _q, float * _x, unsigned int _n)
int asgramf_execute(asgramf _q, char * _ascii, float * _peakval, float * _peakfreq)
int asgramf_print(asgramf _q)

Interfaces

asgramf asgramf_create(unsigned int _nfft)

Create asgram object with size _nfft

  • _nfft : size of FFT taken for each transform (character width)

asgramf asgramf_copy(asgramf _q)

Copy object including all internal objects and state

int asgramf_destroy(asgramf _q)

Destroy asgram object, freeing all internally-allocated memory

int asgramf_reset(asgramf _q)

Reset the internal state of the asgram object

int asgramf_set_scale(asgramf _q, float _ref, float _div)

Set the scale and offset for spectrogram in terms of dB for display purposes

  • _q : asgram object
  • _ref : signal reference level [dB]
  • _div : signal division [dB]

int asgramf_set_display(asgramf _q, const char * _ascii)

Set the display's 10 characters for output string starting from the weakest and ending with the strongest

  • _q : asgram object
  • _ascii : 10-character display, default: " .,-+*&NM#"

int asgramf_push(asgramf _q, float _x)

Push a single sample into the asgram object, executing internal transform as necessary.

  • _q : asgram object
  • _x : input sample

int asgramf_write(asgramf _q, float * _x, unsigned int _n)

Write a block of samples to the asgram object, executing internal transforms as necessary.

  • _q : asgram object
  • _x : input buffer, shape: (_n, 1)
  • _n : input buffer length

int asgramf_execute(asgramf _q, char * _ascii, float * _peakval, float * _peakfreq)

Compute spectral periodogram output from current buffer contents and return the ascii character string to display along with the peak value and its frequency location

  • _q : asgram object
  • _ascii : output ASCII string, shape: (_nfft, 1)
  • _peakval : peak power spectral density value [dB]
  • _peakfreq : peak power spectral density frequency

int asgramf_print(asgramf _q)

Compute spectral periodogram output from current buffer contents and print standard format to stdout