Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

mono stream synth

For general discussion related FlowStone

mono stream synth

Postby tulamide » Fri Apr 03, 2020 2:23 pm

Ok, I give up!

It takes me seconds to get a basic synth going: Midi in, midi to poly, set the module to only one voice. Done.

But when I want to go blue only, suddenly I can't get any sound out of Flowstone (other than the hidden triggering, when the schematic refreshes.

So, imagine a bunch of simple mono synths. OSC, Envelope, maybe filter. That several times, say 3 times for this example. Each oscillator has a fixed frequency that I provide with a simple float prim.

And now?

How to tigger them?

How can I get the midi signal (after some interpretation) to trigger either one, two or all three oscillators (each with their predefined, fixed, float-prim-provided frequencies), for that juicy sound I so desperately want?

Maybe I don't see the wood for the trees, but if someone could provide me with an example, I would not be embarrassed to admit that I won't have come to that solution ;)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: mono stream synth

Postby tulamide » Fri Apr 03, 2020 2:46 pm

Update:

If I use Ruby, connect midi in to it and run this code
Code: Select all
def event(i, v)
  if v.status == 144 or v.status == 128
    if v.status == 144 and v.data2 > 0
      output 0b1111_1111_1111_1111_1111_1111_1111_1111
    else
      output 0
    end
  end
end

and connect the float output to the trigger input of the stock envelopes, I get a sound.

BUT

Although I send 0 to close the gate, a new sound is only triggered when the envelope is gone completely through. It does not stop and restart on a new trigger, as I expect. AARRRRGGGHHHHH
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: mono stream synth

Postby trogluddite » Fri Apr 03, 2020 4:43 pm

Unfortunately, I can't upload again - but here are a couple of thoughts after having a bit of a tinker...

1) Do all of your envelopes have the 'gate' tickbox enabled in the properties panel? The gate input will be ignored otherwise! If you have more than one, they might interfere with each other if any are trying to access the "automatic" poly-voice activation.

2) Sending your binary value to a float output won't send a streambool true - the output will just be a normal 32-bit float representing the numeric value of that Fixnum (about 4.3 billion). However, you can get an "all-bits-true" bitmask as a Float (which is NaN) by using packing/unpacking (i.e. reinterpretation of bit-patterns, rather than number base conversion). As it involves several conversions via arrays and byte-Strings, it's best stored as a variable in the "init" method for re-use...
Code: Select all
@stream_true = [0xFFFFFFFF].pack('L').unpack('F').first

PS: It's strange how FS allows the green float to stream bool linking without having to force it. There is absolutely no normal green value which would automatically convert to a stream boolean correctly - not even a green boolean (which is really just an integer one)! The above Ruby or DSP/ASM are the only ways to do a proper bitmask conversion, and the bitmask value can be passed just as effectively via a normal stream float link. Streambools exists ONLY for the validation of connector types as defined by the designer - yet they will accept any old green floats, and won't convert green booleans properly!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: mono stream synth

Postby martinvicanek » Fri Apr 03, 2020 5:28 pm

I might have got it wrong, but I thought the intention was to implement it in stream, not poly. So here is how I'd approach it.

A slightly modified Ruby code:
Code: Select all
def event(i, v)
  if v.status == 144 or v.status == 128
    if v.status == 144 and v.data2 > 0
      output 1
    else
      output 0
    end
  end
end

and a stream envelope (connect the ruby output with stream input):
Code: Select all
streamin gate;
streamout env;         // envelope

float attack = 4410;   // attack duration (samples)
float hold = 22050;      // hold duration (samples)
float release = 44100;   // release time (samples)

float gate1 = 0;      // previous gate value
float time = 0;         // elapsed time (samples)
float denv = 0;         // envelope increment per sample

// start envelope on gate onset
env  = env & ((gate1 > 0) | (gate == 0));
time = time & ((gate1 > 0) | (gate == 0));
gate1 = gate;

// increment timer
time = min(time + 1, attack + hold + release);

// increment or decrement envelope
denv = (1/attack) & (time < attack);
denv = denv - (env/release) & (time > (attack + hold));
env  = env + denv;

// terminate envelope via truncation at -60 dB
env = env & (env > 1e-3) | (time < attack)


The envelope will be triggered at gate onset regardless of the current stage (and regardless of the note played). The release stage is exponential so after the "release time", the envelope will have decayed to 37%, not zero. Obviously it is not optimized.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: mono stream synth

Postby tulamide » Sat Apr 04, 2020 1:50 am

So I derped two times! First by creating a bitmask that isn't one. Then by trying to use it in mono stream. Yeah, I'm a solid pro :lol:

@trog
Thank you for the pack/unpack code! I will keep it for future applications! But as Martin pointed out, I derped, so please don't be disappointed from wasting your time :oops:

@Martin
Yes, I want the whole thing to work in the blue (mono) stream! I will check your example now, but already from reading I notice that it needs the envelope generator to accept this behavior, it cannot be forced, if it isn't in the envelope code. This thread belongs to my other one in the dsp subforum, and the envelope generator there already incorporates it. However, it would be awesome if you could have a look at it for a few seconds, just to check, if we are missing anything: http://www.dsprobotics.com/support/viewtopic.php?f=4&t=39767

Thank you both!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: No registered users and 63 guests