Old 10-16-2020, 12:08 AM   #1
ymaresz
Human being with feelings
 
Join Date: May 2020
Posts: 95
Default Impluse

Hello

Do anybody know a way (jsfx or else) to create an short impulse (audio click) ?
Needed to test some reverbs..

Thank you
Yan Maresz
ymaresz is offline   Reply With Quote
Old 10-16-2020, 12:20 AM   #2
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Here's a single sample click:
https://drive.google.com/file/d/1-oB...doTv-zvY6/view
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 10-16-2020, 12:36 AM   #3
ymaresz
Human being with feelings
 
Join Date: May 2020
Posts: 95
Default

Thanks !
I have that too but I need it generated.

Y
ymaresz is offline   Reply With Quote
Old 10-16-2020, 01:23 AM   #4
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

Quote:
Originally Posted by ymaresz View Post
Thanks !
I have that too but I need it generated.

Y
You're in luck. I do this regularly and already made myself a JS. Let me know if it works for you.

Trigger with a MIDI note
Code:
desc:Impulse Generator

@init

i = 0;

@block

while (midirecv(offset,msg1,msg2,msg3))
(
  msg2 && msg3 ?
  (
    trig[offset] = 1;
  );
);

@sample

spl0 = spl1 = 0;

trig[i] ?
(
  spl0 = spl1 = 1;
  trig[i] = 0;
);

i += 1;

i == samplesblock ?
(
  i = 0;
);

Last edited by ErBird; 10-16-2020 at 01:34 AM.
ErBird is offline   Reply With Quote
Old 10-16-2020, 02:04 AM   #5
ymaresz
Human being with feelings
 
Join Date: May 2020
Posts: 95
Default

Yes !!
perfect

Thank you...

Best
Yan
ymaresz is offline   Reply With Quote
Old 10-16-2020, 08:52 AM   #6
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Quote:
Originally Posted by ErBird View Post
You're in luck. I do this regularly and already made myself a JS. Let me know if it works for you.
That works fine. Rather than that stuff with trig[offset] and samplesblock, you could do it with a couple of flags, perhaps more neatly.

Code:
@sample

fired ?
(
    spl0 = spl1 = 0;
    fired = 0;
);

armed ?
(
  spl0 = spl1 = 1;
  armed = 0;
  fired = 1;
);
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 10-16-2020, 10:30 AM   #7
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

Interesting. Are you saying to set armed=1 in @block?

I didn't test it yet, but I think among other potential problems you would lose sample-accurate timing doing it that way. "i" needs to be cycled through to make sure you're firing on the right sample within the block.
ErBird is offline   Reply With Quote
Old 10-17-2020, 12:40 AM   #8
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Quote:
Originally Posted by ErBird View Post
Interesting. Are you saying to set armed=1 in @block?
That's what I was thinking.

Quote:
Originally Posted by ErBird View Post
you would lose sample-accurate timing doing it that way. "i" needs to be cycled through to make sure you're firing on the right sample within the block.
You're right. My way would fire at the start of a block.
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 10-18-2020, 08:29 AM   #9
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Or, if you need it to fire sample accurate, allowing multiple impulse per block, and only for note-ons (rather than for all kinds of message, potentially)

Code:
desc:Impulse Generator 2
// after ErBird

out_pin:left output
out_pin:right output

@init

NOTEON = 0x90;   // Handy constant
armed[];         // Array of block offsets at which noteons are detected (need impulse at these points in the block)
i = 0;           // keep track of where this sample is in the block

@block

i= 0;

while (midirecv(offset,msg1,msg2,msg3))
(
  ((msg1 & 0xF0) == NOTEON) && (msg3 > 0) ?
  (
    armed[offset] = 1;  // where should we fire in the block - perhaps more than once
  );
);

@sample

spl0 = spl1 = armed[i];
armed[i] = 0;

i+=1; // count samples
__________________
it's meant to sound like that...

Last edited by jrk; 10-18-2020 at 08:41 AM.
jrk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:26 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.