Commit Graph

25 Commits

Author SHA1 Message Date
kris
346c647c40 Tweaks 2022-06-28 22:04:57 +01:00
kris
cb5de62cc8 Look ahead beyond the EOF opcodes for better prediction quality
Normalize based on 100th percentile
2022-06-21 21:33:19 +01:00
kris
a48e7b796c Oops, EOF opcodes weren't being padded 2022-06-11 21:13:36 +01:00
kris
13fb60fed0 Add a lot of EOF variants - quality is good but they're mostly not used 2022-06-11 17:27:52 +01:00
kris
1552715b49 Optimized EOF sequence 2022-06-04 14:53:33 +01:00
kris
fbd6b956d1 Checkpoint working player 2022-06-04 14:06:52 +01:00
kris
8ea4f150ad Checkpoint - trying to mitigate EOF clicking 2022-05-24 22:19:40 +01:00
kris
b97a625d7d Working version of encoder. This reproduces the clicking that happens from end-of-frame, so we will need a new strategy 2022-05-16 21:11:17 +01:00
kris
929ea026d9 Format comment 2020-12-29 14:33:22 +00:00
kris
daee564255 Rename slowpath opcode to end_of_frame to better describe what it does.
Add command-line flags for audio normalization params.
2020-12-28 22:42:34 +00:00
kris
ccba51eead Add support for targeting 6502, for which the JMP (indirect) opcode
takes 5 cycles instead of 6.
2020-12-28 13:23:57 +00:00
kris
d4bc2d45e5 Parametrize options by command-line flags 2020-12-28 12:54:44 +00:00
kris
a1a1f33c21 Add partial support for 4-cycle NOP; NOP opcode pairs
Count and report on the number of speaker toggles/sec during encoding
2020-12-28 12:29:05 +00:00
kris
93b63db558 Use the correct effective clock rate for a PAL Apple II, taking into account the long cycle. 2020-12-24 14:43:00 +00:00
kris
f1b6983dda Last minute tweaks 2020-12-07 20:58:18 +00:00
kris
706ba54f5b Further significant optimizations:
- Switch some matrices to column-major order, since they usually have
  more rows than columns.  This turns out to be slightly faster.
- Precompute more of the speaker trajectory formula, since most of it
  only depends on the matrix of applied voltages (which only depends
  on frame_offset).

Bug fixes:
- make sure to leave enough 0-padding at the end of input data in case
  we schedule a SLOWPATH towards the end, since we'll skip into this
  buffer.
- Pad the last TCP frame with EXIT opcodes instead of TICK_00.
- Improve the eta counter behaviour by not setting a minimum tick
  interval, and being more careful about when we update.  This fixes
  issues with short files
2020-12-07 20:48:15 +00:00
kris
22babbaa73 Parametrize normalization percentage 2020-10-15 13:08:33 +01:00
kris
8122f65dc6 Optimize memory and speed. 2020-08-25 20:46:00 +01:00
kris
938fbae488 Optimize evolve() by expanding recurrence relation 2020-08-24 22:28:28 +01:00
kris
7a4a36af6b Checkpoint WIP
- use exotic opcodes in player
- optimize encoder
2020-08-24 21:27:24 +01:00
kris
4767ee51fd Fixup player timings and opcode variants for 65c02 timings since JMP
(indirect) takes 5 cycles not 6!  It should be possible to also
accommodate 6502 timings in a followup.

h/t to Scott Duensing who noticed that my sample audio sounded "a tad
slow", which turned out to be due to this 1-cycle difference (which
added up to almost an extra minute playback to an 8-minute song).

Add comments and tidy up the code a bit.

Flesh out README some more.
2020-08-16 23:15:30 +01:00
kris
86cd1e1114 1MHz encoder and player
- we simulate the speaker at full 1-cycle resolution, and
  evaluate all possible opcodes that can be scheduled for the
  given position in the TCP stream
- this lets us tick the speaker at any cycle interval >=9 (except 10
  cycles)
2020-08-13 22:08:50 +01:00
kris
b35e4f86fb Add shebang and tidy some more 2020-08-11 23:26:55 +01:00
kris
1bbbd8c154 Merge preprocess_audio back in. We didn't end up getting a speed
boost from pypy, perhaps because the critical path is in numpy code.

Add some comments and clean up a bit.
2020-08-11 23:23:33 +01:00
kris
0f8ad1bf17 Checkpoint working code that implements delta modulation with look-ahead.
I split out preprocess_audio because scipy/librosa don't run under
pypy and I was hoping that would speed up the encoding, but it does
not for some reason (maybe numpy interactions?)

Anyway, I should be able to vectorize the slow path which will likely
help a lot.
2020-08-10 21:03:12 +01:00