Share My Creation Mini Synth

Made a mini synth in B4J to investigate how it works with generated wave visualization.

Basically it has two oscillators (osc a and b) to generate signals according to a waveform shape of sine, pulse, saw and random noise and its frequency is determined by the music note being played. Each oscillator actually consists of two oscillators which will generate signals with a little bit different frequency, controlled by split, in order to generate more frequency components. The signals then mix together by add (osc mix) and/or multiply (ring mod). The mixed signal goes to a filter to change its frequency component, and then goes to envelope amp to change its volume.

The attack, decay, and release of the envelope amp controls that, after a key is pressed how long the volume will reach to max volume starting from zero, then how long it will decay to the sustain volume, and then how long it will decrease to zero after the key is released, respectively. The sustain means the volume level if the key is keeping pressed. Put sustain to zero will make sound release even the key is still being pressed, like a piano.

There is another oscillator (lfo) which will generate a sine wave in a very low frequency and use this sine wave to control the frequency of the two oscillators mentioned above, the cutoff of the filter, and the volume, to generate a vibrate effect.

With these limited controls, the number of sound types generated are also quite limited. However, it is interesting to see how signal changes through the visualization with limited parameters.

Right click on the knob control will reset a parameter to its default values.

Try: java -jar BxSynthMini.jar (Windows, Java 1.8)

----
Edit: Polyphonic version updated, see and use jar at post #11 with bug fixed and multi-input support.

minisyn.png
 

Attachments

  • BxSynthMini.jar
    369.4 KB · Views: 305
Last edited:

ilan

Expert
Licensed User
Longtime User
love it @kimstudio
you did a great job.
i would allow to use the keyboard to hit the keys than only using the mouse ;)
very impressive! ?

what libraries are you using?
 

stevel05

Expert
Licensed User
Longtime User
Very nice, do you plan to do anything else with it? Midi input perhaps?
 

kimstudio

Active Member
Licensed User
Longtime User
Thank you all for the kind comments.

i would allow to use the keyboard to hit the keys than only using the mouse
Midi input perhaps?
Currently the sound engine is in monophonic mode not polyphonic mode, which means there is only one instance of synth voice, if a new key is pressed and last key is still held down, the new sound will stop/replace the old sound. For PC keyboard or MIDI input, polyphonic mode must be supported as there may be multiple keys pressed at same time. I intend to add multiple synth voice instances like 8 or 16, and mix them together.
 

stevel05

Expert
Licensed User
Longtime User
f a new key is pressed and last key is still held down, the new sound will stop/replace the old sound
Yes, I remember the original monophonic synths when they were hardware :)
 

moster67

Expert
Licensed User
Longtime User
Very but very nice!
Next steps perhaps: midi input and VST/Audio plugin
 

kimstudio

Active Member
Licensed User
Longtime User
Polyphonic version update:
------------------------------
  • 8 voices polyphonic: 8 voices playing simultaneously
  • MIDI IN/PC keyboard/Mouse virtual keyboard input simultaneously
  • %CPU LOAD indicator added, POLY(number of voices current playing) indicator added. CLIPPING led added. Parameter display removed
  • Modify parameters in real-time while playing
  • OSC SYNC bug fixed
  • Areachart wave plot bug fixed
Due to 8 voices may sing together loudly, if the CLIPPING led flashes, turn down the VOLUME.

On my i5 2.5G the cpu load never exceeds 30%, internally almost all calculations are done in double type.

I also found my PC keyboard doesn't support all keys down at same time - although it is a game laptop. It becomes a tool to test PC keyboard...
PC keyboard mapping: 4 octave do re mi fa so la si from low to high, no piano "black key" mapped.
"Z", "X","C","V","B","N","M", _
"A","S","D","F","G","H","J", _
"Q","W","E","R","T","Y","U", _
"1","2","3","4","5","6","7"

MIDI IN works on my SAMSON MIDI keyboard, not sure about other devices. Thanks @stevel05 for the MIDI IN part from his JavaxMidi lib.

Try: user the jar attached within this post.

minisynpoly.png
 

Attachments

  • BxSynthMiniPoly.jar
    396.6 KB · Views: 243
Last edited:

ilan

Expert
Licensed User
Longtime User
looks awesome, are you going to share/sell the source?
how are you generating the sound?
 

pixet

Member
Licensed User
Longtime User
I can't run, it keeps telling me "Error: JavaFx runtime components are missing, and are required to run this application".
I have in my enviroment and in the path jdk11 and jfx.
Any suggestions to solve?
 

stevel05

Expert
Licensed User
Longtime User
I guess you will need the Java 8 JRE (run time) installed to run it.
 

ilan

Expert
Licensed User
Longtime User
I can't run, it keeps telling me "Error: JavaFx runtime components are missing, and are required to run this application".
I have in my enviroment and in the path jdk11 and jfx.
Any suggestions to solve?

use command prompt:
Try: java -jar BxSynthMini.jar (Windows, Java 1.8)
 

kimstudio

Active Member
Licensed User
Longtime User
how are you generating the sound?

Basically the oscillator generates periodic waves continously, which is sound, and the filter and other components changes the morphology/frequency components
of the waves for different kinds of sound.

This page has a good explanation: subtractive synth
 

kimstudio

Active Member
Licensed User
Longtime User
For sound generation I remeber there was a nice example to generate sine wave with different frequecies and play it as audio in the forum, also I shared one Karplus algorithm based guitar sound synthesis in the forum. I searched audio as keyword and read almost all related posts before but may miss some examples.
 
Top