|
miniDSP
A small C library for audio DSP
|
Spectrogram text art: synthesise audio that displays readable text when viewed as a spectrogram. More...
Go to the source code of this file.
Functions | |
| static int | pixel_at (const char *text, unsigned len, unsigned col, unsigned row) |
| Return the pixel state (0 or 1) at bitmap coordinate (col, row) for the given string. | |
| unsigned | MD_spectrogram_text (double *output, unsigned max_len, const char *text, double freq_lo, double freq_hi, double duration_sec, double sample_rate) |
| Synthesise audio that displays readable text in a spectrogram. | |
Variables | |
| static const unsigned char | font_5x7 [95][5] |
Spectrogram text art: synthesise audio that displays readable text when viewed as a spectrogram.
A 5x7 bitmap font rasterises each printable ASCII character. Each bitmap column becomes a time slice; each "on" pixel becomes a sine wave at the corresponding frequency. A raised-cosine crossfade suppresses clicks at column boundaries.
Definition in file minidsp_spectext.c.
| unsigned MD_spectrogram_text | ( | double * | output, |
| unsigned | max_len, | ||
| const char * | text, | ||
| double | freq_lo, | ||
| double | freq_hi, | ||
| double | duration_sec, | ||
| double | sample_rate ) |
Synthesise audio that displays readable text in a spectrogram.
Given a short string, the function rasterises it with a built-in 5x7 bitmap font. Each bitmap column becomes a time slice; each "on" pixel becomes a sine wave at the corresponding frequency between freq_lo and freq_hi. A 3 ms raised-cosine crossfade suppresses clicks at column boundaries. The output is normalised to 0.9 peak amplitude.
| output | Output buffer (caller-allocated). |
| max_len | Size of output in samples (must be >= returned value). |
| text | Printable ASCII string to render (must be non-empty). |
| freq_lo | Lowest frequency in Hz (bottom of text). |
| freq_hi | Highest frequency in Hz (top of text, must be < Nyquist). |
| duration_sec | Total duration in seconds. |
| sample_rate | Sample rate in Hz. |
output.Definition at line 144 of file minidsp_spectext.c.
|
static |
Return the pixel state (0 or 1) at bitmap coordinate (col, row) for the given string.
Characters are 5 columns wide with 3-column spacing. Rows are numbered 0 (top) to 6 (bottom).
Definition at line 123 of file minidsp_spectext.c.
|
static |
Definition at line 22 of file minidsp_spectext.c.