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
6 posts
• Page 1 of 1
build wave mem array
Hi everyone, i am new to DSP programming.
Try to read wave data and build memory array like this.
i used ruby lib https://github.com/jstrait/wavefile from load wave data.
Now i have this values
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.
Try to read wave data and build memory array like this.
i used ruby lib https://github.com/jstrait/wavefile from load wave data.
Now i have this values
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
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.
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
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))
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: build wave mem array
new problem. I now have the correct array but sound wrong.
Why this
and this
gives a different sound
Why this
and this
gives a different sound
- Logado
- Posts: 62
- Joined: Tue Jan 06, 2015 5:42 pm
Re: build wave mem array
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
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 100 guests