Drag and drop to upload samples#4345
Conversation
|
@therealharshit We can already upload samples by clicking upload files button. |
Yes @haroon10725 I am aware of that, it's an addition to that, with this functionality we can upload the samples just by dragging and droping it to sampler canvas. |
|
But how the user will know about it, that this feature exists. |
I will update it in https://github.com/sugarlabs/musicblocks/blob/master/guide%2FREADME.md once it complete. |
|
I think there is no need for it. But still @walterbender and @pikurasa decide it. |
|
I haven't tested it yet, but I think it's fine to have this additional functionality. It's not a game changer, but it does add a level of convenience. I agree with @haroon10725 that we should consider how to make it discoverable. That said, in general, we have a few drag and drop options that are not obvious from the UI, such as MB HTML files and MIDI files. I suggest that, in addition to adding to the README, we add a new section in help that points out what filetypes the user can expect to be able to drag and drop into Music Blocks. |
|
@pikurasa can you please tell my why we have to restrict the sample size to be less than 1MB ? |
IIRC, it is a somewhat arbitrary number. We want to restrict to a certain size, because otherwise users may insert "samples" that are actually entire songs. It's not useful to have audio files of entire songs or long musical passages as "samples". |
That's a great point! thanks for the explanation. |
|
@therealharshit could you please put a few .wav samples here to help with testing? I'm not finding any .wav samples on my machine, only .mp3 |
|
@pikurasa github doesn't allow me to upload .wav files, so here is the .zip folder for the samples it has two .wav samples to test. |
|
@walterbender @pikurasa I have done some refactoring with the code, please test when you got a chance. |
It works. I'm somewhat wondering if we should allow the user to drag and drop a sample whether or not they're in the Sampler widget. For example, a user could drop a sample into MB, and that would generate the Sampler blocks' macros and start the widget, with the sample open. |
|
I do like the idea of opening the sample widget if a sound file is drag and dropped. But let's do that in a separate PR. |
|
Here is the WAV file I was using... |
@walterbender I tested with your sample it's working fine on my machine. sample-piano.mp4The error on your says "upload failed" maybe you are dropping a wrong file, can you please test it again. |
I also like that idea, I'll work on it. |
I tested that .wav file, and it worked for me. (On |
|
@walterbender please test once more and do a code review (or delegate a code review). |
|
@haroon10725 perhaps you could do an initial code review of this PR for us? |
|
Sure @pikurasa I will do it. |
|
@walterbender @pikurasa I have done the code review. |
|
@walterbender There was some formatting issues in the code and some code was extra. I mentioned in code review. |
|
@haroon10725 I don't see your comments other than you said you did a review. I guess if there are changes you think we need to make, please make a new PR as this one is merged. |
|
@haroon10725 please tell what are the required changes. |
|
|
|
@walterbender My bad I didn't submitted. |


drag-and-drop_samples.mp4
@walterbender I have been working on the drag-and-drop functionality to upload samples, it's not complete but ready for testing.
Please test and let me know what do you think.