Change sample rate and preserve loops

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Change sample rate and preserve loops

Post by d.healey »

Anyone know a piece of free software that can batch convert wave files to a different sample rate while preserving loop points? I thought SoX or ffmpeg would be able to but the loop points always get lost.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Change sample rate and preserve loops

Post by Death »

SoundConverter, maybe? I'm not sure it'd preserve the loop markers though: https://soundconverter.org/

But here's an alternative idea off the top of my head:

1. Import all these loops into a DAW that will understand these loop markers (Each loop on their own mixer track).
2. Set the sample rate of the DAW to what you want.
3. Import the project as stems rather than a single mix.

That should work.
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Change sample rate and preserve loops

Post by d.healey »

I just tried soundconverter, it keeps cue markers but not loops unfortunately, also it won't let me export at 24bit, only offers 8/16/32 - weird.
Death wrote: Thu Jan 28, 2021 11:30 am 1. Import all these loops into a DAW that will understand these loop markers (Each loop on their own mixer track).
2. Set the sample rate of the DAW to what you want.
3. Import the project as stems rather than a single mix.
Can you recommend a free DAW that can do that?
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Change sample rate and preserve loops

Post by Death »

d.healey wrote: Thu Jan 28, 2021 11:56 am Can you recommend a free DAW that can do that?
No idea haha..

I use FL Studio via Wine and that can do it. If you don't mind temporarily installing it just for the job then you could use the demo version which should let you do it. I think the only limitation is that it won't let you save projects but it's not like that'll matter here.
Kott
Established Member
Posts: 818
Joined: Thu Mar 21, 2013 12:55 am
Location: Vladivostok
Has thanked: 65 times
Been thanked: 122 times

Re: Change sample rate and preserve loops

Post by Kott »

did you try audacity?
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Change sample rate and preserve loops

Post by d.healey »

Death wrote: Thu Jan 28, 2021 10:48 pm I use FL Studio via Wine and that can do it. If you don't mind temporarily installing it just for the job then you could use the demo version which should let you do it. I think the only limitation is that it won't let you save projects but it's not like that'll matter here.
I need a more permanent and non-proprietary solution.
Kott wrote: Fri Jan 29, 2021 2:15 am did you try audacity?
I don't think Audacity would be suitable. I'll potentially be converting hundreds of files and I don't think Audacity has an interface that is particularly suited to working on such large batches of files. If I remember correctly importing the files would create a new track for each one and that would be quite horrible to manage. Although I guess if it's just for sample rate conversion, an in/out job, then it may be doable if it can handle a large number of files without crashing (I'll play around with it).

I was recently introduced to Signet - https://github.com/SamWindell/Signet/ - and this has rate conversion, the developer tells me that it will preserve loop points too. I haven't been able to get it to build yet on my system but I'm working on it, hopefully this will be the solution.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
User avatar
Loki Harfagr
Established Member
Posts: 268
Joined: Thu Aug 02, 2018 1:28 pm
Has thanked: 151 times
Been thanked: 53 times

Re: Change sample rate and preserve loops

Post by Loki Harfagr »

@d.healey

problem is that the Wav format per se doesn't "hold" or "manage" loops nor metadata though it can accept to have some attached thus I suppose your "wav files with loop markers" are held in some metadata which were added at some time by some sound editor or akin?

anyway, since you're only asking for change sample rate if your loop markers are held in a time format unit and not a frame unit you still can manage to first extract the letadata from the source wav file, soxi might well do it, keep it in a temp file then use sox to change the rate of the taget file and then reattch the saved metadata file to the target, that final step may be done with various tools depending on the format of the metadata you used.

Note: untested since I don't have any wav file with metadata or loop points or at least I've never tried to check nor to use them and just happened to know by your post that they existed :)
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Change sample rate and preserve loops

Post by d.healey »

Loki Harfagr wrote: Fri Jan 29, 2021 3:04 pm @d.healey

problem is that the Wav format per se doesn't "hold" or "manage" loops nor metadata though it can accept to have some attached thus I suppose your "wav files with loop markers" are held in some metadata which were added at some time by some sound editor or akin?

anyway, since you're only asking for change sample rate if your loop markers are held in a time format unit and not a frame unit you still can manage to first extract the letadata from the source wav file, soxi might well do it, keep it in a temp file then use sox to change the rate of the taget file and then reattch the saved metadata file to the target, that final step may be done with various tools depending on the format of the metadata you used.

Note: untested since I don't have any wav file with metadata or loop points or at least I've never tried to check nor to use them and just happened to know by your post that they existed :)
I can't remember the details but I believed they are stored in the cue-chunk.

I don't think your method would work, at least not without some modification. Changing the sample rate changes the position of the start and end of the loop within the file.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
kafka
Established Member
Posts: 14
Joined: Mon Jan 18, 2021 10:08 am
Been thanked: 1 time

Re: Change sample rate and preserve loops

Post by kafka »

Death wrote: Thu Jan 28, 2021 11:30 am SoundConverter, maybe? I'm not sure it'd preserve the loop markers though play casino for real money and casino casinoslogin.com/wintika-casino.html login wintika.

But here's an alternative idea off the top of my head:

1. Import all these loops into a DAW that will understand these loop markers (Each loop on their own mixer track).
2. Set the sample rate of the DAW to what you want.
3. Import the project as stems rather than a single mix.

That should work.
Cheers mate. I was looking for something similar as well.
Last edited by kafka on Tue Feb 09, 2021 12:17 pm, edited 2 times in total.
tavasti
Established Member
Posts: 2047
Joined: Tue Feb 16, 2016 6:56 am
Location: Kangasala, Finland
Has thanked: 369 times
Been thanked: 208 times
Contact:

Re: Change sample rate and preserve loops

Post by tavasti »

Loki Harfagr wrote: Fri Jan 29, 2021 3:04 pm problem is that the Wav format per se doesn't "hold" or "manage" loops nor metadata though it can accept to have some attached thus I suppose your "wav files with loop markers" are held in some metadata which were added at some time by some sound editor or akin?

anyway, since you're only asking for change sample rate if your loop markers are held in a time format unit and not a frame unit you still can manage to first extract the letadata from the source wav file, soxi might well do it, keep it in a temp file then use sox to change the rate of the taget file and then reattch the saved metadata file to the target, that final step may be done with various tools depending on the format of the metadata you used.
In wav file loop points are in smpl chunk, and locations are stored in byte offset. So change in sample rate or number of bits/sample mean need to recalculate.

https://sites.google.com/site/musicgapi ... ormat#smpl

Linux veteran & Novice musician

Latest track: https://www.youtube.com/watch?v=ycVrgGtrBmM

User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Change sample rate and preserve loops

Post by d.healey »

Signet is the way to go - https://github.com/SamWindell/Signet/

The developer got it building on GNU/Linux and I just tested sample rate conversion and it does preserve the loop points.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
Samen
Posts: 1
Joined: Wed Jan 12, 2022 8:19 am

Re: Change sample rate and preserve loops

Post by Samen »

d.healey wrote: Thu Feb 04, 2021 2:24 pm Signet is the way to go - https://github.com/SamWindell/Signet/

The developer got it building on GNU/Linux and I just tested sample rate conversion and it does preserve the loop points.
Thanks, this is very helpful.
I mainly work on this page. In my free time I try to write music.
Post Reply