Envelope Control module not sending correct Stage

Discuss suspected defects before submitting a bug report

Moderator: electrogear

Envelope Control module not sending correct Stage

Postby mwvdlee on Mon Mar 29, 2010 7:27 pm

It is my understanding that the Envelope Control sets it's "Stage" output to 1 for every new voice and every retrigger for exactly one sample.

This does not work. (tested in 1.1.6)

I've hooked up some counters in my schematic, one that counts all the "stage(0)" executions in code, one that counts the number of times that the Envelope Control sets "stage" output to 1. The "stage(0)" code is executed more times than the "stage" output is set to 1. I don't know about retriggering since I have not yet found a good way of testing this, but for new voices this is definitely the case.

Here's a reproduction:
envelope_stage_bug.osm
(7.64 KiB) Downloaded 297 times

The bug only seems to appear with REAL Midi devices, not the "PC keyboard".
After some time of playing Midi notes, the two counters become unequal. The bottom one (1's generated by the Envelope Control) will be a bit less than the top one ("stage(0)" counter).

This means poly retriggering doesn't work.
My current top SynthMaker bug:
    1. MIDI Input issue (showstopper, no workaround)
    2. All my previous bugs in SM1.7, because bug 1 makes SM2 worse than SM1.7
User avatar
mwvdlee
smanatic
 
Posts: 552
Joined: Thu Dec 03, 2009 8:42 am
Location: NL

Re: Envelope Control module not sending correct Stage

Postby MichaelBenjamin on Tue Mar 30, 2010 11:47 am

i cant test this atm, but stage 0 only gets executed when a channel is empty, not when a voice gets retriggered on the same sse channel.
also stage 0 only gets executed with internal variables in the code box, the outputs from the m2v and green inputs, every other stream data doesnt exist at stage 0 and starts with stage 1
viewtopic.php?f=2&t=8676&st=0&sk=t&sd=a&hilit=stage+0+retrigger
User avatar
MichaelBenjamin
smaniac
 
Posts: 1439
Joined: Thu Jul 12, 2007 3:26 pm

Re: Envelope Control module not sending correct Stage

Postby stw on Tue Mar 30, 2010 1:32 pm

mwvdlee wrote:It is my understanding that the Envelope Control sets it's "Stage" output to 1 for every new voice and every retrigger for exactly one sample.

This does not work. (tested in 1.1.6)

This means poly retriggering doesn't work.


I gave my very best to reproduce that error. But gave up after reaching more than 2000 ticks without any glitches.
So i can't confirm the faulty retrigger. Tested with 1.1.7

@MB: You're right that was my first idea too. But if that would cause the error the stage(0) counter should be less than the env counter. But it seems to be the other way round.
stw
smanatic
 
Posts: 641
Joined: Mon Jun 30, 2008 2:55 pm

Re: Envelope Control module not sending correct Stage

Postby malc on Tue Mar 30, 2010 2:08 pm

MB is right, stage(0) only gets executed when a channel is empty. If the same note is triggered continuously then the same channel will be reused so long as the release has not completely played out.

You have a very short 1000 sample envelope in that schematic. If you manage to get two plays of the same note within that 1000 sample window then it will skip one of your stage(0) counts. Increasing to a larger number of samples should make it even more likely for this to occur.

EDIT:
Just noticed what stw highlighted about the bottom counter being less than the top one. That would be strange. I haven't been able to make that happen. As you can see from the above I was observing the top one being less than the bottom.
User avatar
malc
smychopath
 
Posts: 3111
Joined: Tue Sep 07, 2004 11:17 pm
Location: UK

Re: Envelope Control module not sending correct Stage

Postby malc on Tue Mar 30, 2010 2:25 pm

Now I can make it happen.

Using the PC Keyboard all I need to do is drag my finger from Q across the keys to I.
User avatar
malc
smychopath
 
Posts: 3111
Joined: Tue Sep 07, 2004 11:17 pm
Location: UK

Re: Envelope Control module not sending correct Stage

Postby aliasant on Tue Mar 30, 2010 2:46 pm

malc wrote:Now I can make it happen.

Using the PC Keyboard all I need to do is drag my finger from Q across the keys to I.


Confirmed. The faster I drag the bigger the diff.
My result now is 56 on the upper and 46 on the lower.

This was using ASIO DirectX Driver with the ASIO Out. (This is something installed with Cubase I think)
When I switched to my MOTU Audio ASIO I got very little diff.

It seems to me the bigger the lateny is the bigger the difference?
Tried setting my motu asio latency to 96 samples and I couldnt get any difference.
Then swapped the latency to 1024 and it was easy to create the diff...

When I tried playing from my midi keyboard using Motu ASIO 1024 it was quite hard to get any diff at all. Had to play extremely fast and I only mangaged to get 58vs56
It's never to late to be late.....
http://martinrodensjo.smugmug.com/
User avatar
aliasant
smunatic
 
Posts: 2388
Joined: Sat Dec 30, 2006 5:49 pm
Location: Sweden

Re: Envelope Control module not sending correct Stage

Postby stw on Tue Mar 30, 2010 3:00 pm

aliasant wrote:It seems to me the bigger the lateny is the bigger the difference?
Tried setting my motu asio latency to 96 samples and I couldnt get any difference.
Then swapped the latency to 1024 and it was easy to create the diff...


Yes! Confirmed here too. With big buffers the error occurs easily. With smaller ones way less ore never.
I got my first error with a buffer >192 samples
stw
smanatic
 
Posts: 641
Joined: Mon Jun 30, 2008 2:55 pm

Re: Envelope Control module not sending correct Stage

Postby MegaHurtz on Tue Mar 30, 2010 3:59 pm

Guess it`s confirmed here too, I cant get it to fail on direct sound.
Aliassing.. No, Bad logics.. Yes.
User avatar
MegaHurtz
smaniac
 
Posts: 1610
Joined: Mon Aug 11, 2008 5:29 pm
Location: Eindhoven/Netherlands

Re: Envelope Control module not sending correct Stage

Postby mwvdlee on Tue Mar 30, 2010 4:31 pm

Well, atleast the confirmations mean I haven't gone insane when I noticed this ;)

From my own (inexact) testing, it appears the glitches occur when two midi notes are triggered shortly after eachother (or rather, nearly at the same time).
My current top SynthMaker bug:
    1. MIDI Input issue (showstopper, no workaround)
    2. All my previous bugs in SM1.7, because bug 1 makes SM2 worse than SM1.7
User avatar
mwvdlee
smanatic
 
Posts: 552
Joined: Thu Dec 03, 2009 8:42 am
Location: NL

Re: Envelope Control module not sending correct Stage

Postby MegaHurtz on Tue Mar 30, 2010 4:37 pm

Does it get threaded upfront?
Aliassing.. No, Bad logics.. Yes.
User avatar
MegaHurtz
smaniac
 
Posts: 1610
Joined: Mon Aug 11, 2008 5:29 pm
Location: Eindhoven/Netherlands

Re: Envelope Control module not sending correct Stage

Postby malc on Tue Mar 30, 2010 6:02 pm

Not sure what you mean by threaded upfront MegaHurtz.

It seems this happens when a note is very short so the note on and note off come before any code is executed. When the note off comes the stage is set to 4 (for release) and so when the code executes it starts at 4 and not 1.

You can see this in that schematic by setting up another output that sends the stage out when the stage(0) tick is counted (stage&(tStage==1)). Whenever you get a mismatch between the counters you'll see that the new counter is 4 times the difference.
User avatar
malc
smychopath
 
Posts: 3111
Joined: Tue Sep 07, 2004 11:17 pm
Location: UK

Re: Envelope Control module not sending correct Stage

Postby MegaHurtz on Tue Mar 30, 2010 6:53 pm

malc wrote:Not sure what you mean by threaded upfront MegaHurtz.


For the limited part I know about Asio,
is that it`s buffer is getting filled before the need to output it. hence the speedy startup.
Stages and stages.. But on a microcontroller stage 0 would yust boot once.
here using the shells is a bit different,
maybe theres some difference in the order of execution when you use an Asio driver,
where it overlooks the importance of the latter being pre-threaded aswell.
??
Aliassing.. No, Bad logics.. Yes.
User avatar
MegaHurtz
smaniac
 
Posts: 1610
Joined: Mon Aug 11, 2008 5:29 pm
Location: Eindhoven/Netherlands

Re: Envelope Control module not sending correct Stage

Postby mwvdlee on Tue Mar 30, 2010 8:14 pm

malc wrote:Not sure what you mean by threaded upfront MegaHurtz.

It seems this happens when a note is very short so the note on and note off come before any code is executed. When the note off comes the stage is set to 4 (for release) and so when the code executes it starts at 4 and not 1.

You can see this in that schematic by setting up another output that sends the stage out when the stage(0) tick is counted (stage&(tStage==1)). Whenever you get a mismatch between the counters you'll see that the new counter is 4 times the difference.

One way to solve this would be by making sure every poly runs for atleast 2 samples; stage 1 and 4; a bit of a hack.

Another way would be to have the Envelope Control send different/new stage numbers, but that would break compatibility.

Or perhaps a new Envelope Control with new (bit coded) stage numbers. Obvious downside is having 2 similar modules.

Or in cases like this, send 1 instead of 4. Would be fine for me (since I don't care about 3/4/etc, only 1/not-1) but I think many others WOULD mind :)
My current top SynthMaker bug:
    1. MIDI Input issue (showstopper, no workaround)
    2. All my previous bugs in SM1.7, because bug 1 makes SM2 worse than SM1.7
User avatar
mwvdlee
smanatic
 
Posts: 552
Joined: Thu Dec 03, 2009 8:42 am
Location: NL

Re: Envelope Control module not sending correct Stage

Postby MyCo on Wed Mar 31, 2010 2:50 pm

Hi,

just a notice to this behaviour: It depends on the buffersize of the audio driver. You can check that by lowering the latency settings of an Asio-Driver.

So I guess it has something to do with On and Off messages of the same note in the same bufferswitch event.
Some of my SynthMaker examples: TranceDrive, LoopDrive
or go directly to my Blog
User avatar
MyCo
smaniac
 
Posts: 1039
Joined: Mon Dec 19, 2005 1:43 am
Location: Germany

Re: Envelope Control module not sending correct Stage

Postby aliasant on Wed Mar 31, 2010 2:52 pm

MyCo wrote:Hi,

just a notice to this behaviour: It depends on the buffersize of the audio driver. You can check that by lowering the latency settings of an Asio-Driver.

So I guess it has something to do with On and Off messages of the same note in the same bufferswitch event.


lol


Look at mine and Tzarls posts higher up ;)
It's never to late to be late.....
http://martinrodensjo.smugmug.com/
User avatar
aliasant
smunatic
 
Posts: 2388
Joined: Sat Dec 30, 2006 5:49 pm
Location: Sweden

Next

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest