Reading Loop points from WAV file - possible?

For general discussion related FlowStone
User avatar
Julian Ray
Posts: 23
Joined: Tue Jun 18, 2019 2:58 pm
Location: CANADA
Contact:

Reading Loop points from WAV file - possible?

Post 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
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Reading Loop points from WAV file - possible?

Post 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!

WAV File Reader.fsm
(1.28 KiB) Downloaded 957 times
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
Julian Ray
Posts: 23
Joined: Tue Jun 18, 2019 2:58 pm
Location: CANADA
Contact:

Re: Reading Loop points from WAV file - possible?

Post 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!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Reading Loop points from WAV file - possible?

Post 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.
"There lies the dog buried" (German saying translated literally)
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Reading Loop points from WAV file - possible?

Post by adamszabo »

its better if you search for "KG_is_back", thats the username ;)
User avatar
Julian Ray
Posts: 23
Joined: Tue Jun 18, 2019 2:58 pm
Location: CANADA
Contact:

Re: Reading Loop points from WAV file - possible?

Post by Julian Ray »

Thanks guys, I'll search it right now :)
acg2010
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: Reading Loop points from WAV file - possible?

Post 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.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Reading Loop points from WAV file - possible?

Post 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
Attachments
Looping WAV with loop points info.zip
(369.72 KiB) Downloaded 935 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Reading Loop points from WAV file - possible?

Post 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.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
guyman
Posts: 207
Joined: Fri Mar 02, 2018 8:27 pm

Re: Reading Loop points from WAV file - possible?

Post by guyman »

Can we write Loop points TO a wav file?
Post Reply