![]() |
Forum Index : Microcontroller and PC projects : PicoMiteVGA: some Entertainer-ment and some bugs (?)
![]() ![]() |
|||||
Author | Message | ||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
I appreciate the analog wizardry being discussed here - it's very educational - but I can't help but wonder if something like an MCP6004 plus a few simple passives would be simpler, more effective and maybe even more compact, especially if bulky inductors are involved. Visit Vegipete's *Mite Library for cool programs. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
It might be, but you still need board space for it and quite a lot of Rs and Cs. The problem is in getting a steep enough filter to get rid of 40kHz - which is very strong in the PWM output. You can't hear it directly, but it will cook the tweeters in your speakers. If you don't get the filter steep enough you hear the loss of high frequencies, particularly on things like cymbals which have a lot of high frequency content. A single, double or even three stage RC filter isn't steep enough. That's why we went for inductors. Volhout has experimented with smaller values (also physically smaller) but has found that a higher value works better (so far anyway!). By removing the "standard" filter, plus two resistors and the little link block I found enough space to fit Volhout's circuit (including the 2.2mH inductors and two 5% capacitors) onto the (pretty crowded!) PicoGAME pcb. It doesn't take up all that much more board space really and needs no additional power supply filtering. I've changed other areas of the layout, but not to do with the audio. And I still haven't needed to stand resistors on end, and I've lengthened the distance between all the resistor holes by 1.7mm since version 1.4. :) EDIT: @Tom - That's rather good! :) There have been a fair number of changes since version 1.4, never mind the prototype. It got to 1.4A (issued) then 1.4B, 1.5, 1.5A and now 1.5B. A lot of the changes have been subtle, but adding wireless networking and the new audio filter are pretty major additions, as is being able to use switch joysticks on both ports. Edited 2022-06-13 02:20 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Just ran on MMB4W, Tom. Very impressive. Maybe you should resign as a judge in the latest contest and submit this, so we'd have at least three entries. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
I had to play it again. True beepy loveliness. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5090 |
Mick, The inductor you picked is a bigger one (body size) but can be used as wel. For the best results with the RS inductor, use these values (theinductor you picked has higher Q factor, so it "peaks" more. Had to dampen it with capacitor values changes. With the 47n's it will also work, but with 33n/68n it is darn near perfect up to 18kHz. ![]() PicomiteVGA PETSCII ROBOTS |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5090 |
Hi Tom, The entertainer is very nice. 3 Voices...wauw... Sounds realy good. I only noticed that changing notes sometimes gives a clicking sound. Maybe that is because a note is cut off at the peak of a sine wave, and a new note is started at "0". Not sure if that can be fixed in any way. Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
Thanks, Volhout. Of course. if the RS component will fit so will a smaller one. That's a big plus. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Thanks Mick. No hurry; I've not had much time or energy recently to work on this and my 1.4 board is still sitting half-built at my soldering desk. TBH the board seems to be getting even more gold-plating than one of my programs and if there were an actual "market" it would probably be happy with a less flexible device. Nevertheless look forward to playing with it going forward. Thanks Lance. I think the kudos should go to Scott Joplin for the music and my wife for transcribing it for me. Whilst I could have done the latter it would have taken me a great deal longer than it did with her help. I believe that is against the rules, and I should know since I wrote them ![]() Thanks Harm. I've noticed that on the PicoGAME too (have you received the package I sent you?), but I can't hear it on MMB4W which is what I've been developing on. I had hoped it was a symptom of the issue that you have been trying to fix with the PicoMiteVGA audio filter, but from your post I'm guessing that isn't the case ? My computer/electronics audio knowledge is zero (much the same can be said regarding videogame graphics) and nothing obvious is occurring to me from the MMBasic side; I can't afford to do a lot of processing during playback as the whole point of this "sound engine" is to allow me to use an interrupt to play 3 channels of music and 1 channel of FX simultaneously with the actual gameplay on the PicoGAME (I don't think you can play sound FX alongside a .wav file on the PicoMite, and in any case I believe .wav playback requires the presence of an SD card). Perhaps something can be done to help with note transitions in the firmware ? or perhaps not. One thing I can look at which *might* help is that currently if multiple consecutive beats (actually half-beats) on the same channel are the same note then the engine still calls PLAY SOUND, this is unnecesary it should just let the existing sound play on. Best wishes, Tom Edited 2022-06-13 07:17 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
You can start a wav playing from SD and leave it to run in the background, setting an interrupt to trigger when that track has finished. I don't think it can play a wav from memory or flash though. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5090 |
Playing a wav. File from sd card while playing a game, and restarting it under interrupt, is what I did for my Tetris game on the F4 Maybe the clicking sound, containing higher frequencies, is more audible with my audio filter that does not attenuate 15kHz......so it makes it worse... You print the frequencies, and I see the highest is around 1.2 kHz Maybe it is caused by the way the "rests" are implemented. Maybe the PC has a different way of changing notes? EDIT: I noticed the "clicks" are a lot less prominent if you run the CPU at 252MHz. That may explain why they are not audible in the MMB4W, since the PC is much faster. Maybe the processing in the metronome beat (set tick) can be optimized to minimize the clicks. - remove print statements that (eventually) scroll the screen - pre-calculate the note frequency, you can do that outside the interrupt routine (actually now you calculate it 2x, once in the print statement, once in the PLAY SOUND statement). Use a lookup table or so (an array with pre-calculated frequencies, just feed it with the index that is the note number). You may be able to "time" the processing in the settick, to see what consumes most time, and tune that part for speed. Edited 2022-06-13 16:30 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
@Tom: I know it's getting rather complex, but the defaults are staying pretty much the same. What is happening is that there are more possibilities for those who want to take the board that bit further. The original concept was for a simple, boxed games console using the PicoMite VGA as the engine. It will still do that if you want (which is something of a relief!). The main changes are: It's easier to build as you don't have to be as cruel when forcing resistors into holes. You can use local wireless communication instead of a lead for networking. You have a much better audio filter (and no link block for headphones). You can get a small heatsink onto the TO220 regulator if you need one. You can fit a surface mount microSD socket as well as the other options. Most of the other changes are to do with board layout, sometimes to get the new bits in, sometimes because I thought it looked better. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Volhout, Yes, but my understanding is that if you are playing a .wav file on the PicoMite you can't use PLAY SOUND or PLAY TONE to play any Sound FX ontop of it - I would be pleased to be told otherwise ? That IMO makes it "useless" for videogame sound except intro/splash-screen music + you've got the storage issue if building a device with no SD card. Yes, I think that is it. I've experimented with playing notes outside (or at the edge of) hearing range instead and the clicks appear to go away, plus that requires less branches in the code. Plus a whole lot more software and hardware before it gets to driving a pair of I/O pins. Yes, there is a lot of room for optimisation. What I presented was implemented for readability/simplicity rather than speed. Removing the obviously unnecessary (for a game) PRINT statements has the biggest effect, but doesn't noticeably effect the sound quality. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Mick, it wasn't intended as criticism, only as observation. I'm curious as to what might be achieved by the "networking". With the hardwired null-modem approach I think it is just a system-link between two machines unless you introduce a dedicated server/switch box with more COM ports ? Is the same true with the wireless option. Incidentally I did start making a video of constructing a 1.4 in the hope of drumming up some more interest outside of TBS but it was very ropey and I'm no YouTube star; probably for the best if it never sees the light of day. Best wishes, Tom Edited 2022-06-13 20:15 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5090 |
Hi Tom, Another way is to play a valid tone with volume 0 Volhout Edited 2022-06-13 20:03 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
The wireless bit is identical to using a wire, it's just that it's fixed at 9600 baud by default and you don't need a null modem cable. It's a bit of a "ooh, this version has wireless!" thing. :) It might be useful if running a wire to the next room (or across the same one) was inconvenient. I had visions of playing Tank Battle or Battleships between kids bedrooms. lol Hmmm... it would be interesting to see what those outside TBS thought of it. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I have an existing note to investigate that, but it is potentially more "expensive" because it requires a branch/choice, e.g. if a rest was coded as note &FE = 254 ' frequency!(254) = 16.35 Hz (C in octave 0) n% = Peek(Byte music_ptr%) Play Sound 1, B, S, frequency!(n%), 15 vs. n% = Peek(Byte music_ptr%) Play Sound 1, B, S, frequency!(n%), Choice(n% = 254, 0, 15) Though CHOICE is not necessarily the most efficient branch mechanism on the PicoMite because it is not implemented in RAM - Peter, hint! hint! Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |