Sample Start From First Transient?

carltaylor43's icon

Hi guys... kinda new to Max... ive come up against a problem

Basically ive got my mic set up and im wanting to record some audio in and then have max automatically set the sample start from the first transient so that there is no 'dead air'.... is there an easy way to do this? Ive looked round on the forum and on the net only thing I can find is people saying how hard it is to get max to do this

Thanks in advance

Carl.

Mike S's icon

you could use peakamp and a [> threshold] type of thing, though this isn't strictly transient detection, but more peak detection. if the first transient is important and not just a trigger to start recording, you would have to do some jiggery pokery with buffers to record at a time before the transient occurs.

Tim Lloyd's icon

Have you tried the [bonk~ ] external?

carltaylor43's icon

it isnt a record trigger as this will be done via a midi button press (wiimote) - rather a way of max effectively truncating the start of the sample to get rid of the gap between the button press and the wanted audio.... the process will go something like this

1. Press button on wiimote to begin recording
2. shout into mic a couple of words
3. Max then get the sample ready to be triggered at the start of the audio by looking for the first transient and then setting that as the start point
4. press another button on the wiimote to trigger sample

ive looked at Bonk... i cant get my head around what its for :( it doesnt seem like you put audio through it... or am I wrong??

will have a look at peakamp....

thanks a lot guys :)

carltaylor43's icon

peakamp~ doesnt look like it will do the job as its only reporting what the highest peak was not when.... also i dont really want the highest peak... just first bit of 'meaningful' sound coming from the mic... am i still on the right lines asking for transient detection???

Mike S's icon
Max Patch
Copy patch and select New From Clipboard in Max.

something like this

carltaylor43's icon

thanks for the reply... unfortunately i have no idea what im supposed to do with that patcher.... ive copied it into my project... but what do I route to what? ive clicked on the help files for the objects but i have no clue

BTW this is what my project looks like so far...

carltaylor43's icon
Mike S's icon

that was just a sketch to give you an idea. I'll try and fill it out tomorrow

Roman Thilenius's icon

if one is sure that there are no clicks and crackles in the line, one could even just
use maximum~ 0.25 to find the first occurance of a somewhat louder (- 6 dBA) sound.

+~ 0.25 , zerox~ will also do.

carltaylor43's icon

thanks for the replies again guys...

right... here goes....ive been at it for 2 hours and cant get it to do what i want... After seeing the zerox~ object ive changed my tactic from:

'automatic trimming of a sample already recorded'

to

'trigger sample record from a set signal threshold'

if you see this pic... you can see that im trying to get zerox~ to output a bang when it receives a signal... at the moment its outputting a bang when there is not signal (when i take the cross out of the audio on/off box)... seems backwards logic to me... obviously im doing something wrong :(

Mike S's icon
Max Patch
Copy patch and select New From Clipboard in Max.
carltaylor43's icon

wow! can I just say I love you :) works like a dream....