Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cliky Enveloppe #2

Closed
yoyz opened this issue Jun 23, 2015 · 5 comments
Closed

Cliky Enveloppe #2

yoyz opened this issue Jun 23, 2015 · 5 comments

Comments

@yoyz
Copy link

yoyz commented Jun 23, 2015

Hi Matt,

I have cut the helm engine to put it in my tracker, because this sound engine is really great.
I face an issue with the enveloppe.
When I trig sound really fast I end with clicky enveloppe. I think it is related to the way helm will reset the last used voice.
It is not a problem when you play 3 or 4 leads because you won't notice it. But if you play C2 at 120bpm you can hear it.
So I don't know which fix should be the best. Follow the last used enveloppe or use a free voice.
If I use a free voice I don't keep the monophonic way I want, so I think reused the last voice in a "monophonic" mode may be the best choice.
So any hint on your side should be good.

Regards,

Johann

@mtytel
Copy link
Owner

mtytel commented Jun 24, 2015

Hi Johann,

I'm assuming the amplitude envelope is causing the clicks, though I'm not sure under what settings you are getting this behavior. It would be really helpful if you could save a patch from the standalone app (download at tytel.org/helm) and send it to me at matthewtytel@gmail.com. Then I could give you some better information or fix the problem.

Here are some thoughts though:
This may not be the cause of your clicks, but you can have a 0 time attack. Many times I have a amplitude attack value of 0.01 secs when I don't want the click. When I play C2 the arpeggiator on the default settings at 120bpm, I don't get clicks.

Also, when engine runs out of voices and is not in legato mode, it will kill the oldest voice really quickly (not immediately) and then retrigger the envelopes. I need to test this 'kill time' on different sample rates, so that might be the cause of the clicks.

@yoyz
Copy link
Author

yoyz commented Jun 24, 2015

Hi Matt,

Here is the kind of patch used : http://ibin.co/26MP3PdWM5Nm ( amp attack at 0 )

I have try to reproduce the behaviour in "helm" and putting an attack of 0.03 resolve near all kind of problem I get, and it doesn't change "too much" the character of the sound, so it's great but I have to find why it works on the GUI and not in my case ( my tracker ). So you can close this issue because it doesn't really exist I will reopen it if I am able to produce it with midi gears.

I need to understand digging the code why for me, I fall into the "kill oldest voice" problem.
And I get click really easily which is not what I want obviously.
Because what I try to produce whith my apps is some kind of arpegiattor which will trig the note at 120bpm at 1/16th.
In the end it kill voice really aggressively the amplitude of the sound change and I get clicky enveloppe. raising the attack doesn't solve the problem in my case in the tracker. Raising the polyphony change the character of the sound I try to produce.
I though it was helm engine, but I think you have workaround the problem with the arpegiator, I will try to reproduce it with a midi which will trig fast helm, to see if this issue really exist.
So I think, you have done some black magic in the "arpegiator" and I need to understand what and how this is done :)

I call noteOn(note,velocity) and noteOff(note), getControls().at and in a thread 1.
I call process(), in a thread 2.
No really complicated stuff, so I have to dig mopo :)

Thank you

@mtytel
Copy link
Owner

mtytel commented Jun 24, 2015

Ah ok cool. If you're using the HelmEngine class, you shouldn't have to worry about killing the voices, should automatically be handled, but you can tweak how long it takes for a voice to be killed by setting the VOICE_KILL_TIME value in mopo/src/common.h. I don't think that's your problem though.

Another thing you might run into is that the internal values for envelope time (e.g attack, decay, release) are squared before they are used. So setting attack to a value of 0.1 gives a time of 0.01 secs. That said, if you set the attack to 0.01 directly it will give you an attack time of 0.0001 secs which will definitely click. I know some synths have a 0.01 sec minimum on their attack, but some people want the clicks in their patches so I left a 0 sec minimum.
I'm not sure how you are setting all the values, but you may try setting a longer attack.

I'm aware this is a little confusing, but these controls need to have linear internal values so we can modulate them with an LFO/Envelope. Then after adding the internal value to all modulations we do whatever scaling/skewing we want. For the attack/decay/release we want more resolution on the smaller time values and less resolution when they're longer. Quadratic scaling works well for this.

@yoyz
Copy link
Author

yoyz commented Jun 25, 2015

Yes I'm using the HelmEngine because it's the most easy way to plug to.
I juste rename it to avoid namespace clash with cursynth ( and maybe the issue is hidden somewhere here ).
But I think someway I have to worry about the voice and I don't understand why because when I build your gui it work.
I have try midi and I can't reproduce it in your code.
When I play sound with helm and there is a lot of space between note it play really nice sound no problem, but when two trig are too close it click.
And in my specific case it's clicky when I trig noteOn and there is already a sound play on a voice.
The attack reduce the problem but it does not fix it.
So I miss an obvious point somewhere.

Here is the waveform produce from my code when I do a fast arpegiator on sine wave : http://imagebin.ca/v/26OHKeXkS8sH
And you can see the sound reduce fast then change fast and this fast change make a click.
And here is the wrapper I use above your code : https://gist.github.com/yoyz/5d40afe16d6a908ef494
So I don't think I do too much tricky stuff.

void init() put the system in a default state
int tick() produce a 16bit sample,
setI(int what,int val), setF(int what,float val) modify your engine, with value sent between 0 and 127 and mapped according to helm_common.cpp.

So if you see an obvious misunderstanding or misconfiguration from this part on how to use helm engine just tell me.
I have work ten hours this week to track down this issue and I think I will need ten hours more to fix it and I really think I miss a concept on the engine.
Anyway a big thank you to share it, it's a great software.

@yoyz
Copy link
Author

yoyz commented Jun 25, 2015

I've found my issue.
I reset a variable when I call .reset() in my code. And it is called before I trig a noteOn. So when multiple note are played it click.
It is in anyway related to your code.
So thanks a lot for your tips and your hints, it help me a lot to speedup the resolution.

@yoyz yoyz closed this as completed Jun 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants