Envelope control primitive acts like a hog in "Hold" mode

For general discussion related FlowStone
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Envelope control primitive acts like a hog in "Hold" mode

Post by kortezzzz »

Hi people,

I have a problem with the sample player (Exo's one) that probably related to the evelope control. What I'm trying to do is to hold the sample until it's ends even if the midi note that triggers it has short duration. When I connect a "true" boolian to the "Hold"s green input, it does hold the sample until it ends correctly, but the CPU raises up and becomes quite ridicilous when the loop runs and even after the loop ends. It shouldn't be it's normal behaviour, or I'm wrong?

Does anyone has an idea what can cause this and how to fix it?
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by Spogg »

I'm not sure without seeing the schematic. Are you using an additional envelope generator anywhere else? Maybe set to a long release time? It sounds possible that you are getting multiple channels (voices) opened up for some reason. Or getting denormals maybe.

If you upload a schematic that shows the problem we can maybe offer more support...

Cheers

Spogg
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by kortezzzz »

Hey spogg and thanks for the reply,

Here is a little schematic that demonstrate the problem. It contains two midi note sequencers that play kick and snare samples (the credit for them goes to Billv). Each of them has a "note duration" knob and they both respond to the "Hold on" button which turns on\off the hold option of the envelope control primitive inside the wav. sample players.

You can clearly hear the pops and the clicks while the "Hold" is off and then hear clean audio coming out when its on (and see the CPU raises up).
Connecting a stock "adsr" instead of the envelope control primitive and setting it to long duration,sustain, release does make things better, but I wonder if its the best solution. Maybe there is any alternative dsp code made "envelope control" anywhere?
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by Spogg »

I had a look.

The problem is that for every NOTE ON, a channel is opened. Even though the sequencer sends a NOTE OFF, if an envelope is still running the channel will stay open, until the envelope prim is told to finish and therefore to close the channel.
This means that as the sequencer plays the CPU will continue to rise for every 4 notes sounded.

I've fixed this by substituting 2 modified Wave players which have an embedded ADSR, used for channel release only. This mod was by someone called C. Hackl and allows the whole wave to play once until the end, which is what's normally required for a drum sequencer. After playing the wave once and fully, the channel is closed.

I hope this helps out!

Cheers

Spogg
Attachments
(short midi note demo) spogged.zip
(1.18 MiB) Downloaded 998 times
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by kortezzzz »

Thanks spogg,

For some reason, the samples sound whird with this player. Like filterted\trashed or something. If those are our options, I prefer a simple adsr with a long release. The CPU "price" is quite higher, but I can live with it :)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by Spogg »

Just had a quick look and the players I added contain a different interpolation system.
You could just try swapping the interpolation modules over...

Cheers

Spogg
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by kortezzzz »

Ok, thanks :)

But wait... what is "interpolation"?

Sounds like one of those words that keep me far a way from dsp synthesis :lol:
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by Spogg »

There’s a lot of information out there about interpolation if you Google it.

Put simply, it’s filling in the gaps between known values with estimated values. The idea is to kinda smooth out the jumps in sample values to reduce audible artefacts without affecting the sound adversely.

But of course you don’t really know for certain where these intermediate values should lie so there are various methods for generating the “most likely” values. The simplest and cheapest method is linear interpolation which creates mathematically half-way values. I think of this as averaging.

Interpolation becomes important when a sample is played with a non-integer relationship between desired pitch and original pitch. In this case (of pitch variation) each scan through a table of values will land on different samples each time they are read out, since the sample number (index) is integer-based. You can’t specify half a sample position; it has to increment in whole sample positions (indices). So, for every increment of a sample counter the interpolation method will estimate what ought to be there, by looking at the samples either side of the fractional index.

You’ve probably worked out that if you only want to play back a sample at its native rate (or exactly doubled etc.) you don’t need interpolation, since the sample counter will always address an actual integer sample position. But if say you want reduce the apparent pitch of a kick drum you will need to interpolate; otherwise you’ll hear nasty inharmonic overtones.

If that brief explanation doesn’t satisfy, take a look online or maybe Martin could chip in with more details. For me the maths involved for anything other than linear is too painful.


Cheers


Spogg
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by kortezzzz »

Wow, thanks for this detailed comment, spogg :o
I really appreciate the contribution since I believe many others hadn't any idea what it means too.
Where can I find the interpolation part at the sample player's schematic?
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Envelope control primitive acts like a hog in "Hold" mod

Post by Spogg »

It's the module just before the output.

In this schematic I've put the original wave player's interpolation module in place of the one in the play-till-end one.

I had another thought:

If you only plan to play the waves at their native pitch then you don't need a precision counter either. This only becomes important with long wav files and/or where you wish to lower the playback pitch AND keep it properly in tune. Probably not important for short drums and unpitched sounds like cymbals. But it is important for pitched sounds like Bass etc.


Cheers

Spogg
Attachments
(short midi note demo) spogged 2.zip
(1.18 MiB) Downloaded 1032 times
Post Reply