rfunes Posted June 5, 2022 Share Posted June 5, 2022 (edited) I have developed a bB program to play PCM data (currently only voice) in reasonable quality and using a custom compression algorithm to save ROM space. I record and export to RAW PCM 8-bit unsigned, then using an external program I developed in Java, I downsample every 8 samples to only 1 sample, and quantize the values to 15 or 30 (depending if I want to use only one or both sound channels). This program also does a basic compression of the resulting values, using a very simple algorithm to save bytes when a value repeats 3 or more times. Based on how I prepare the data, I can fit from 15 to 30 seconds of PCM audio, depending on if I use both channels (volume up to value = 30, or 5 bits) or only one channel (volume up to value = 15, or 4 bits) (ps: I plan on writing a tutorial and sharing my code). If quality is not so important, or if a "robotic" voice is acceptable, it is also possible to be even more aggressive with the downsampling and quantization, for example to reduce from 16 samples to 1 sample, or even 32 samples to 1 sample (in this case, although the quality suffers, it still produces understandable audio, and I can fit more than 10 seconds in a single bank, or about 80 seconds in a 32k ROM ! The major limitation is that in bB I cannot call "drawscreen", otherwise my program will run at only 60 fps, which of course is not quick enough for the speech. So currently I run it without drawing the screen and it works great, but the major limitation is that I cannot have anything on screen while the speech is being played. is there any way in batariBasic to make code to run at each scanline, like it is done in pure ASM ? Even if it would require using some asm inside bB, or maybe changing bB itself? Has anyone did this or have any idea if this is feasible/possible? Thanks! Edited June 5, 2022 by rfunes 2 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.