SynthMaker

How to Retrig an Impulse?

Archive · 2010 13 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

DigitalWhiteByte ·

I tried in various ways, but how to reset an impulse? 😊

streamout out; float impulse=1.0; out = impulse; impulse = 0.0;

Disco_Steve ·

how would you like it reset? on a click? on a tick? every X samples. you know about the impulse module? it re pulses whenever the code changes. but is white only

DigitalWhiteByte ·

I wish I could generate a impulse with a button, without resetting the audio processing, I'm using the primitive clear udio, but this also resets the other running voices.

MichaelBenjamin ·

this might work: streamin switch;//true/false 0/1 switch streamout bang;//1 sample with val=1 on transition from false to true float lastswitch=0; out = 1&(lastswitch<switch); lastswitch=switch;

DigitalWhiteByte ·

Excellent, it works fine, but do not know why but does not act the same way as a primitive impulse. 🙁

MichaelBenjamin ·

never used the impulse primitive, but i would guess it outputs 1 on initialisation with no way to retrigger other than shutting down/re-enabling the stream in blue or triggering a new voice that is not stolen in white. so how does the impulse primitive act, bzw for what do you need it?

if the impulse primitive works on stage 0 and you use that stage further on, the code above i guess puts out zero at stage 0, so maybe thats the problem.

trogluddite ·

DigitalWhiteByte wrote: does not act the same way as a primitive impulse.

Cause and effect.

Michael Benjamin's code sends a pulse on demand (when swtch is pressed etc.) which can then be read by your other modules so that they can act upon it - but you will have to code that behaviour for yourself into whatever modules require it.

The impulse primitive sends a pulse whenever the code is initialised - so either on load, a clear-audio event or whenever a selector or multiplexer changes the routing of streams. But that kind of initialisation has other effects too - the main one being that it will cause all code modules to return to stage(0). These effects are not caused by the impulse, they are a side effect of the initialisation (that just happens to also trigger the impulse primitive).

But that isn't the same as clear audio - although the streams go to stage(0) on initialisation, there is no clearing of buffers or resetting of variables unless you have coded a stage(0) to explicitly do that.

Clear audio is a truly thorough reset that really does reset every active stream to zero.

oddson ·

Sorry if I haven't read this thread carefully enough... (that it's already answerwed or I'm missing the actual question).

If you want an impulse an audio stream from a green trigger use a MIDI event to initiate a white stream. I know I've done this. I don't remember if you can use the stage() to make the impulse or if you need a varaible like the code examples above.

I have a working example I used to use to test reverb experiements... I'm just not at my SynthMaker machine right now.

EDIT - I see MB's post likely does the same thing only it's simpler. Come to think of it that might be how mine worked as I'm not sure I needed a white stream. But if you do then the MIDI Event primitive is your way to go.

oddson ·

So I looked at how I'd done this before... looks like I did use MIDI Event.

But the code is dead simple:

streamin in; streamout out; float out1; stage(0){ out1 = 1; } out = out1; out1 = 0;

tektoog ·

Hey, I also need to retrig an impulse but it seems I hit the same stone as DWB in this thread: Tiker 1000 Real or Illusion? I tried many ways also, but failed... Then I saw this piece of code but I can't get it to work... Could someone post an example of how to insert this in a schematic in order to retrig the Tick Prim always needed to convert the poly stream to green... Thanks...

trogluddite ·

tektoog wrote: in order to retrig the Tick Prim

The code posted earlier does the opposite thing - it can create a stream impulse from a green trigger input, but it can't be used to convert stream->green - you would still have to rely on a ticker to sample the value. The tickers can't be synchronised or reset with a stream signal - they are part of Windows timing system and run on a completely different CPU thread.

lesobrod ·

trogluddite wrote: The tickers can't be synchronised or reset with a stream signal - they are part of Windows timing system and run on a completely different CPU thread.

Yes, in my recent work I tried to replace some complex trigger' schematic by piece of Code and connnect it with greeen lines. No use.. 🙁 In fact, there was no errors or contradictions and in some ways it works - but very strange and unstable.

tektoog ·

trogluddite wrote: The code posted earlier does the opposite thing - it can create a stream impulse from a green trigger input, but it can't be used to convert stream->green - you would still have to rely on a ticker to sample the value.

Sorry I didn't explain myself correctly... I meant the opposite like you mentioned... Thanks for putting it with the right words! So What I found out is that filling up an array (float,string, etc...) actually slows down any kind of counting in S|M, will it be stream sequencing, green counters, sliders.... I knew that already when using a 4096 wavetable, but I thought it was more related to the audio part, I would never have thought it would do the same with text, to the point where a stream counter (poly/mono) running at 160 BPM would end up at 1.6 BPM after 2000 entries filled up in a string array... I thought it was related to the ticker translating into green vanishing with time... So in my schem it was not...only the array becoming bigger and proportianaly slowing down the whole schem.... be it green or white... So I ended up splitting the array in smaller parts and clearing it after data has been read...

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.