History

add Dolph window for spectrogram effect

Rob Sykes committed 13 years ago

Commit a6be5941 parent 5fb55735 files · +25 −8Browse files

Showing the changes to src/spectrogram.c (1 of 5 files). Show all

Unified · Split

src/spectrogram.c+8−5
@@ -41,13 +41,14 @@ · 40 unmodified lines
4141
4242 #define MAX_X_SIZE 200000
4343
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;
4545 static lsx_enum_item const window_options[] = {
4646 LSX_ENUM_ITEM(Window_,Hann)
4747 LSX_ENUM_ITEM(Window_,Hamming)
4848 LSX_ENUM_ITEM(Window_,Bartlett)
4949 LSX_ENUM_ITEM(Window_,Rectangular)
5050 LSX_ENUM_ITEM(Window_,Kaiser)
51+ LSX_ENUM_ITEM(Window_,Dolph)
5152 {0, 0}};
5253
5354 typedef struct {
@@ -178,8 +179,10 @@ static double make_window(priv_t * p, int end) · 124 unmodified lines
178179 case Window_Hamming: lsx_apply_hamming(w, n); break;
179180 case Window_Bartlett: lsx_apply_bartlett(w, n); break;
180181 case Window_Rectangular: break;
181− default: lsx_apply_kaiser(w, n, lsx_kaiser_beta(
182− (p->dB_range + p->gain) * (1.1 + p->window_adjust / 50), .1));
182+ case Window_Kaiser: lsx_apply_kaiser(w, n, lsx_kaiser_beta(
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);
183186 }
184187 for (i = 0; i < p->dft_size; ++i) sum += p->window[i];
185188 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
673676 "\t-z num\tZ-axis range in dB; default 120",
674677 "\t-Z num\tZ-axis maximum in dBFS; default 0",
675678 "\t-q num\tZ-axis quantisation (0 - 249); default 249",
676− "\t-w name\tWindow: Hann (default), Hamming, Bartlett, Rectangular, Kaiser",
677− "\t-W num\tWindow adjust parameter (-10 - 10); applies only to Kaiser",
679+ "\t-w name\tWindow: Hann(default)/Hamming/Bartlett/Rectangular/Kaiser/Dolph",
680+ "\t-W num\tWindow adjust parameter (-10 - 10); applies only to Kaiser/Dolph",
678681 "\t-s\tSlack overlap of windows",
679682 "\t-a\tSuppress axis lines",
680683 "\t-r\tRaw spectrogram; no axes or legends",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t