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

Sound Import from local file system #839

Merged
merged 13 commits into from Dec 12, 2023
Merged

Conversation

daslyfe
Copy link
Collaborator

@daslyfe daslyfe commented Dec 5, 2023

Adds the ability for the user to import samples from a local directory on their computer.

Samples are written to an indexDB that persists until it is manually cleared.

Tested on firefox, safari, chrome, and tauri on MacOS

Screenshot 2023-12-04 at 7 07 07 PM

@felixroos
Copy link
Collaborator

clears after a session is closed, not sure if it is possible to maintain a selected directory upon reload due to obscuring of the filesystem

samples can potentially be cached in the indexdb, which is also what the pwa internally does

@felixroos
Copy link
Collaborator

there was also this issue: #118 (comment)

@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 7, 2023

Cool, I will try to see if I can set up the indexdb to cache the samples

@felixroos
Copy link
Collaborator

Cool, I will try to see if I can set up the indexdb to cache the samples

made this a while ago: https://codesandbox.io/p/sandbox/indexdb-sample-cache-pie3rl

could be a good starting point

@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 10, 2023

@felixroos I got the indexdb working, your example was very helpful! I still want to clean up/comment the code and add a loading animation because it can take a minute when uploading hundreds of files.

@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 10, 2023

This should be ready to go now :)

The only thing I am unsure about is how I registered the blob with the registerSound function. It seems to work fine, but maybe it would load faster if I made another shorter url that pointed to the blob or something like that.

@felixroos
Copy link
Collaborator

just tried on doesn't work on firefox for me.. i cannot select audio files when directory / webkitdirectory attributes are set + when I remove them, the sound is imported as undefined..

@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 10, 2023

just tried on doesn't work on firefox for me.. i cannot select audio files when directory / webkitdirectory attributes are set + when I remove them, the sound is imported as undefined..

oh I think that is because it is set up to upload a whole directory of sounds, and then assign them indexed by sub folder (like in tidal). so if you have sounds/drums/files you would upload the entire "sounds" directory

@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 10, 2023

maybe it would be more clear if it said "import folder" or something like that

@felixroos
Copy link
Collaborator

just tried on doesn't work on firefox for me.. i cannot select audio files when directory / webkitdirectory attributes are set + when I remove them, the sound is imported as undefined..

oh I think that is because it is set up to upload a whole directory of sounds, and then assign them indexed by sub folder (like in tidal). so if you have sounds/drums/files you would upload the entire "sounds" directory

ahh i see, so then it was just a misunderstanding on how this feature works. just tested with a directory an it worked!

@felixroos
Copy link
Collaborator

This should be ready to go now :)

The only thing I am unsure about is how I registered the blob with the registerSound function. It seems to work fine, but maybe it would load faster if I made another shorter url that pointed to the blob or something like that.

you mean a data url? no idea if that would make a difference or not. I'd say we just roll this out and test it a bit.

There should probably be some annotation to local sounds + the possibility to delete them in the future.

Maybe this can be done as part of a general overhaul of the sounds tab ref #422

@felixroos felixroos mentioned this pull request Dec 12, 2023
9 tasks
@daslyfe
Copy link
Collaborator Author

daslyfe commented Dec 12, 2023

This should be ready to go now :)
The only thing I am unsure about is how I registered the blob with the registerSound function. It seems to work fine, but maybe it would load faster if I made another shorter url that pointed to the blob or something like that.

you mean a data url? no idea if that would make a difference or not. I'd say we just roll this out and test it a bit.

There should probably be some annotation to local sounds + the possibility to delete them in the future.

Maybe this can be done as part of a general overhaul of the sounds tab ref #422

Works for me!

@felixroos felixroos merged commit daf9187 into tidalcycles:main Dec 12, 2023
1 check passed
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.

None yet

2 participants