+rbairos Posted December 10, 2017 Share Posted December 10, 2017 Sorry, I had the volume levels set wrong for my above tests. Here they are again, much more audible and 1,2,3 bits.Still no dithering.Trying some dithering now, but just sounds hissier. test_1bit.wav test_2bit.wav test_3bit.wav test_4bit.wav test_5bit.wav test_6bit.wav test_7bit.wav test_8bit.wav Quote Link to comment Share on other sites More sharing options...
+rbairos Posted December 10, 2017 Share Posted December 10, 2017 For a basic experiment, I ripped the Boulder Dash music code and created a simple ROM from it. Attached you find the source code and two variations. One updates AUDV0 and AUDV1 at 100% equal intervals, while the other one (7) randomly delays the updates between 0 and 7 cycles. At least for this example, I cannot hear any difference. So probably I was wrong, and the update timing is not that critical. Me neither. Try a sine wave,you'll hear warbling I bet. Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 10, 2017 Share Posted December 10, 2017 Don't think this requires filtering out at twice nyquist frequency, as 60*292 = 15,720 hz, which is the upper limits of most basic audio playback devices anyways, so most sounds recordings (especially from the 1980s, probably had that in mind).The Nyquist frequency is half of the sample rate, 7860Hz in this case. I downloaded the same Back To The Future clip from youtube yesterday. Here's Audacity's spectrum report for my clip... Everything above 7860Hz won't get the two sample points necessary to represent a sine wave, and will add to noise. 2 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted December 10, 2017 Share Posted December 10, 2017 Me neither. Try a sine wave,you'll hear warbling I bet. I know, but the code is only producing a sawtooth. For a sine wave, I need something different. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted December 10, 2017 Share Posted December 10, 2017 Trying some dithering now, but just sounds hissier. What kind of dithering? Random? Quote Link to comment Share on other sites More sharing options...
ZackAttack Posted December 10, 2017 Author Share Posted December 10, 2017 Could the second volume register be used to change the loudness of each frame? Then you'd only have to set it once per frame. I think that would work pretty well for video playback. Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 10, 2017 Share Posted December 10, 2017 Could the second volume register be used to change the loudness of each frame? Then you'd only have to set it once per frame. I think that would work pretty well for video playback. Well, we're talking about AUDC#=0, where a DC offset is output instead of a frequency. In this case, if the second volume register has a value that isn't changing between frames, then it's just an unchanging DC offset, which doesn't amplify the other channel. At some point in the audio chain a capacitor will filter the DC offset out, but even if the DC offset did make it through the chain, it would push the speaker cone out a certain distance and hold it there. Other than that initial push to get to the position, there would be no additional movement of air, so no change in the overall volume. That initial push, and any other frame-based changes, will just create a small 60Hz "thump", with volume of the thump in proportion to the size of the change. 2 Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 10, 2017 Share Posted December 10, 2017 What kind of dithering? Random? I'd be most interested in the details too, though I don't think dither will help much until non-linear samples are implemented. Here are the graphs of 4-bit and 5-bit TIA audio output levels, vs linear output. Dithering is meant to cover up patterns due to rounding errors, and will "correct" up to 1/2 the amplitude of the lowest bit. In the graphs you can see TIA vs Linear (4-bit) will result in many value errors that are nearly the full amplitude of that lowest bit. This is why I think non-linear inaccuracy is the biggest fish, and adding dither without this fix will (for most values) add the random noise without getting the benefit of covering the errors. The 5-bit graph shows the error is even worse, owing to the increasing rounding that happens as the combined values get higher. 2 Quote Link to comment Share on other sites More sharing options...
Sheddy Posted December 11, 2017 Share Posted December 11, 2017 (edited) Deleted. Irrelevant Edited December 25, 2017 by Sheddy Quote Link to comment Share on other sites More sharing options...
+rbairos Posted December 12, 2017 Share Posted December 12, 2017 What kind of dithering? Random? The last posted samples, are just quantized to the bit depth (using floor). Using (round) was less audible. I then introduced some random noise (with even distribution) before quantization, sounded hissy. I think I read the random distribution is supposed to be triangular or something. I also tried a dithering algorithm I guessed at, where I took the difference and either added it all to the next sample, or split up at various weights over the next 3 samples. Its mostly guess work on my part so far, so Im sure Im forgetting some important steps. I think PWM or something similar was what my 1990s 1-bit speaker were playing. They were surprisingly clear from what I remember. Quote Link to comment Share on other sites More sharing options...
DirtyHairy Posted December 12, 2017 Share Posted December 12, 2017 (edited) I have played around with this some more and built a driver that plays 510k of packed 5bit samples. Attached are two ROMs (again 3E banking) that play an ascending scale starting at 110Hz using a sinus that uses the full sample range from 0 to 30. One file (test_linear) has been created using naive quantization, the other (test_nonlinear) corrects for the TIAs nonlinear response. To my ears, the nonlinear version sounds cleaner, while the linear one exhibits a ringing effect. Note that I have used Stellerator for comparing the two; I haven't yet managed to get those ROMs (or ZackAttack's for that matter) to run on a Harmony encore. My next step will be to write code that resamples and packs a WAV and run this on rbairos 8bit samples for comparison. As a reference, I have attached the driver (assembles to 2k that go into the last bank aka the last two kb of the 512kb image) and a dirty piece of javascript (run with NodeJS) that generates the sample data. I'll be writing a proper tool to convert the WAVs, but the JS documents the (hopefully correct) algorithms I've used EDIT: If you want to play with the playback driver yourself, note that the first three bytes of each bank (=2048 byte block) are ignored, so there is room for 2045 * 255 * 8 / 5 = 834360 samples before it loops. test_linear.bin test_nonlinear.bin driver.asm driver.bin generator.js.zip Edited December 12, 2017 by DirtyHairy 3 Quote Link to comment Share on other sites More sharing options...
ZackAttack Posted December 12, 2017 Author Share Posted December 12, 2017 Note that I have used Stellerator for comparing the two; I haven't yet managed to get those ROMs (or ZackAttack's for that matter) to run on a Harmony encore. Harmony doesn't support larger 3E roms. You have to make it 32k and give it a .3e extension to playback on harmony. Eventually I'm going to enable playing back samples from the SD card and then we can really have some long audio clips. 1 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted December 12, 2017 Share Posted December 12, 2017 The Harmony Encore supports up to 512K, most likely the 3E driver needs to be updated. Quote Link to comment Share on other sites More sharing options...
DirtyHairy Posted December 13, 2017 Share Posted December 13, 2017 The Harmony Encore supports up to 512K, most likely the 3E driver needs to be updated. Yeah, that's what I thought, too. I guess I'll ask Batari directly whether the driver could be updated. Quote Link to comment Share on other sites More sharing options...
ZackAttack Posted December 13, 2017 Author Share Posted December 13, 2017 The Harmony Encore supports up to 512K, most likely the 3E driver needs to be updated. That's what the website says, but do you know of any 512KB roms that actually work on it? Either way it's probably best to just read in the data directly from a file on the SD card. Then you can have up to 4GB in a single file. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted December 13, 2017 Share Posted December 13, 2017 Don't know of any, I hadn't looked into it before as I didn't have the Encore. I picked up one at PRGE but have been taking a break from 2600 stuff since then as I'd neglected other things in order to wrap up Draconian. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.