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

Speed and Loops #22

Closed
wants to merge 14 commits into from
Closed

Speed and Loops #22

wants to merge 14 commits into from

Conversation

Willena
Copy link
Contributor

@Willena Willena commented Oct 2, 2016

As requested by some users ( #15 ), I added the ability to loop a part. Part that can be selected with the select tool.
I also added a way to control the playback speed ( #19 ) but the pitch is modified, and I didn't write the algorithm to correct that.
( I don't have any idea of how to do it... I tried https://github.com/mmckegg/soundbank-pitch-shift and it create a very bad sound )

Have a look at the full waveform-playlist example.

Here is a summary of the new functions:

  • playlist.setSpeed(speed)
  • playlist.setLoop(number_of_loop)

For the new events have a look at the Readme.

@naomiaro
Copy link
Owner

naomiaro commented Dec 6, 2016

Hey sorry for not getting around to this PR earlier @Willena . Is it possible you have time to fix the conflicts from the latest fix I did for removing webpack stuff?

@Willena
Copy link
Contributor Author

Willena commented Dec 6, 2016

Yes of course ! But you will have to wait a bit before having a fix, I do not have a lot of times these days.

@faroit
Copy link
Contributor

faroit commented Dec 7, 2016

@Willena here is a time-stretch algorithm in javascript that does both: stretching time while keeping pitch constant or changing the pitch while keeping the time constant: https://github.com/Infinity/Kali

@Willena
Copy link
Contributor Author

Willena commented Dec 7, 2016

Hi ! Thanks @faroit for the info ! I will try to to implement this when I will make this PR compatible with the recent changes.

@Willena
Copy link
Contributor Author

Willena commented Jan 9, 2017

@naomiaro Here you can find my previous work adapted, to recent changes. I will try to implement what @faroit has suggested as soon as I can.

@alexander-daniel
Copy link
Contributor

Any progress on this? Super excited to give it a go! If you need some help resolving the conflicts I can take a look, but I'm pretty sure you've got em! Just pinging here out of interest, sorry if thats a bother.

Cheers!

@Willena
Copy link
Contributor Author

Willena commented Mar 6, 2017

I did not work very hard on this these days, but I'm still experiencing some problems with speed change.

I can slow down without any trouble by using https://github.com/Infinity/Kali but speeding up the audio is a bit harder due to the fact that when data are processed the result is shorter than the duration of the original, and there is a blank betwen samples.

Something that can be done is generate an audio buffer with the full mix then speed up and then play.

But that's not how the current system is meant to work.
Also slowing down or speeding up the audio is a CPU intensive task that can cause, some artefacts in the audio output if we have multiple tracks and not a powerfull CPU.

I can push my current work if you want to try it but it's not complete and may contain some bugs.

@alexander-daniel
Copy link
Contributor

Oh cool! The feature in this PR I'm interested in is the Looping! Any way it can be pulled out and presented as its own PR?

Not to seem pushy at all, I understand how much work goes into things like this!

@naomiaro
Copy link
Owner

naomiaro commented Mar 8, 2017

@Willena @alexander-daniel hey guys, I'm thinking more about loops and wondering if it should be done via the events rather than put in core code?

The select event emits a start/end. You can listen for that and then play from start -> end. Now with the finished event, you can listen for that and then send another event to play from start -> end? Just have to set a boolean somewhere etc and then watch for this loop button (or unloop button) to be pressed.

I might try this out in the examples actually.

@Willena
Copy link
Contributor Author

Willena commented Mar 8, 2017

@naomiaro I agree with what you are saying, but I think that if something is needed/required by multiple people it can be interesting to add it in the core code. The looping feature is something that people are interested in. By implementing this directly in the core code, with the apropriate events, it will enable the user to make "a customisable" interface, and the user will just have to use each feature of the project without requiring lot of code.

Hope somebody can understand me.

@naomiaro
Copy link
Owner

naomiaro commented Mar 8, 2017

Yeah, I can see the need for it. I really want to move more towards a plugin system though - I think the core project is getting too large. I'd like to remove things into plugins like recording, exporting, annotations etc. like Wavesurfer.js has going on. Just need to figure out a good way to allow this.

I've got an example of a loop button here:

#55

I had to directly use the playlist object to make some calls as the playout promises are needed for timing.

@naomiaro
Copy link
Owner

naomiaro commented Mar 9, 2017

I made a small publish to a patch version for that setTimeout. There's a loop button now next to the 'Trim' button. Both of these buttons are only enabled when a segment of audio is selected.

Loop Button Example

@Willena
Copy link
Contributor Author

Willena commented Mar 9, 2017

really want to move more towards a plugin system though - I think the core project is getting too large

I totaly agree with that ! it will allow to add new features with ease. A plugin system is what I have planned to work on after that pull request (that needs some work for now).I think #50 or #24 .are waitting for that sort of improvement (implementation of plugin system or something similar) to be solved.

@andymcarter
Copy link

Hi, great to see the new improvements over the last few months.

Is it possible to combine the loops buttons with the annotations? E.g. click a section and set it looping?

@faroit
Copy link
Contributor

faroit commented Mar 12, 2019

Any update on this?

@Willena
Copy link
Contributor Author

Willena commented Jul 16, 2019

It's been three years this pull request is opened. I will close it until I find some time to sync with the project. But it seams that loops have been implemented according to this message

@Willena Willena closed this Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants