AudioBuffer Error
by Fox Trot · in Torque 2D Beginner · 04/10/2013 (4:35 pm) · 4 replies
I am having a problem running an audio file using alxplay. I get this error when I play a file of about 5 mins in length.
AudioBuffer::readWAV: remaining chunk data should never be less than zero.
Here is my asset:
<AudioAsset
AssetName="Wind"
AudioFile="Wind.wav" />
and here is my code:
I am using AppCore so it already did initializeOpenAL(); for me.
Also, in the source it says:
// either we have unread chunk data or we found an unknown chunk type
// loop and read up to 1K bytes at a time until we have
// read to the end of this chunk
Thanks
AudioBuffer::readWAV: remaining chunk data should never be less than zero.
Here is my asset:
<AudioAsset
AssetName="Wind"
AudioFile="Wind.wav" />
and here is my code:
%audio = alxplay("Game:Wind");I am using AppCore so it already did initializeOpenAL(); for me.
Also, in the source it says:
// either we have unread chunk data or we found an unknown chunk type
// loop and read up to 1K bytes at a time until we have
// read to the end of this chunk
Thanks
About the author
#2
EDIT: I made all those changes and it works great now :) Thanks.
04/11/2013 (11:49 am)
Its sample rate is 48,000, its stereo, and its 32 bits. Come to think of it, I did put a loop point in (I am using Ableton)EDIT: I made all those changes and it works great now :) Thanks.
#3
I guess that another option would be to change the default sampling rate to match yours.
In /engine/source/audio/audio.h, you will find the following
No idea if it works as it says in the comments, though.
The only other place where 44100 is mentioned is in audio.cc
04/11/2013 (1:44 pm)
Good to hear!I guess that another option would be to change the default sampling rate to match yours.
In /engine/source/audio/audio.h, you will find the following
//-Mat default sample rate, change as needed #define DEFAULT_SOUND_OUTPUT_RATE 44100
No idea if it works as it says in the comments, though.
The only other place where 44100 is mentioned is in audio.cc
#define ALX_DEF_SAMPLE_RATE 44100 // default values for mixer #define ALX_DEF_SAMPLE_BITS 16 #define ALX_DEF_CHANNELS 2
#4
Also, as far as I know advanced features like loop points are not directly supported - but OpenAL might deal with them gracefully behind the scenes. Many things really depend on driver capabilities.
04/11/2013 (1:47 pm)
Yes - we found that very high sampling rates cause horrible things to happen. 44.1k or lower is preferred, generally following the formats Audacity seems to favor.Also, as far as I know advanced features like loop points are not directly supported - but OpenAL might deal with them gracefully behind the scenes. Many things really depend on driver capabilities.
Associate Simon Love
- Sampling Rate (OpenAL's implementation in T2D defaults to 44100Hz
- Bits (OpenAL's implementation in T2D defaults to 16
- Stereo? Mono?
- Did you set any loop points using your audio software? Technically these won't be read by OpenAL but some audio software can include metadata of this type, which might be something worth investigating.