You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Space is at a huge premium on the teensy platform. Without any added storage (e.g. on a microSD card), code has to fit inside 512Kb, and RAM maxes out at 256Kb. So the entire thing, even during runtime, has to squeeze inside three quarters of one megabyte.
Full screen 128x64 black-and-white bitmaps take up 1Kb each (exactly 8192 bits). So if we’re supporting bitmaps across six octaves, 12 notes each, and DoReMi versions… we’re looking at 144kB of our precious space just for the images.
The solution? Break up the bitmaps. We can draw bitmaps on top of bitmaps. To make all the staff images, for example, I’ll make three different bitmaps for the staff in different positions, and then a 7x7 note bitmap that I can draw on top of each one to make the different notes. Similarly, I can make bitmaps for the 7 letters A-G in a large and small size, a sharp symbol, a flat symbol, and numbers 3-8 images, and put them together to make the different notes. That’ll boil 144 unique images down to less than 40 not-full screen bitmaps and will be MUCH smaller.
But the rub is that now displaying them is more complex. Need to work out logic to construct each note’s image instead of just asking for that-one. More code, less drawing bitmaps.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Space is at a huge premium on the teensy platform. Without any added storage (e.g. on a microSD card), code has to fit inside 512Kb, and RAM maxes out at 256Kb. So the entire thing, even during runtime, has to squeeze inside three quarters of one megabyte.
Full screen 128x64 black-and-white bitmaps take up 1Kb each (exactly 8192 bits). So if we’re supporting bitmaps across six octaves, 12 notes each, and DoReMi versions… we’re looking at 144kB of our precious space just for the images.
The solution? Break up the bitmaps. We can draw bitmaps on top of bitmaps. To make all the staff images, for example, I’ll make three different bitmaps for the staff in different positions, and then a 7x7 note bitmap that I can draw on top of each one to make the different notes. Similarly, I can make bitmaps for the 7 letters A-G in a large and small size, a sharp symbol, a flat symbol, and numbers 3-8 images, and put them together to make the different notes. That’ll boil 144 unique images down to less than 40 not-full screen bitmaps and will be MUCH smaller.
But the rub is that now displaying them is more complex. Need to work out logic to construct each note’s image instead of just asking for that-one. More code, less drawing bitmaps.
Beta Was this translation helpful? Give feedback.
All reactions