AutoHotkey Community

It is currently May 27th, 2012, 3:59 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Howto Play 24bit audio?
PostPosted: May 17th, 2011, 11:27 am 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
I'm trying to play a 24bit audio file with my app. It just uses SoundPlay. Windows 7 has no problem, however Windows XP users cannot play the 24bit files.

Test app (or create your own in 1 minute): Bard.zip
audio samples:
24bit
regular


The documentation says:
Quote:
All Windows OSes should be able to play .wav files. However, other files (.mp3, .avi, etc.) might not be playable if the right codecs or features aren't installed on the OS.


Possible fixes mentioned in this article (How to play 24bit WAV files in Windows Media Player) are fixing the problem for WMP, but not for autohotkey:

1. Download Legacy HD Audio Filter from http://chrisnet.net/code.htm
2. regsvr32.exe AudioTypeConvert.ax
3. Play 24bit file in windows media player (works) and AHK (no sound).
4. regsvr32.exe /u AudioTypeConvert.ax to uninstall

Any ideas? I was under the impression that AHK was just using windows codecs - perhaps this is a bug?

_________________
Cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2011, 3:52 pm 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
Using the mciSendStringA alternative DLL call I get error message 320 which corresponds to MCIERR_WAVE_OUTPUTSINUSE

Quote:
All waveform devices that can play files in the current format are in use. Wait until one of these devices is free; then, try again.


Am I right in guessing that is because no waveform devices can play these files?

_________________
Cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2011, 9:29 am 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
Am really stuck with this, so any ideas or pointers that I can follow up on would be much appreciated. If I can force playback as 16bit that would be acceptable.

_________________
Cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2011, 3:40 pm 
Offline

Joined: April 16th, 2011, 7:18 am
Posts: 176
Location: Jogjakarta, Indonesia
Hi pacifika,

I try your 24 bit sample, and had the same problem. I use this tools to test codec:
Just drag & drop your file to graphstudio or gspot, to test.

Also, I can use Soundplay on 24bit.wav if i change the extension :
Code:
^1::
SoundPlay, G:\24bit.mp3
Return

i had success with .mp3 & .mpg, but this is because I have FFDshow installed, set the filename to.wav doesn't produce any sound.

At first i think it has something to do with Wave Parser:
http://msdn.microsoft.com/en-us/library/dd390972%28v=VS.85%29.aspx wrote:
However, it has the following limitations on the audio format:

* The audio must be 8-bit or 16-bit linear PCM.
* For AIFF-C files, the audio must be uncompressed, in big-endian byte order (compression type 'NONE').

but GraphStudio shows that the filterchain use Wave Parser, up until this point I still have no clue why this is happening.

_________________
AHK_Lw 1.1.05, OS: XP SP3, Firefox 3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2011, 4:48 pm 
Offline

Joined: April 16th, 2011, 7:18 am
Posts: 176
Location: Jogjakarta, Indonesia
Allright, further testing with sample from this site : http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/Samples.html
Code:
^1::
SoundPlay, G:\M1F1-int24-AFsp.wav
Return
^2::
SoundPlay, G:\M1F1-int24WE-AFsp.wav
Return

  • First file (WaveFormat) Fail, doesn't produce any sound.
  • Second file (WaveFormatExtensible) Play successfully.

So I think the problem is the wave file has to be on WaveFormatExtensible to enable 24-bit playback on XP.

_________________
AHK_Lw 1.1.05, OS: XP SP3, Firefox 3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 1:32 am 
Offline

Joined: April 16th, 2011, 7:18 am
Posts: 176
Location: Jogjakarta, Indonesia
I think this explain all:
http://chrisnet.net/code.htm wrote:
Legacy HD Audio Filter - DirectShow filter to convert from standard WAVEFORMATEX to WAVEFORMATEXTENSIBLE on demand. Filter is registered as MERIT_NORMAL so that graph builder will automatically insert it as required.

Many audio processing applications still produce high-definition audio such as 24bit/96kHz in a legacy WAV format. By default DirectShow players (such as Media Player) won't be able to play these files as the Audio Renderer refuses to accept this legacy type even though it is perfectly capable of playing it. This filter registers itself as being able to handle this legacy format, and at the same time converts to a format the DirectShow Audio Renderer will accept (WAVEFORMATEXTENSIBLE). This is done without altering the audio data in any way. Save the .ax file somewhere convenient on your system and register it from the command line with "regsvr32 AudioTypeConvert.ax".


But i still can't get Legacy HD Audio Filter to work on SoundPlay, increasing the filter merit to highest (using Gspot) doesn't make any difference.

So, I try to convert your 24bit.wav to WaveFormatExtensible using Audacity:
  • open file
  • Select File>Export...
  • Name your file, Save as type : Other uncompressed files
  • Click Options Button
  • Uncompressed Export Setup :
    - Header : select, WAVEX (Microsoft)
    - Encoding : select, Signed 24 bit PCM
  • Save, when ask for Metadata, just click OK

And now SoundPlay can play the file, Hope it helps.

_________________
AHK_Lw 1.1.05, OS: XP SP3, Firefox 3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 12:46 pm 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
Thanks for your investigation j[]hn, unfortunately I have no control over the nature of the audio files - I just need my script to be as compatible as possible in playing them. However the info is very interesting and I will pursue further.

_________________
Cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 3:06 pm 
Offline

Joined: April 16th, 2011, 7:18 am
Posts: 176
Location: Jogjakarta, Indonesia
Quote:
unfortunately I have no control over the nature of the audio files - I just need my script to be as compatible as possible in playing them

I see. So the alternative would be using BASS library, since you can distribute it with your script and its independent to installed codec.

_________________
AHK_Lw 1.1.05, OS: XP SP3, Firefox 3


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, rbrtryn and 48 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group