Synthesizer
-
you can do this very easily using
setdrawtarget
so create an image to store your keyboard
setdrawtarget(mynewimage)
draw your stuff
then setdrawtarget(framebuffer)then to draw your keyboard
drawimage(mynewimage) -
@MikeDX Hi Mike playing around with this. Got it working and it's rock solid now thanks. But the behaviour seems different than the help shows it.
Pseudo explanation but if I do as help implies it works
Setdrawtarget (imagename)
Box
Circle
TriangleIt draws the box to the image but circle and triangle directly to screen.
I'm using loops in my program to draw keys but essentially had to do it like this.
Setdrawtarget (imagename)
Box
Setdrawtarget (imagename)
Circle
Setdrawtarget (imagename)
Triangle -
I'm going to test this. setdrawtarget shouldn't change ever (maybe update?) unless called manually.
i use it a lot in pacman for the different layers, but admittedly I don't use 2d drawing primitives much
-
Seemed to be using update in my loop that was making it change target Mike.
Update on the project. Now have all the black keys working and a 2d array that holds all the note and modulation values. You can cycle through each parameter with the dpad and change the parameters. Will work on sequencer next.
-
Very nice. 👍 Great job.
-
@sys64738 ooh what's YOUR friend code?
-
@Ancientspark not sure yet, I will share the project and friend code when I finish it
-
@sys64738 Kitty didn't like that last part. Did you see it hitting itself? :P
-
@Discostew yeah he face Palmed. At least he let me program that day instead of standing on the switch.
Small update.
Making good progress today. Have the 16 sequencer buttons drawn. Playing just a test note each step as the sequencer plays and lights up each step. Also made the sequencer buttons selectable by touch.
Amazing how much better you get just by iterating.
I looked at the 60 or so lines of if statements that works out the keyboard press locations and went ugh. Did it in about 4 lines for the sequencer. So might have to redo the keyboard code soon.Next up is expanding the 2d array to hold 16 patches instead of 1 and getting the sequencer to play through it.
-
Awesome work!
-
Phew the 2d array has been expanded, and the sequencer is semi operational! I've modelled it after the sequencer in korgs monologue synth but have already added some things it can't do.
you select a sequencer step (when its red its currently selected) and press a note on the keyboard and records that note as well as every other setting like wavetype, modulator frequency into the corresponding column in the 2d array, so this means it can not only record a note in each step but an entirely different sound (this is how the sidchip on c64 did so much with only 3 voices) which is currently mostly working but I need to sort out a few niggles.
So when you select another step you will notice the last one you set is green, when the sequencer is playing it only plays the green blocks, the white blocks can be considered rests (though they can and do hold data and notes) you can toggle blocks on and off as you see fit, even while the sequencer is playing. This allows some progressive melodies in live performances.
Heres a video showing the basics of the sequencer
next up I need to work on a step recorder, so it just automatically fills in the notes to the sequencer blocks as you play, also need to fix some minor issues and niggles. Hopefully in the next video I'll show how it can play through 16 different patches.
-
@sys64738 Really nice progress on your project! I'm playing around with doing a sequencer as well, but my approach is very different to yours. I very much enjoy seeing multiple solution to the same task.
-
@Nisse5 I've used trackers back in the day. Aswell as a few of the modern cubase type things but hardware synths is my passion. Be interested to see how you do it.
I'll try a more hands on classic synth after this one that plays 3 voices easily at once more in line with the vibrato stuff you were doing. Probably take me a few more weeks to get this one finished. As I want the 16 block sequencer to work individually for all 16 channels at which point it's going to need the ability to load and save songs.
-
I have fixed most the niggles in the sequencer, added some simple modifiers to when your adjusting some parameters with the dpad so it doesn't take forever to get to speed 500! anymore, no step recording yet but I did finish the patch per step. In the video I have quickly edited in 16 patches using the dpad before recording. if you select block 6 to make it red, it will also switch to patch 6 which you can then play on the keyboard, the last note you play will be recorded into the sequencer along with a snapshot of the patch. Have also been inspired by Nisse5 to display the patches in code format in case you want to use one in another project.
So even if you don't want to use the sequencer to automate music you can use it to select 16 different patches.
Which leads to the problem of, hey I made a really cool patch on block 1 but when I select block 2 it's gone? So next I will implement a "patch lock" if you toggle on patch lock it will keep the current patch no matter what block you select and it will also record the patch to the new block, this way you can use all one patch, copy patches, use a mixture of new patches and copied patches.
I think I will leave it with the single voice and sequencer for version 1.0 and share that soonish, so people can play with it while I learn 3d arrays and filesystem stuff
-
Patch Lock is completed, I got a bit sidetracked and added random patch button, I feature I love on one of my hardware synths. It made mostly garbage sounds so I've added some code to so that it mostly will make a nice sounding a patch but still has a lesser chance of going a bit more wild on the parameters, it's made a couple of real nice sounds for me, I had to take a photo of the displayed patch code for later use! I also added another feature from real synths, they generally have a pitch wheel or ribbon to the left of the keyboard, so I've added that in.
Here is the video, it's actually quite fun to mess around with.
Which leads to some bad news and some good news, as I get more and more complicated the code the arrays are not seeming to cope and trying to find workarounds to bugs that make no sense seems time not well spent. the newly added randomizer, which you would never want to press while the sequencer was running, would you? would you!? well it crashes the synth. Timer for the sequencer just seems to bug out the arrays when it's running. On the other hand the pitchbender would be a blast to use while the sequencer is playing, imagine how much fun that would be but nope, array once again no longer recognises itself if the timer is running and crashes if you touch the pitch bender.
I would normally not ever post or publish code that I know can crash, I could disable these features while the sequencer is running to prevent the crashing but I'm hoping this is just a temporary issue with the fuze software, or even something I've done wrong. So the bad news is, I'm going to leave it using a single voice with a single sequencer until the array bug is resolved. The good news is, it's almost finished, if I didn't spend so much time writing these giant posts I'd have finished it already.
I am going to add keyboard tracking (what Nisse5 called Ratios) that increases the modulation frequency inline with the frequency changes from pressing keys, this is a pretty standard thing on real synthesizers, might make it a toggle , we'll see.
and then I'll add the step recorder, clean up the code and make sure it has lots of commenting and share it with my friend code. Next post here will be the finished program.
-
This is above and beyond. I can't believe what you've done in the time you have. Congratulations on your incredible work, I'm so glad you got the product. Very excited to see the final result. I'm dying for a go on this!
-
@Dave thanks so much! I have finished the synth.
Will post a video overview and share the program tomorrow. Is nice to be programming again.
-
As promised, I'm calling this version 1.0 and sharing it, I will fix or change the BPM as it's only barely working though.
There is a new video showing the new features.
Here is a list of controls and features, the synth is monophonic, you play one note at a time, it does not support multitouch or chords (maybe in the next one)
D-pad - up and down cycles through the parameters of the sound and modulator, you can press right or left on these to adjust, if you want to make a sound (patch) from scratch you can.A button - starts the sequencer playing, if it finds a green block it will play the sound stored in that block
Y button - stops the sequencerTouch ribbon - the black area to the left of the keyboard can be used to bend the pitch of the note
BPM - triangles on the left cycle the BPM up and down poorly!
Randomizer - just press the yellow square to get a random new sound!
Step - recorder - if this is red it's in record mode, any notes you play will be saved into the sequencer blocks automatically
Patch lock - lets you use your current sound on another block on the sequencer, if you want a different sound on a block, disengage the patchlock then select the block
Sequencer - the sequencer holds 16 sounds, if a block is white the sequencer will not play a sound as it passes over it, if it's green, it will play the stores sound, you can toggle a block from green to white simply by pressing it, your currently active block will have a small red square in it, which should be the last block you pressed, if selecting a block untoggles it from green to white and you wanted it to be green, just press it again. while the sequencer is not playing in note you play will be recorded into the block with the red square, any adjustment to parameters with the dpad, will be adjusting the sound in the block with the red square.
Known bugs - it seems very stable when the sequencer is not playing, and generally will not crash unless you use the touch ribbon or randomizer while the sequencer is playing.
friend code is in my signature, love to hear some feedback.
-
No update to the code, though I did get around to making a musical sequence to show the sort of thing I envisioned the synth could do.
I have about 10 more synths in mind to make, so probably start again from scratch.
-
Most excellent! I'll add you right after my surgery is over and take a look. I'm a pianist myself :) I have a broken DGX-640 from YAMAHA but it's too expensive to repair so I'll have to buy a new one as I am terribly out of practice and really need to get back to my music. Thanks for the inspiration!