-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writes/reads int32 when should be float32 #10
Comments
i should add that were this a write problem, then it might be related to issue #7. also, here's my version info: julia> versioninfo() julia> Pkg.status()
7 additional packages:
|
The wavwrite function uses the PCM format by default. You need to specify IEEE float (compression=WAVE_FORMAT_IEEE_FLOAT) when you write the file: wavwrite(tmp,"foo.wav"; nbits=32, compression=WAVE_FORMAT_IEEE_FLOAT) |
ahah, that works. the documentation though says that if the data are floats and nbits is 32 then the output format is single, and makes no mention of the compression format there. perhaps the table needs to be updated? also, i've uncovered another related error: julia> tmp=rand(Float32,(10,2)) julia> wavwrite(tmp,"foo.wav"; compression=WAVE_FORMAT_IEEE_FLOAT) |
I will look into changing the default nbits value when the compression is set to WAVE_FORMAT_IEEE_FLOAT. I will also push a change into the documentation, unless you submit a pull request first. You can edit README.md through the github web interface and create a pull request. |
Fix behavior to match the documentation.
I finally got around to working on this. Let me know if I missed anything. |
the documentation says that writing single precision floating points with nbits set to 32 should yield an output format of single, and that reading that file back in with format set to native should yield singles. yet when doing so i get int32s:
julia> tmp=rand(Float32,(10,2))
10x2 Array{Float32,2}:
0.109329 0.989609
0.257236 0.85028
0.217792 0.777978
0.017634 0.908059
0.156419 0.856639
0.895819 0.0867863
0.654237 0.463306
0.65422 0.0102742
0.52785 0.570494
0.805634 0.950643
julia> wavwrite(tmp,"foo.wav"; nbits=32)
IOStream()
julia> y, fs, nbits, extra = wavread("foo.wav"; format="native")
(
10x2 Array{Int32,2}:
234782656 2125169024
552409408 1825961856
467705728 1670695168
37868812 1950040832
335908000 1839618816
1923755904 186372160
1404963968 994941248
1404926336 22063738
1133548928 1225126400
1730085504 2041490816,
0x00001f40,0x0020,None)
julia> y, fs, nbits, extra = wavread("foo.wav")
(
10x2 Array{Float64,2}:
0.109329 0.989609
0.257236 0.85028
0.217792 0.777978
0.017634 0.908059
0.156419 0.856639
0.895819 0.0867863
0.654237 0.463306
0.65422 0.0102742
0.52785 0.570494
0.805634 0.950643 ,
0x00001f40,0x0020,None)
The text was updated successfully, but these errors were encountered: