You should expect performance woes when incorporating polymorphism, STL classes and [possibly] giving the GC a lot of work!
Yes after doing some more tests, I’m pretty convinced the large amounts of virtual calls per sample are responsible for the crap performance.
But let’s not discuss that here (I don’t mean to steal the thread), I might start a new thread about that.
You’re making method calls per sample?! The mind boggles
I’ve got another version of the synth:
Soft clipping in the filter, much nicer sound when overdriven.
Improved waveform generation. There is more than one way to morph a saw into a square, hopefully this one will be a bit more useful.
Minor fixes. You could confuse it by holding a chord down when switching to porta mode!
Too much info: I’ve just had my ears “syringed” at the doctors (they stick a pipe in your ears and wash the wax out). it’s like I have a new pair of ears! These oscillators sure have a lot of “character” now (not that I think that’s necessarily a bad thing). I’ve been scouring the code looking for off-by-ones, but I think it might just be all the alias harmonics beating against each other
http://geocities.com/sunet2000/liquinth-a27.jar
Cheers,
Martin
Yes, the soft-clipping is what I was asking for and protects your speakers - having said that so does a low pass filter, not to mention that my amp will temporarily click off when the signal spikes.
Ah I thought you were referring more to the massive amplitude swings you got when sweeping the lowpass too quickly in the early implementations of the filter. Well, it’s all solved now
The clipping is actually performed after the filter, as it prevents it from becoming unstable, so the filter is not much help in softening the distortion. It does sound a lot more pleasant, now though.
I also balanced the waveforms a bit, as the square wave was distorting much more than the sawtooth. The area under a square wave is double that of a sawtooth, so I just halved the amplitude of the square.
Cheers,
Martin
You’re synth is getting better and better it really sounds very pleasant.
[quote]You’re making method calls per sample?! The mind boggles
[/quote]
My lib has different goals than your synth; the main goal was to be able to easily programmatically create any synth you want using the available modules, sort of like DigiDesign’s TurboSynth.
So yeah, every sample goes through more (interface) method calls per sample as you create more complex synths.
Maybe this is interesting to you:
http://jvstwrapper.sourceforge.net/
With that you could use your synth as a VST plugin
Very interesting, thanks! Yes, I think conversion to VST is the next job!
I don’t know how VST works, but if I’m guessing correctly it would also provide much better latency.
Cheers,
Martin
Well yes! Java sound does not go through DirectKS/WDM/ASIO, and going through the KMixer (that is used with DirectSound, etc) has a manditory latency of 20ms no matter what you do. By being a VST instrument you can utilize the output stream of the VST host.
Nice work!
Might be a stupid question, but is this synth capable of playing midi (.mid) files in software?
Not by itself, no. You can probably drive it from an external sequencer, though.
It just wrote itself
I don’t have Cubase, so I have no idea if it will work in the real thing, but I’ve included a copy of SAVIHost, and it works great in that! Just fire up the exe to test.
http://geocities.com/sunet2000/liquinthVST-jVSTwRapper-SAVIhost.zip
Latency does seem a lot better. I can’t believe I got this done so quickly …
Cheers,
Martin
Edit: Heh, I’ve just noticed the filter is causing denormalisation. See how the CPU usage doubles when things go quiet. I’ll have to look into ways of preventing that!
Well just think what will happen to latency if that VST host had ASIO. Try it in the great, but discontinued Muzys 3.0 demo!!!
Go to Tools->Plugin manager, then Options->Add Plugin and navigate to jVSTWrapper. You will see it operating at the minimum latency (with ASIO4ALL installed as an ASIO driver).
Actually SAVIHost does have ASIO (look in the wave menu under devices). It’s not a great interface if, like me, you don’t provide your own GUI, but it’s quite a nice little app, and somewhat cheaper than Cubase!
Cheers,
Martin
EDIT: No need for ASIO4ALL here, I have a DMX 6Fire
Oh yes it does! Well at least now you can (a) play it without delay (no pun intended) and also (b) use it in a real music project!!!
Cool! I’m running Cubase SX, so as soon as I found the time to pick up a new MIDI interface (I can’t connect my old one to my new system), I’ll definitely try it out
Working in both Cakewalk Home Studio 2004 and Sonar 6 SE…
Good to know!
I’ve added the GUI back to the VST version:
http://geocities.com/sunet2000/LiquinthVST-a30.zip
The jVSTwRapper libraries aren’t included in the archive, so you will have to download them yourself
Cheers,
Martin
Hmmm! I was always under the impression that the Java VST wrapper would not let you attach a gui! That means you can pretty much develop a complete Java Music Workstation hiding behind jVSTWrapper
In case anyone is still interested, here’s a new version with vastly improved sound quality. The oscillators now use a multisampling, which keeps aliasing under control without the overhead of oversampling. The overdrive now sounds much better. The previous method introduced a negative-feedback in the filter which made it a little less lively. There is also an improvement to the vibrato.
http://geocities.com/sunet2000/liquinth-a36.jar
Sorry to anyone I’ve not been in touch with recently … I really shouldn’t promise anything when it comes to coding.