- // Right now we are encoding everything as 1.0-scaled dibit floats
- // This is a bit silly but it will do for a minute
- // Max theoretical gain from the RRC filter is 4.328
- // Let's bump everything to a baseline of 16383 / 4.328 = 3785.35
- // This is not particularly high but at least we won't ever hit the top
- self.filter_win[self.filter_cursor] = dibit * 3785.0;
- self.filter_cursor = (self.filter_cursor + 1) % 81;
- let mut out: f32 = 0.0;
- for i in 0..81 {
- let filter_idx = (self.filter_cursor + i) % 81;
- out += RRC_48K[i] * self.filter_win[filter_idx];
+ // TODO: 48 kHz assumption again
+ for i in 0..10 {
+ // Right now we are encoding everything as 1.0-scaled dibit floats
+ // This is a bit silly but it will do for a minute
+ // Max theoretical gain from the RRC filter is 4.328
+ // Let's bump everything to a baseline of 16383 / 4.328 = 3785.35
+ // This is not particularly high but at least we won't ever hit the top
+ if i == 0 {
+ // 10x the impulse with zeroes between for upsampling
+ self.filter_win[self.filter_cursor] = dibit * 3785.0 * 10.0;
+ } else {
+ self.filter_win[self.filter_cursor] = 0.0;
+ }
+ self.filter_cursor = (self.filter_cursor + 1) % 81;
+ let mut out: f32 = 0.0;
+ for i in 0..81 {
+ let filter_idx = (self.filter_cursor + i) % 81;
+ out += RRC_48K[i] * self.filter_win[filter_idx];
+ }
+ self.next_transmission[self.next_len] = out as i16;
+ self.next_len += 1;