Is there a way to detect or calculate the 'end' of a sample?

Multi-platform modular music creation studio
Post Reply
Kid_lofi
Posts: 51
Joined: Mon Sep 17, 2012 8:13 am

Is there a way to detect or calculate the 'end' of a sample?

Post by Kid_lofi »

So i know 'audio directly on the timeline' has been a bit of a feature request for a while, but it's *almost* achievable already with a bit of trial and error. If I have a long sample which I want to play back across the timeline, I play the sample over and over again until I figure out where it ends (to within a step or two, i'm not always so patient to get it exactly) and then interpolate the sample offset 07 0000 to 07 8000 from the beginning to the end of the sample. This kind of 'burns to timecode', to borrow a video term. It sounds stuttery, because it's not exact, but you can just delete values you don't want so it only plays-with-offset at the beginning of every 'bar' or whatever you want.

Is there a better way of finding out where that sample ends apart form playing it over and over again and trying to spot the point where it stops playing?
Or, is there a way to detect 'total number of samples*256' so you could use 09 (set phase in samples) instead?

Or or, what if (actually, never mind, that's a feature request, i'll put it in feature requests)
This is a block of text that can be added to posts you make. There is a 255 character limit.
varheit
Posts: 2
Joined: Tue Oct 19, 2021 6:09 pm

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by varheit »

Maybe this is helpful:
Duration d[s] = 8 * Bytes / (precision * channels * samplerate)
For example: 16-bit stereo signal sampled at 48,000 Hz with a length of 345,678 Bytes: Duration is 1.8 seconds.

Number of lines for a certain duration d[s]:
NOL = d x BPM x 24 / 360
For example: At 125 BPM, a sample of 12 seconds will take 100 lines.
Kid_lofi
Posts: 51
Joined: Mon Sep 17, 2012 8:13 am

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by Kid_lofi »

My hero! I'll give this a crack and let you know how it goes. Hopefully can post an example.
This is a block of text that can be added to posts you make. There is a 255 character limit.
a1matt
Posts: 156
Joined: Wed Dec 28, 2016 7:39 pm

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by a1matt »

Kid_lofi wrote: Tue Oct 19, 2021 5:17 amIs there a better way of finding out where that sample ends apart form playing it over and over again and trying to spot the point where it stops playing?
I'm not sure what the use case is, so I'll list two options that I use in the hope something in here is of relevance to you...

For samples that don't need to be looped (eg you just want to match certain points of sample to the timeline):
If you go to: sampler module, edit, samples. From here you can see the waveform and where it ends. You can then tap on the waveform at the desired point and the offset is shown in this window. If you can't find the point then playback the sample while watching this window and observe the cursor position.

When I am working with samples that DO need to loop cleanly (Eg breakbeats) I adjust the 'relative note' and 'fine tune' parameters.

If you don't know the source bpm, this means manual adjustment while playing on a loop (gets quicker with practice).
If you do know the source bpm, you can calculate the values to adjust from source to target bpm.
Tempo transpose calculator here: https://mp3.deepsound.net/eng/samples_calculs.php

This transpose technique changes the pitch of the sample, which isn't always desirable.
Kid_lofi
Posts: 51
Joined: Mon Sep 17, 2012 8:13 am

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by Kid_lofi »

a1matt wrote: Wed Oct 20, 2021 9:51 pm tap on the waveform at the desired point and the offset is shown in this window
🤯
:Yahoo!:
This is a block of text that can be added to posts you make. There is a 255 character limit.
a1matt
Posts: 156
Joined: Wed Dec 28, 2016 7:39 pm

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by a1matt »

Great! I was hoping something in my wall of text would be of use.
hseiken
Posts: 175
Joined: Thu Jul 17, 2008 3:52 am

Re: Is there a way to detect or calculate the 'end' of a sample?

Post by hseiken »

I'm kinda oldskool, if there's a long audio sample, i just chop it up and recreate it where it should be timed. I.e. vocals i'll split up into 16 measure chunks or whatever. This can work for normal musical passages too, just remember to put pingpong looping on it to hide any stitch/cut problems.

ReNoise has an autoseek options for samples which maybe sunvox could impliment, but it would/should only work when playing back the song sequence as it wouldn't make sense in playing individual patterns as they aren't in context of the larger song.
WARNINGThis angry old nerd may rant about modern computers or computer culture! It is not directed at you 99% of the time! Ignore it if it seems silly or personal!
Post Reply