Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop audio #25

Closed
rastaman111 opened this issue Nov 15, 2021 · 5 comments
Closed

Crop audio #25

rastaman111 opened this issue Nov 15, 2021 · 5 comments

Comments

@rastaman111
Copy link

Hey @dmrschmidt! Do you have the ability to cut a fragment from a finished file? That is, select start and finish as RangeSlider

@dmrschmidt
Copy link
Owner

Currently this is not something that's supported by the library itself, no. So you'd need to create a temporary audio file yourself at the moment, wich you trim to the desired range. Depending on your use case it might be - but most likely isn't - acceptable to instead crop the resulting image.

With regards to supporting this use case from within the library directly, I don't think I'll be able to add this in anytime soon. I could see it as a useful addition though, so if you come up with a workable solution, I'd be more than happy to merge a PR :)

@rastaman111
Copy link
Author

Currently this is not something that's supported by the library itself, no. So you'd need to create a temporary audio file yourself at the moment, wich you trim to the desired range. Depending on your use case it might be - but most likely isn't - acceptable to instead crop the resulting image.

With regards to supporting this use case from within the library directly, I don't think I'll be able to add this in anytime soon. I could see it as a useful addition though, so if you come up with a workable solution, I'd be more than happy to merge a PR :)

Yes, I know that you need to create a temporary file with the desired interval, there is nothing complicated here, there is a solution. But I can't find a ready-made good solution for RangeSlider specifically for audio files, although there are solutions from the video ...

@dmrschmidt
Copy link
Owner

Hey @rastaman111, I'm sorry but I'm not quite sure I understand what RangeSlider, and what video you are referring to. As far as I am aware, there is no RangeSlider native to UIKit or SwiftUI, so I assume you must be referring to another 3rd party library?

Regarding a workable solution to the original problem, you've problem come across this answer to how to slice an audio file within a CMTimeRange. (Haven't tested that myself but it looks pretty legit).

@rastaman111
Copy link
Author

That's what I mean rangeSlider. That is, on your Waveline, move the sliders and select the range

@dmrschmidt
Copy link
Owner

OK, so yeah. That stackoverflow answer should do the trick for you or at the very least guide you into the right direction then. You'd just need to map that rangeSlider's selected min and max value to the CMTimeRange's desired values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants