Author Topic: BASS Windows 7 AAC  (Read 12659 times)

Rescator

  • Guest
BASS Windows 7 AAC
« on: 21 Jan '10 - 16:54 »
Hey Ian, could you make BASS use the OS AAC(+) decoder when it is available?

And when it is not available (or the OS decoder does not support the particular file) it could "fail" thereby allowing the use of BASS_AAC (if loaded/available) as a fallback?

I have no idea of the decoding quality of latest FAAD and Win7 but I'm assuming the Win7 has a slight edge.

Info on the Windows 7 AAC decoder: http://msdn.microsoft.com/en-us/library/dd742784%28VS.85%29.aspx
Info on which formats are supported in Vista and Windows 7: http://msdn.microsoft.com/en-us/library/dd757927%28VS.85%29.aspx

PS! A slight "bug" report on BASS and Windows (Vista at least) If the MP3 free version is used then peaks seem to clip at 1.0 but with the BASS mp3 decoder peaks are 1.0+
Is there any way to get un-clipped or floats from the OS mp3 decoder also? That would allow consistent behavior and ensure that a peak scan of a file would be useful (say a file peak of 1.5 could be reduced during playback later by the proper amount) unlike now where the OS decoder just clips/truncates it seems.

Oh yeah! BASS (with the 32float DSP flag, 32float decoding/etc flags) on Vista and Win7 does make 32bit float through the entire audio chain possible right? (considering Vista+ is always 32bit float audio right?)

ken

  • Posts: 752
Re: BASS Windows 7 AAC
« Reply #1 on: 21 Jan '10 - 19:48 »
That is interesting, and as Windows7 has AAC Encoder I like to know how I can use that for encoding to AAC (write file, anc send to streamingserver like IceCast).

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #2 on: 22 Jan '10 - 15:06 »
Hey Ian, could you make BASS use the OS AAC(+) decoder when it is available?

And when it is not available (or the OS decoder does not support the particular file) it could "fail" thereby allowing the use of BASS_AAC (if loaded/available) as a fallback?

I have no idea of the decoding quality of latest FAAD and Win7 but I'm assuming the Win7 has a slight edge.

Info on the Windows 7 AAC decoder: http://msdn.microsoft.com/en-us/library/dd742784%28VS.85%29.aspx
Info on which formats are supported in Vista and Windows 7: http://msdn.microsoft.com/en-us/library/dd757927%28VS.85%29.aspx

I haven't played with the "Media Foundation" stuff yet, but it looks to be something like DirectShow. I think it (not only AAC on Win7) might be better supported via an add-on. I'll put it on the "look into it" list :)

PS! A slight "bug" report on BASS and Windows (Vista at least) If the MP3 free version is used then peaks seem to clip at 1.0 but with the BASS mp3 decoder peaks are 1.0+
Is there any way to get un-clipped or floats from the OS mp3 decoder also? That would allow consistent behavior and ensure that a peak scan of a file would be useful (say a file peak of 1.5 could be reduced during playback later by the proper amount) unlike now where the OS decoder just clips/truncates it seems.

Unfortunately, the Windows MP3 decoder only produces 16-bit output (which BASS converts to floating-point if the BASS_SAMPLE_FLOAT flag is used).

Oh yeah! BASS (with the 32float DSP flag, 32float decoding/etc flags) on Vista and Win7 does make 32bit float through the entire audio chain possible right? (considering Vista+ is always 32bit float audio right?)

Yes, it appears so. Note that the BASS_CONFIG_FLOATDSP setting doesn't make any difference to the output format, though. It just determines whether 16/8-bit data should be converted to floating-point for FX/DSP functions (and then converted back again). For floating-point output, the channel itself needs to be floating-point (via the BASS_SAMPLE_FLOAT flag).

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #3 on: 4 Jul '11 - 07:26 »
Digging this thread out of the grave to point out this simple code sample which uses MediaFoundation to convert files to PCM: http://msdn.microsoft.com/en-us/library/dd742786(v=vs.85).aspx

I'm tinkering with it now, seeing if I can somehow get a plugin going, but to say my native Win32 coding skills are rusty would be too kind. It does, however, look like a convenient/unified way to make sure BASS works with ALL of the windows codecs in one clean go.

Ionut Cristea

  • Posts: 1559
Re: BASS Windows 7 AAC
« Reply #4 on: 4 Jul '11 - 07:54 »
Media Foundation will be supported by BASS_DSHOW soon, Directshow is already implemented, so i don't find any reason that Ian reinvent the wheel.


Ionut

radio42

  • Posts: 4839
Re: BASS Windows 7 AAC
« Reply #5 on: 4 Jul '11 - 08:23 »
I guess a native MediaFoundation plugin for pure AAC(+) decoding would be much better/cleaner instead of using BASS_DSHOW.
This for the following reasons:
a) BASS_DSHOW has a long history and is still not fully there
b) a lot of users are only insterested in audio processing and don't want/need the video stuff
Just my 2 cents...

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #6 on: 4 Jul '11 - 08:27 »
I'm glad to see BASS_DSHOW making use of it - any estimate on when it will be available?

As far as it being in the main BASS library, I still see it making sense. To your point, Media Foundation is the spiritual successor of DirectShow so it makes sense in BASS_DSHOW. However, on the other hand, bass.dll (especially the mp3-free version) does try to make use of the included Windows codecs - and this is the Microsoft-endorsed way to do so now. I'm with Bernd in that I would still like to see it in the main library of BASS since many of us don't need the full capabilities of DirectShow (video).

Ionut Cristea

  • Posts: 1559
Re: BASS Windows 7 AAC
« Reply #7 on: 4 Jul '11 - 10:23 »
Quote
I guess a native MediaFoundation plugin for pure AAC(+) decoding would be much better/cleaner instead of using BASS_DSHOW.
This for the following reasons:
a) BASS_DSHOW has a long history and is still not fully there
b) a lot of users are only insterested in audio processing and don't want/need the video stuff
Just my 2 cents...

I know BASS_DSHOW have its up and down periods, but now i think this is the best version i've ever implemented in BASS_DSHOW, because it's 99% fully integrated in BASS(pitch, tempo, A/V sync, play/pause/stop/position etc,etc by BASS).
a) Try latest BASS_DSHOW. I think you'll like it :)
b) a NULL video renderer to BASS_DSHOW solve this problem


Quote
I'm glad to see BASS_DSHOW making use of it - any estimate on when it will be available?

As far as it being in the main BASS library, I still see it making sense. To your point, Media Foundation is the spiritual successor of DirectShow so it makes sense in BASS_DSHOW. However, on the other hand, bass.dll (especially the mp3-free version) does try to make use of the included Windows codecs - and this is the Microsoft-endorsed way to do so now. I'm with Bernd in that I would still like to see it in the main library of BASS since many of us don't need the full capabilities of DirectShow (video).

  

  And yes, a build in support for MF codecs in BASS will be great, i'm agree with this. About MF in BASS_DSHOW in the fallowing 2-3 days will be available.

Best regards,
Ionut

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #8 on: 4 Jul '11 - 14:52 »
I've been meaning to look into this for a while, so thanks for the reminder. I'll look into it this week, and hopefully come back with something to try.

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #9 on: 8 Jul '11 - 17:51 »
Just a quick update... Media Foundation support has pretty much been added now, and I think there should be something ready to try early next week.

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #10 on: 8 Jul '11 - 18:03 »
Woo! Awesome, Ian! Can't wait to try it out! Will it be a plugin or part of bass.dll?

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #11 on: 8 Jul '11 - 18:15 »
At the moment, it's built-in. It's looking like it could bloat the DLL by as much as a few KB, but I guess that's the price of progress :)

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #12 on: 8 Jul '11 - 19:10 »
I don't think many will be shedding tears over a few KB :-) Few more questions:

1.) Will this be worked into the MP3-free version?
2.) Suppose I'm running the new BASS without the BASS_AAC extension installed and I open an AAC encoded M4A. I assume that on Windows 7 it will decode the file fine, but on Windows XP or Vista, it will just return a BASS_ERROR_CODEC - does this sound correct?
3.) Is there any other elegant way to know ahead of time which CODECS MediaFoundation will support?
4.) If I had BASS_WMA or BASS_AAC installed along with these new changes, which will take precedence - BASS.DLL or the plugins?

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #13 on: 11 Jul '11 - 18:09 »
Here's something to try...

   www.un4seen.com/stuff/bass-mf.zip

In the same way that Core Audio decoders are tried last thing (after built-in decoders and add-ons) on OSX/iOS, the Media Foundation decoders will be tried last thing on Windows 7. When a Media Foundation decoder is used, the stream's "ctype" will be BASS_CTYPE_STREAM_MF:

Code: [Select]
#define BASS_CTYPE_STREAM_MF 0x10008

Tags are also supported via the following BASS_ChannelGetTags option:

Code: [Select]
#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings

The tag entries are given in their "Shell Name" form, as listed here:

   http://msdn.microsoft.com/en-us/library/ff384862.aspx

Only the string (VT_LPWSTR) entries are currently included.

Unfortunately, I haven't yet been able to get things working quite how I would like. I was hoping to have BASS do the file handling, so that local/custom/internet streams could all be supported, but doing that made the metadata stuff unavailable for some reason. So this build leaves the file handling to Media Foundation, and only supports local files. Hopefully, it will eventually be possible to have BASS do the file handling and still have metadata available (I'm still looking into it).

This is all a bit experimental at this stage, so please report how you get on.

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #14 on: 12 Jul '11 - 17:30 »
Well, I can report that it's working to decode AAC files just fine :-)

My application only deals with local sound files and I use taglib to handle the tags, so I'm not a great test case for the missing functionality you mentioned.

Now - paging radio42 to the thread to update "BASSAddOnGetSupportedFileExtensions() and BASSAddOnGetSupportedFileFilter()" methods to take into account this new functionality :-)
A list of Windows OS versions to supported formats can be found here: http://msdn.microsoft.com/en-us/library/dd757927%28VS.85%29.aspx

radio42

  • Posts: 4839
Re: BASS Windows 7 AAC
« Reply #15 on: 12 Jul '11 - 21:35 »
Sure, Bass.Net will be updated accordingly asap once it's all in!
I just can not always provide a new version with each 'stuff' release ;-)

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #16 on: 12 Jul '11 - 21:37 »
Sorry, I meant to imply "once it's released"

Thanks, Bernd!

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #17 on: 16 Jul '11 - 21:34 »
Ian,

What's the story on using the encoding portion of MF? Is that supported in this release?

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #18 on: 18 Jul '11 - 15:44 »
No, the encoding side of MF isn't supported in the update above. I don't anticipate support for that being added to BASS itself, but I do plan to look into it for the BASSenc add-on after the decoding side of things have been finalised.

Regarding decoding... it's looking like a compromise will have to be made on the question of custom streaming and metadata, as the Shell metadata system (used in the version above) appears to only be supported by MF when it is processing local files; I guess it's implemented in the file reader rather than the parser/decoder. There is also a Media Foundation metadata system, which is working with custom streaming, but that isn't supported by the MP4 parser/decoder, so I'm wondering whether that system is already being depreciated (it was introduced in Vista while Shell metadata was introduced in Win7). For MP4 tags, BASS could parse them itself (as it does on OSX/iOS lately), but what if future MF decoders will only support the Shell metadata system too... The question is what's more important, custom streaming or metadata? I'm thinking custom streaming. I'll post an update shortly (probably tomorrow), in which BASS handles the file stuff and the tags are switched to using the Media Foundation metadata system.

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #19 on: 18 Jul '11 - 17:00 »
When you say "in which BASS handles the file stuff," I take it to mean handling the tags on local files - not any part of the actual sound decoding. Is that correct?

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #20 on: 18 Jul '11 - 17:34 »
No, I was referring to the file opening/reading/etc. Having BASS handle that stuff will allow all of the various streaming sources to be supported, eg. files/memory/callbacks/internet.

Rescator

  • Guest
Re: BASS Windows 7 AAC
« Reply #21 on: 20 Jul '11 - 01:39 »
Regarding decoding... it's looking like a compromise will have to be made on the question of custom streaming and metadata, as the Shell metadata system (used in the version above) appears to only be supported by MF when it is processing local files; I guess it's implemented in the file reader rather than the parser/decoder. There is also a Media Foundation metadata system, which is working with custom streaming, but that isn't supported by the MP4 parser/decoder

I found this http://msdn.microsoft.com/en-us/library/dd742784%28v=VS.85%29.aspx
Please note this text further down though "If Platform Update Supplement for Windows Vista is installed, the AAC audio decoder is available on Windows Vista, but is accessible on Windows Vista only by using the Source Reader. "
Another reason why Win7 is such a better choice than Vista :)

I guess this means that thee are two options (or more?).
A: BASS stream/file handling, Windows decoding of AAC(+) etc. on Win7 only.
B: Windows stream/file handling, Windows decoding of AAC(+) on Win7 and Vista (w/platform update), but no metainfo...

My suggestion is go for option A, and then evaluate if Vista should be considered.
I'm not sure if Windows Update installs the platform update automatically or not, or if the latest service pack for vista includes it.
I do know that stuff like Direct2D and other apis need the platform update to make them available on Vista,
whereas on Windows 7 they are part of the RTM from the start.

Please note that I have not tried to mess around with Msmpeg2adec.dll yet, and it's probably more future proof to do it the proper way (like you are trying to Ian) as that would let BASS support whatever Windows support so...
But it's interesting anyway.

Also (besides my head hurting reading though this) http://msdn.microsoft.com/en-us/library/ms700827%28v=VS.85%29.aspx
are you sure it's not possible to have BASS pass the raw AAC(+) or AAC(+) ADTS (shoutcast etc) stream to the bytestream handler and decoder
and then get that back into BASS afterwards?

It would be really odd (and kinda silly by Microsoft really) if that wasn't possible,
after all the audio guys (Larry Oosterman and the rest) was pretty clever with the audio system IMO as it's now possible to create 3rd party audio processor and stick them in the OS audio chain without messing up the system (ASUS makes use of this to provide 3D audio effects processing for their Xonar audio cards).

I'm sorry I can't point anywhere in particular as I'm a complete noob to the WMF stuff.

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #22 on: 20 Jul '11 - 15:51 »
I found this http://msdn.microsoft.com/en-us/library/dd742784%28v=VS.85%29.aspx
Please note this text further down though "If Platform Update Supplement for Windows Vista is installed, the AAC audio decoder is available on Windows Vista, but is accessible on Windows Vista only by using the Source Reader. "
Another reason why Win7 is such a better choice than Vista :)

I guess this means that thee are two options (or more?).
A: BASS stream/file handling, Windows decoding of AAC(+) etc. on Win7 only.
B: Windows stream/file handling, Windows decoding of AAC(+) on Win7 and Vista (w/platform update), but no metainfo...

I haven't confirmed it yet, but from the documentation it appears that all of the required interfaces are available to Vista in the "Platform Update Supplement", so the MF support should work then too (BASS doesn't specifically check for Win7).

are you sure it's not possible to have BASS pass the raw AAC(+) or AAC(+) ADTS (shoutcast etc) stream to the bytestream handler and decoder
and then get that back into BASS afterwards?

No, that is possible, and is what the update I mentioned above will do :)

There's a slight delay in posting the update as I have run into some trouble with seeking in WMA files (AAC/MP4 is working but not WMA for some reason). Hopefully, that'll be sorted soon.

Ian @ un4seen

  • Administrator
  • Posts: 26146
Re: BASS Windows 7 AAC
« Reply #23 on: 21 Jul '11 - 15:35 »
WMA seeking seems to be sorted now, so here's the aforementiond update...

   www.un4seen.com/stuff/bass-mf.zip

The changes from the previously posted version are... BASS handles the file reading to allow all of the usual streaming sources (file/memory/internet/callbacks) to be supported. The BASS_TAG_MF tags have switched from the Shell metadata system to the Media Foundation metadata system, which appears to be based on Windows Media attributes (like BASS_TAG_WMA tags). The Media Foundation MP4 parser doesn't support the Media Foundation metadata system, so BASS will parse MP4 tags itself and make them available via the BASS_TAG_MP4 tags option (like BASS_AAC does).

This stuff hasn't been tested very much yet, and it may well require some additional tweaking, so please report any problems.

jjohnston

  • Posts: 39
Re: BASS Windows 7 AAC
« Reply #24 on: 23 Jul '11 - 06:33 »
I've included it in my project and am using it now (without other AAC/WMA plugins) - everything seems to be working great so far. Is the binary you've included the MP3-free version of BASS? If not, would it be too much trouble to compile an MP3-free version that uses MF?