mån 2022-03-07 klockan 22:04 -0500 skrev Jack Bruienne: > On 3/7/22 06:03, Tomas Härdin wrote: > > > tor 2022-03-03 klockan 10:44 -0500 skrev Jack Bruienne: > > >   From the wiki page (https://wiki.vexatos.com/dfpwm): > > > > DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec > > > > created by Ben “GreaseMonkey” Russell in 2012, originally to be > > > > used > > > > as a voice codec for asiekierka's pixmess, a C remake of > > > > 64pixels. > > > > It is a 1-bit-per-sample codec which uses a dynamic-strength > > > > one- > > > > pole > > > > low-pass filter as a predictor. Due to the fact that a raw > > > > DPFWM > > > > decoding > > > > creates a high-pitched whine, it is often followed by some > > > > post- > > > > processing > > > > filters to make the stream more listenable. > > This sounds similar to something I wrote for the Atari 2600 a > > number of > > years ago (https://www.pouet.net/prod.php?which=59283  ) > > > > I found an encoder online for DFPWM, and it seems to suffer from > > the > > same "beeping" that my debeeping hack fixes (suppressing 0xAA and > > 0x55 > > bytes). Perhaps a similar hack could be useful in dfpwmenc.c > > I'm curious how this works. Do you just cut out those bytes from the > encoder output, or is it modified in some way? Wouldn't removing the > data entirely eventually cause much of the audio to be lost? The source code is included in the release. Look at audioquant.cpp. I've attached it for convenience. The codec is based on a state machine where each state is a 5-bit PCM value that can go to either of two states, also 5-bit PCM values. Hence 1 bit per sample. I also have a low-pass filter in the decoder. I penalize state machines which result in 0x55 and 0xAA being overly represented. This is done via computing a histogram of the output bytes and scaling the RMS error according to how many of those bytes are in the (tentative) output. Another approach could be to detect and blank excessive runs of 0x55 and 0xAA bytes. > >  From experience it's usually better to be strict when it comes to > > stuff > > like this. The ComputerCraft people should work out a standard for > > this, preferably a container. We've had a similar problem in FreeDV > > where which codec was being used was implicit most of the time, > > which > > has been resolved with the .c2 format. > > I think the best standardized container for DFPWM will be WAV. I agree, and I see this was already pushed. /Tomas