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

Bug when uploading samples that makes these not compatible with Elektron Transfer #101

Closed
dagargo opened this issue Mar 28, 2023 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@dagargo
Copy link
Owner

dagargo commented Mar 28, 2023

Looks like Elektroid sample uploads are not compatible with Elektron Transfer. I'm unsure about the time this got broken. But haven't researched much yet.

For anyone interested in the Elektron Transfer compatibility for samples, it'd be very helpful to discuss this issue here.

There is a small difference in the downloaded files when uploaded with these tools. More specifically, the looptype member of this struct is not in the right endian format. (I'm not really sure if the Transfer format follows the convention.)

struct elektron_sample_header
{
guint32 type;
guint32 sample_len_bytes;
guint32 samplerate;
guint32 loopstart;
guint32 loopend;
guint32 looptype;
guint32 padding[ELEKTRON_SAMPLE_INFO_PAD_I32_LEN];
};

Anyway, this is not the actual issue. The issue is that the hash the devices use to use to identify samples in their CAS depends on this value so changing this value will probably break sample uploads when uploading projects and sounds.

I still need to run some tests but this doesn't look great. 😞

This is the patch that would fix the downloads in Transfer but could break projects and sounds backup.

$ git diff
diff --git a/src/connectors/elektron.c b/src/connectors/elektron.c
index 3e4f43f..f369191 100644
--- a/src/connectors/elektron.c
+++ b/src/connectors/elektron.c
@@ -57,7 +57,7 @@ static const gchar *FS_TYPE_NAMES[] = { "+Drive", "RAM" };
 #define ELEKTRON_NAME_MAX_LEN 32
 
 #define ELEKTRON_SAMPLE_INFO_PAD_I32_LEN 10
-#define ELEKTRON_LOOP_TYPE 0x7f
+#define ELEKTRON_LOOP_TYPE 0x7f000000
 
 struct elektron_sample_header
 {
@dagargo dagargo added bug Something isn't working help wanted Extra attention is needed labels Mar 28, 2023
@dagargo dagargo self-assigned this Mar 28, 2023
@dagargo dagargo changed the title Error when uploading samples that makes these not compatible with Elektron Transfer Bug when uploading samples that makes these not compatible with Elektron Transfer Mar 28, 2023
@dagargo
Copy link
Owner Author

dagargo commented Mar 28, 2023

I'm working on the branch https://github.com/dagargo/elektroid/tree/101_sample_upload_bug.

@dagargo
Copy link
Owner Author

dagargo commented Mar 29, 2023

Looks like the issue is less problematic than I anticipated because while samples themselves can not be downloaded with Transfer, projects are downloaded with their associated samples without issues. Same is true for sounds.

This is good news. 🌈

@dagargo
Copy link
Owner Author

dagargo commented Mar 29, 2023

In the case that someone would want to download the samples with Transfer, re-uploading the samples to the same path will change the hash used in the CAS and will unlink projects and sounds with their associated samples. A better way to proceed would be to open the project or sound, re-upload the associated samples, re-associate the samples and then save the project or sound. Very tedious and error-prone.

Still, if the goal is just to download a sample, there is another option. If samples are re-uploaded to a different path, downloading these new samples will work with Transfer and the projects and sounds will still be associated with their original samples. After, the copied sample could be deleted.

I'm very very sorry. 😞

@dagargo
Copy link
Owner Author

dagargo commented Mar 31, 2023

Since projects and sounds download fine even if the internal hash calculation doesn't match, perhaps the best approach will be to do the following:

  1. Back up every sound and project from Transfer.
  2. Re-upload these from Transfer.
  3. Back-up all the samples.
  4. Re-upload all the samples.

If Transfer fixes the hash when re-uploading, this will work. But I haven't tried this.

@dagargo
Copy link
Owner Author

dagargo commented Apr 1, 2023

I've decide to fix this so using Elektroid is compatible with Transfer.

For anyone using both Elektroid and Transfer, be aware of the aforementioned possible issues.

Fixed in f8a0fee.

@dagargo dagargo closed this as completed Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant