- Home /
How to set the start and the end of an audio?
Hi, everyone
I'm just want to know if there is a possible way to set the start and the end of an audio,
for example i have an audio that ends at 30 sec. So how i can make it starts from 2 secs and ends at lets say 25 sec.
Thank you all for your time.
Answer by renezuidhof · Aug 20, 2014 at 11:30 AM
What i did was the following (C#):
I have two floats: startTimesample and endTimesample. In your case startTimesample will be 2 44100 (if that's the frequency that your audio is in) and endTimesample is 25 44100.
Now on your Update method:
if (audiosource.timesample < startTimesample) {
audiosource.timesample = startTimesample;
} else if(audiosource.timesample > endTimesample){
audiosource.Stop();
}
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Detect when animation starts/ends via script 1 Answer
Microphone Failed Result=33 0 Answers
Audio Priority problems... 0 Answers
Dictionary within a dictionary? 1 Answer