Showing the changes to src/spectrogram.c (1 of 5 files). Show all
Unified · Split
| @@ -41,13 +41,14 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | #define MAX_X_SIZE 200000 | 42 | #define MAX_X_SIZE 200000 |
| 43 | 43 | ||
| 44 | typedef enum {Window_Hann, Window_Hamming, Window_Bartlett, Window_Rectangular, Window_Kaiser} win_type_t; | 44 | typedef enum {Window_Hann, Window_Hamming, Window_Bartlett, Window_Rectangular, Window_Kaiser, Window_Dolph} win_type_t; |
| 45 | static lsx_enum_item const window_options[] = { | 45 | static lsx_enum_item const window_options[] = { |
| 46 | LSX_ENUM_ITEM(Window_,Hann) | 46 | LSX_ENUM_ITEM(Window_,Hann) |
| 47 | LSX_ENUM_ITEM(Window_,Hamming) | 47 | LSX_ENUM_ITEM(Window_,Hamming) |
| 48 | LSX_ENUM_ITEM(Window_,Bartlett) | 48 | LSX_ENUM_ITEM(Window_,Bartlett) |
| 49 | LSX_ENUM_ITEM(Window_,Rectangular) | 49 | LSX_ENUM_ITEM(Window_,Rectangular) |
| 50 | LSX_ENUM_ITEM(Window_,Kaiser) | 50 | LSX_ENUM_ITEM(Window_,Kaiser) |
| 51 | LSX_ENUM_ITEM(Window_,Dolph) | ||
| 51 | {0, 0}}; | 52 | {0, 0}}; |
| 52 | 53 | ||
| 53 | typedef struct { | 54 | typedef struct { |
| @@ -178,8 +179,10 @@ static double make_window(priv_t * p, int end) · 124 unmodified lines | |||
| 178 | case Window_Hamming: lsx_apply_hamming(w, n); break; | 179 | case Window_Hamming: lsx_apply_hamming(w, n); break; |
| 179 | case Window_Bartlett: lsx_apply_bartlett(w, n); break; | 180 | case Window_Bartlett: lsx_apply_bartlett(w, n); break; |
| 180 | case Window_Rectangular: break; | 181 | case Window_Rectangular: break; |
| 181 | default: lsx_apply_kaiser(w, n, lsx_kaiser_beta( | 182 | case Window_Kaiser: lsx_apply_kaiser(w, n, lsx_kaiser_beta( |
| 182 | (p->dB_range + p->gain) * (1.1 + p->window_adjust / 50), .1)); | 183 | (p->dB_range + p->gain) * (1.1 + p->window_adjust / 50), .1)); break; |
| 184 | default: lsx_apply_dolph(w, n, | ||
| 185 | (p->dB_range + p->gain) * (1.005 + p->window_adjust / 50) + 6); | ||
| 183 | } | 186 | } |
| 184 | for (i = 0; i < p->dft_size; ++i) sum += p->window[i]; | 187 | for (i = 0; i < p->dft_size; ++i) sum += p->window[i]; |
| 185 | for (i = 0; i < p->dft_size; ++i) p->window[i] *= 2 / sum | 188 | for (i = 0; i < p->dft_size; ++i) p->window[i] *= 2 / sum |
| @@ -673,8 +676,8 @@ sox_effect_handler_t const * lsx_spectrogram_effect_fn(void) · 487 unmodified lines | |||
| 673 | "\t-z num\tZ-axis range in dB; default 120", | 676 | "\t-z num\tZ-axis range in dB; default 120", |
| 674 | "\t-Z num\tZ-axis maximum in dBFS; default 0", | 677 | "\t-Z num\tZ-axis maximum in dBFS; default 0", |
| 675 | "\t-q num\tZ-axis quantisation (0 - 249); default 249", | 678 | "\t-q num\tZ-axis quantisation (0 - 249); default 249", |
| 676 | "\t-w name\tWindow: Hann (default), Hamming, Bartlett, Rectangular, Kaiser", | 679 | "\t-w name\tWindow: Hann(default)/Hamming/Bartlett/Rectangular/Kaiser/Dolph", |
| 677 | "\t-W num\tWindow adjust parameter (-10 - 10); applies only to Kaiser", | 680 | "\t-W num\tWindow adjust parameter (-10 - 10); applies only to Kaiser/Dolph", |
| 678 | "\t-s\tSlack overlap of windows", | 681 | "\t-s\tSlack overlap of windows", |
| 679 | "\t-a\tSuppress axis lines", | 682 | "\t-a\tSuppress axis lines", |
| 680 | "\t-r\tRaw spectrogram; no axes or legends", | 683 | "\t-r\tRaw spectrogram; no axes or legends", |