Page 1 of 2
Reading Loop points from WAV file - possible?
Posted: Sun Jun 30, 2019 3:39 pm
by Julian Ray
Hi,
I have a lot of WAV files with loops (made them for my Kontakt sample libraries), some of which I would like to use for my FS project. I was searching forum on this subject, but no luck.
Can anyone, please clarify if it is possible for FS to recognize WAV Loop points? If not - what would be possible solution?
Thanks!
Ray
Re: Reading Loop points from WAV file - possible?
Posted: Sun Jun 30, 2019 7:10 pm
by trogluddite
Assuming the loop points are stored in the standard way for a WAV file, then yes it's possible - but not especially easy.
Ruby can read files as raw bytes, and then decode them into whatever kind of data they represent; so if you know how a file format is laid out, it's possible to decode just about anything.
I have had a play at decoding WAV files in the past, though I didn't gt particularly far. Below is the old project file, which you're free to cherry-pick if its at all useful to you - it'll give you a sense of what you'd be letting yourself in for, at least! From a cursory look, I can't tell exactly which chunks of a wav its able to read - you might get lucky and see your marker/loop data, or you might not - good luck!
Re: Reading Loop points from WAV file - possible?
Posted: Sun Jun 30, 2019 7:39 pm
by Julian Ray
Thank you very much for the explanation and example - I'll definitely study it and see for how deep I can understand it

Cheers!
Re: Reading Loop points from WAV file - possible?
Posted: Mon Jul 01, 2019 5:56 am
by tulamide
There are also two projects from KGisback, one of it specifically a wave file reader, that was quite advanced. But you would need to use the search function (or Google's site search) to find it, because I forgot about the title.
Re: Reading Loop points from WAV file - possible?
Posted: Mon Jul 01, 2019 11:05 am
by adamszabo
its better if you search for "KG_is_back", thats the username

Re: Reading Loop points from WAV file - possible?
Posted: Mon Jul 01, 2019 3:33 pm
by Julian Ray
Thanks guys, I'll search it right now

Re: Reading Loop points from WAV file - possible?
Posted: Wed Jul 03, 2019 3:44 pm
by acg2010
Not sure if this would be of any use but while researching SDR, I came across this reference to parsing a wav in C.
http://truelogic.org/wordpress/2015/09/ ... file-in-c/Maybe can glean some helpful hints, or convert code to assembler maybe, idk.
Re: Reading Loop points from WAV file - possible?
Posted: Wed Jul 03, 2019 6:01 pm
by Spogg
I don’t know if this could help trog to modify his Ruby code, but I’ve attached a short WAV which does loop nicely, and a screenshot of the Wavosaur properties which show the loop start and end samples.
I imagine agc2010 wants only the loop sample values for a player.
Cheers
Spogg
Re: Reading Loop points from WAV file - possible?
Posted: Wed Jul 03, 2019 10:02 pm
by trogluddite
Thanks for the example file, Spogg, and for the code example, agc2010 (I would have included the research links from my old project - but they were all broken!)
Having had a bit more of a look at my old code, I think that extracting the other data "chunks" should be possible by adding their structures to the table at the beginning. I'll need to think a bit more about the parser though, as I don't think it will handle tables nested within tables properly yet; and if I remember the WAV format correctly, loop points require cross-referencing data from two different "chunks". Coincidentally, one of my current projects is a MIDI SysEx decoder which does exactly the same kind of memory-mapped data extraction - it's a similar enough problem that I may well end up with code that can be re-used here.
Re: Reading Loop points from WAV file - possible?
Posted: Sun Jul 28, 2019 8:11 pm
by guyman
Can we write Loop points TO a wav file?