Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Changing file extensions / saving custom file types

For general discussion related FlowStone

Changing file extensions / saving custom file types

Postby KG_is_back » Sat Mar 22, 2014 9:49 pm

Is it possible in FS to create/save custom file types? Or change extension of files with flowstone?

basically I'm working on a project that uses .wav files to save coefficient presets. The algorithm is very sensitive to loading random files, so I would like to save the coefficients as file with custom extension, to prevent user accidentally loading an actual wave file and crashing his DAW.
The simplest solution I can think of is to change file extention of the wav file (containing coefficients) after it's been saved by "save wave" primitive. Would this prevent "load wave" primitive from loading the file? (if it would then I would need a way to change the extension back to .wav before load and back to the custom one after is loaded)
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Changing file extensions / saving custom file types

Postby RJHollins » Sat Mar 22, 2014 10:27 pm

Are these 'coefficients' being written into the WAV Header ???

I don't know if there use 'user space' available in this header to add 'general' info or data. The issue would be a type of corruption of the file in that the standard loading gets confused.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Changing file extensions / saving custom file types

Postby tester » Sat Mar 22, 2014 11:01 pm

No problem. you can define it as you wish. There was a small project I made for that:
viewtopic.php?f=2&t=1832&p=8994

Let me know if you need more.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Changing file extensions / saving custom file types

Postby KG_is_back » Sat Mar 22, 2014 11:31 pm

RJHollins wrote:Are these 'coefficients' being written into the WAV Header ???

I don't know if there use 'user space' available in this header to add 'general' info or data. The issue would be a type of corruption of the file in that the standard loading gets confused.

No, the data is stored only as samples of the actual wave. It is normal simple 44100hz/32bit-float wave file, just the values stored as samples are not actually a wave - they are used for something else.

tester wrote:No problem. you can define it as you wish. There was a small project I made for that:viewtopic.php?f=2&t=1832&p=8994Let me know if you need more.

Unfortunately it doesn't work for save wave (wave files are stored as .wav no matter what extension you enter). It works fine for preset files though, so I might go with that. Are floating point parameters in presets stored in full precision? Because when I connect float array to a text primitive the values get rounded to 7 decimal places. Does this happen when saving presets too?
because the coefficients I'm working with are used in upto 6th-order filters that are connected in feedback loop... so the precision is quite crucial (I'm not even satisfied with single precision floats to be honest). That is the reason why I went directly with the 32bit wav right away.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Changing file extensions / saving custom file types

Postby tester » Sat Mar 22, 2014 11:55 pm

For dealing with wave load/save - there are prims savewave and wavefile. Are they overwriting filename extension set via message box, that delivers filepath and filename and selected extension? If so, then this would be a bug in FS.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Changing file extensions / saving custom file types

Postby KG_is_back » Sun Mar 23, 2014 12:04 am

tester wrote:For dealing with wave load/save - there are prims savewave and wavefile. Are they overwriting filename extension set via message box, that delivers filepath and filename and selected extension? If so, then this would be a bug in FS.

Yes, they are... I don't think it's really a bug - to me it seems that they suppose to work that way (I bet the developers didn't count with a mad scientist like me trying to save other data than waves into WAV files :mrgreen: ). It's annoying though... especially in a situation I'm in right now.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Changing file extensions / saving custom file types

Postby tester » Sun Mar 23, 2014 12:23 am

Welcome to mad scientists club. :-)

Filename/path handlers are however here to handle the filenames, paths AND extensions, no matter what is the content of a file. Thus - wave content should be saved under the cover provided by the handler.

Alternative would be to convert and import/export through ruby due to precision. I'm not sure if there is no project on that somewhere around.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Changing file extensions / saving custom file types

Postby KG_is_back » Sun Mar 23, 2014 12:38 am

tester wrote:Welcome to mad scientists club. :-)

Filename/path handlers are however here to handle the filenames, paths AND extensions, no matter what is the content of a file. Thus - wave content should be saved under the cover provided by the handler.

Alternative would be to convert and import/export through ruby due to precision. I'm not sure if there is no project on that somewhere around.


If preset save files give enough precision to save 32bit float numbers, then I do not have to use wavs. If they don't, I can still save exponent and mantissa separately as two float numbers (It's actually not that hard to separate them).
BTW your suffix prefix system solved another issue I was working on. The coefficients are samplerate-specific ...using your schematics I can now automatically provide samplerate in the filename to avoid missloading wrong model. ;)
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Changing file extensions / saving custom file types

Postby tester » Sun Mar 23, 2014 12:59 am

Good to know that it helped a little bit.

I would be interested to see your way of saving/loading (bidirectional use) in the dual mode (exponent and mantissa separately). While I have a glimpse on how it may look like, my mad science is wandering somewhere else at the moment.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Changing file extensions / saving custom file types

Postby KG_is_back » Sun Mar 23, 2014 1:14 am

tester wrote:Good to know that it helped a little bit.

I would be interested to see your way of saving/loading (bidirectional use) in the dual mode (exponent and mantissa separately). While I have a glimpse on how it may look like, my mad science is wandering somewhere else at the moment.


Well it loads the binary structure of a 32bit float number and separate upper and lower 16bits. converts these binary structures from integers to floats. The backward conversion is even simpler convert both floats back to integer, bitshift upper part by 16bit and preform logical OR.
Attachments
experiment.fsm
(1.15 KiB) Downloaded 831 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Next

Return to General

Who is online

Users browsing this forum: No registered users and 53 guests