SYNTHINGS is a digital synthesizer development platform that I've been building.
jason | 22 January, 2011 22:28
Well, I've had a few days off from this project - preparing for a week off work to take a micro milling machine and turn it into a CNC version (which will be used to make the lid for this project).
But today was quite productive - although I still haven't quite got as far as placing patterns on the screen.
The first thing I did today was try to work out why I was getting bad data transfers between the PIC and FPGA - which seemed to be getting worse (and was starting to get very irritating). I took the base board off the top board, and I saw that the contacts weren't very clean. Either the surface had become scratched way, or there was dirt on it. Luckily cleaning them with a PCB polishing block made them nice and shiny - and I haven't had problems since.
Next, I changed the numbering for the events in the main editor top and bottom, and I added the scroll bar into it (which involved finishing the horizontal scrollbar code). I also added in some of the tune meta-information - the name, composer, length, events per beat and beats per bar.
However, I still wanted to know the bar (and beat numbers) - so I extended the view menu to allow me to select whether I wanted to show the event number, beat:bar or beat:bar:event offset:
I then added an initial tempo value:
Editing these values was the next order of the day - and getting the screen to update after doing it.
This is with 4 events per beat, and 8 beats per bar (so effectively 32 events per bar):
Odd numbers can also be chosen (although the horizontal grid is set to a multiple of 16 - I won't be changing that!):
This is with 16 events per bar, and enabling the event offset in the time index:
As a bit of a distraction (while looking for some CNC bits I've lost), I modified the case I wanted to use to allow the screen to fit:
This was done by cutting part of the top rail down:
However, it needs to be cut down some more as the pixels aren't central.
I then wanted to have the capability to delete patterns if you'd created one. And also ask the user if you really wanted to:
I decided to allow the user to select what foreground colour to use for the pattern text, by adding a second colour option at the top:
And it was now time to actually begin the code to insert patterns into the tune. I extended the memory code to allow me to treat each object as a stream, and only pull off information that I needed as I go along. This is used by the tune plotting code (and will also be used by the playing code).
When you go into the pattern, it tells you what the current pattern is, where it is, how long it is, whether it's looped or not, and the voice number. If no pattern is selected, then it's blank:
I then needed a way to show the current position for placing the pattern. I decided that the horizontal lines between voices would be a very good place, since I wouldn't need to worry too much about redrawing the segments when the user scrolls. Two white lines are used to show the start and end of the pattern:
The rotary encoder is used to move the pattern left and right (and the bottom display updates to show the position):
If you go off the edge of the screen, it automatically scrolls back a few events:
Finally, I needed a menu to allow you to select how you want the pattern to be looped (as well as some other controls):
All that's left to do is actually do the insertions. In theory the plotting code is all done (it may need some tweaks).
And that was a lot for one day - and the new memory size shows it:
Program Memory [Origin = 0x200, Length = 0x2aa00] section address length (PC units) length (bytes) (dec) ------- ------- ----------------- -------------------- .text 0x200 0x13b8 0x1d94 (7572) .const 0x15b8 0x2946 0x3de9 (15849) .text 0x3efe 0xc956 0x12e01 (77313) .dinit 0x10854 0x29e 0x3ed (1005) .text 0x10af2 0x17c4 0x23a6 (9126) .isr 0x122b6 0x2 0x3 (3) Total program memory used (bytes): 0x1b114 (110868) 42% Data Memory [Origin = 0x800, Length = 0x7800] section address alignment gaps total length (dec) ------- ------- -------------- ------------------- .nbss 0x800 0 0x9ea (2538) .ndata 0x11ea 0 0x2 (2) _03854ee04d3aa7d3 0x11ec 0 0x200 (512) _038570704d3aa7d3 0x13ec 0 0x200 (512) .nbss 0x15ec 0 0x314 (788) .ndata 0x1900 0 0xf0 (240) .nbss 0x19f0 0 0xb0 (176) .ndata 0x1aa0 0 0x22 (34) .nbss 0x1ac2 0 0x4c (76) .ndata 0x1b0e 0 0x12 (18) .nbss 0x1b20 0 0x2a (42) .ndata 0x1b4a 0 0x8 (8) .nbss 0x1b52 0 0x1a (26) .ndata 0x1b6c 0 0x2 (2) .nbss 0x1b6e 0 0x4 (4) .ndata 0x1b72 0 0x4 (4) .nbss 0x1b76 0 0x2 (2) .ndata 0x1b78 0 0x2 (2) .data 0x1b7a 0 0x106 (262) .dconst 0x1c80 0 0x8 (8) .data 0x1c88 0 0xc (12) .bss 0x1c94 0 0x4 (4) .data 0x1c98 0 0x2 (2) .heap 0x1c9a 0 0x2000 (8192) Total data memory used (bytes): 0x349a (13466) 43% Dynamic Memory Usage region address maximum length (dec) ------ ------- --------------------- heap 0x1c9a 0x2000 (8192) stack 0x3c9a 0x4366 (17254) Maximum dynamic memory (bytes): 0x6366 (25446)
Over 6K added!