3
$\begingroup$

How do I split an Audio object into multiple ones, where the ith object represents the ith interval satisfying a certain criterion?
A quick and dirty solution I just thought of is this:

a = Import["test.wav"]
int = AudioIntervals[a, #RMSAmplitude < .01 &]
a_split = AudioSplit[a, Flatten[int]]
a_split_rms = a_split[[Range[2, Length[a_split], 2]]]

But there are obviously lots of edge cases it doesn't catch.

$\endgroup$
  • $\begingroup$ Have you seen AudioTrim[]? $\endgroup$ – J. M. will be back soon Oct 9 '16 at 7:57
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Oct 9 '16 at 8:24
  • $\begingroup$ @J.M. For some reason, "AudioTrim Mathematica" doesn't show up on Google results. Anyway, that looks like the solution for what I want. $\endgroup$ – Mitsos101 Oct 9 '16 at 10:04
4
$\begingroup$

Use AudioTrim[].

a = Import["test.wav"]
asplit = AudioTrim[a, AudioIntervals[a, #RMSAmplitude < 0.1 &]]

asplit will now contain the segmented Audio objects.

$\endgroup$
  • 1
    $\begingroup$ BTW: the underscore is a special character in Mathematica, and not to be used in variable names. $\endgroup$ – J. M. will be back soon Oct 9 '16 at 10:10
  • $\begingroup$ @J.M. Okay, thanks! $\endgroup$ – Mitsos101 Oct 9 '16 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.