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

build wave mem array

For general discussion related FlowStone

build wave mem array

Postby Logado » Tue Jan 06, 2015 5:59 pm

Hi everyone, i am new to DSP programming.
Try to read wave data and build memory array like this.
Image
i used ruby lib https://github.com/jstrait/wavefile from load wave data.
Now i have this values
Image

FS get values like like
0.000946
0.007080
0.001190
ruby values ​​differ too much :( i dont understand how convert, please help

ps. sorry from my english.
Logado
 
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: build wave mem array

Postby KG_is_back » Tue Jan 06, 2015 7:09 pm

Flowstone internally uses 32bit float representation. In this format, wave is made of decimal values in <-1,1> range.

You have apparently loaded file that is in integer format. To convert from integer to float, all you have to do is to divide the value by the maximal size in that format. For 24bit int that is 2^23 = 8 388 608.

As you can see 7936/ 8 388 608 = 0.000946

When you are doing this in ruby, make sure ruby is doing the math in float numbers - not integers, because you'll get zeros all the time.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: build wave mem array

Postby MyCo » Tue Jan 06, 2015 7:25 pm

Use this from the Lib-examples... it should do the conversion internally
Code: Select all
# Sample data will be returned as 32-bit floating point samples,
# regardless of the actual sample format in the file.
Reader.new("some_file.wav", Format.new(:mono, :float_32, 44100))
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: build wave mem array

Postby Logado » Tue Jan 06, 2015 8:14 pm

Thanks for the detailed
Logado
 
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: build wave mem array

Postby Logado » Thu Jan 08, 2015 1:47 pm

new problem. I now have the correct array but sound wrong.
Why this
Image
and this
Image
gives a different sound :?
Logado
 
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: build wave mem array

Postby KG_is_back » Thu Jan 08, 2015 4:05 pm

float array to mem creates a mono wave file. mem to float array simply lists the samples in succession. If the file is stereo, then the array will be consisted of left and right channel values next to each other - giving twice as long float array as the original file was.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia


Return to General

Who is online

Users browsing this forum: No registered users and 92 guests