top of page
Search

[97] Static Integration

  • Writer: Conlan Walker
    Conlan Walker
  • Sep 21, 2023
  • 2 min read

Knocked a few out with one stone this week, though I'm only half-finished with one of them.

I wanted to do another attempt at my simple audio codec, and that requires source audio, which requires some file i/o stuff.

So, the first thing involves the reading of a binary file, with a variable chunk size.

The second involves the parsing of ".wav" file data, that was previously loaded into memory.

The third involves the actual codec part, which uses a form of digital-digital delta modulation.



ree

The file i/o isn't that interesting, as it just loads a file into memory in chunks of (by default) 4096 bytes.


The .wav file parsing should be able to read the relevant RIFF subchunks in any arbitrary order.


As long as the necessary information is present by the end of parsing, the wav data read is considered a success.





Following kmixer's supported data types, .wav files of type float, unsigned char, signed short, and signed int are allowed.

ree


I'm very sure I've tried showing delta modulation before, but I'm not very good at explaining it, so here I go again.


At its simplest, delta modulation uses samples of 1 bit, where amplitude will go up by a certain delta value on 1, and will go down by a certain value on 0.

In the diagram below, the decoded stream goes up in amplitude when it's below the original waveform, and will go down when it is above the original waveform.

ree

(My implementation should reduce a good deal of noise, because I came up with a type of filter to be used when encoding and decoding.)



Anyway, here's the code responsible for everything I talked about (except the delta modulation part), which I'm including last because no one actually reads it.


 
 
 

Comments


bottom of page