New file formats

Started by Sebastian_Mares,

Sebastian_Mares

Hello!

I was wondering if BASS will support more file formats in a future version. I was specially thinking about the following:

  • Speex (SPX)
  • MPEGplus (MPC)
  • MPEG-4 (MP4) / MPEG-2 (AAC)
  • Lossless formats (Monkey, FLAC, Shorten, WavPack, LA...)
I know that MP3pro requires licensing, but as far as I know it costs only a few dollars. Anyway, I don't think anyone needs it that bad, but MPEGplus is a very used format (have a look at Hydrogen Audio).

Also, it would be cool to add Ogg Vorbis encoding support. ;D

suathd

Although there are many formats available, many of them are useless (including MP3-Pro).
As a result of many comparison tests, the best formats are OGG and WMA. The only disadvantage of the OGG is its encoding time.

P.S. : MP3 pro loses its quality under an equalizer. Moreover, it is not an open format. Its SDK can be obtained from only www.gracenote.com and form of COM objects containing few functions.

In commercial applications, Its one-time paid license about $90000, and its per unit royality requires $15000 for each year. Thomson IIS requires $500000 for sources :-).

Ian @ un4seen

I'm planning to make the "add-on" specs available with the next BASS version, making it possible for anyone to add support for any formats they like.

I'm waiting for the next version before releasing the specs because there are a couple of things that I want to simplify first. That can't be done mid-version (eg. in BASS 1.8a) as it'll affect the current WMA/CD add-ons.

If anyone's really desperate to create an add-on right now, then I'll be willing to give the current details. But, as I say, it'll be a bit simpler with the next version :)

Sebastian_Mares

Thanks Ian! A plugin architecture for BASS would be really nice.

BTW, you talked about simplifying some things - would it be possible to add some functions like "GetArtist", "GetTitle"... and "SetArtist", "SetTitle"... for ID3/Ogg/WMA tags?

Sebastian_Mares

Oh, one more thing... I didn't know that MP3pro has such a high price. I though it costs only 75 cents pro decoder.

My bad. :-/

Ian @ un4seen

QuoteBTW, you talked about simplifying some things - would it be possible to add some functions like "GetArtist", "GetTitle"... and "SetArtist", "SetTitle"... for ID3/Ogg/WMA tags?
I just meant simplifying a few things in how add-ons interface with BASS, to make creating add-ons simpler :)

But, anyway... I'd have to say that I don't envisage encoding or tag editing being built in BASS.DLL - bloatage would result, for things that are not really key to the main purpose of BASS (decoding/playing). I guess "add-ons" are more of a possibility, but I'm sure there must be dedicated encoding/tagging libraries already available, eg. ID3lib, LAME, the OGG SDK.

DanaPaul


QuoteI just meant simplifying a few things in how add-ons interface with BASS, to make creating add-ons simpler :)

DanaPaul <- likes simple :)

Sebastian_Mares

Sebastian Mares <- Is stupid and uses Visual Basic :'(

Ian @ un4seen

Tell you what I could quickly do... create a little DLL that pipes the sample data to an external encoder. You would be able to use almost any encoder you want (LAME, OGGENC, MPPENC, etc...), and it's simple for all concerned :)

DanaPaul


Quote... I could quickly ... create a little DLL that pipes the sample data to an external encoder. You would be able to use almost any encoder you want (LAME, OGGENC, MPPENC, etc...), ...

DanaPaul <- likes pipes and "any" encoders :)

Sebastian_Mares

QuoteDanaPaul <- likes pipes and "any" encoders :)
Yeah, me too! ;D

bigjim

lol this is a funny thread  ;D

bigjim < - likes funny threads

but seriously ian - i being lookin at the speex encoder from http://www.speex.org/

i was gonna make some sort of dll from the c code but its mainly a linux set of software so im not sure if i want to desecrate it.

its mainly used for speech i believe and is based on the ogg idea of compression.

Someone i know has being using it for a call centre application.

Ian @ un4seen

Ok, here it is... http://www.un4seen.com/stuff/bassenc.zip

C/C++, VB and Delphi APIs are included, and a small C example using OGGENC and/or LAME (OGGENC and LAME can be found on the MO3 page).

There's no documentation included at the moment, but it really is ridiculously simple to use. There are only 3 functions...

  • BASS_Encode_Start - starts encoding on a channel
  • BASS_Encode_IsActive - checks if the encoder is still running
  • BASS_Encode_Stop - stops encoding
First you call BASS_Encode_Start, passing the encoder command-line that you want to use (the encoder's input needs to be set to STDIN). Then, if successful, you simply play the channel (or decode, if it's a decoding channel), and the sample data will be sent to the encoder as it's decoded/played. BASS_Encode_IsActive can be used to make sure the encoder is still alive. When you're done encoding, call BASS_Encode_Stop. Simple :)

I was considering allowing multiple encoders per channel (ie. have BASS_Encode_Start return a handle), but for simplicity (no extra handles for you to store), it's currently restricted to one encoder per channel.

Anyway, let me know if you have any problems with it.

ps: bigjim, the Speex encoder works fine with it :D

MB_SOFT

Great!  8)
I can use it on a RECORDCHAN too?

DanaPaul


Quoteit really is ridiculously simple to use.

Thanks for the library.  One question... does this library support multi Bass instances?  If so, I have a multi-instance header file ready to post.

I haven't had a chance to take this library for a spin yet, but me thinks the Delphi header file may need the following constants inserted for clarity and simplicity :)

// BASS_Encode_Start commands
  STDIN  = STD_INPUT_HANDLE;  // -10
  STDOUT = STD_OUTPUT_HANDLE; // -11
  STDERR = STD_ERROR_HANDLE;  // -12

Ian @ un4seen

#15
QuoteI can use it on a RECORDCHAN too?
Not directly, but you can pass the data through a custom decoding channel, and set the encoder on that. For example...
HSTREAM encstream;

DWORD CALLBACK encstreamproc(HSTREAM handle, void *buffer, DWORD length, DWORD user)
{
// the data is already in "buffer", so just return
      return length;
}
Do this in your RECORDPROC...
BOOL CALLBACK RecordProc(void *buffer, DWORD length, DWORD user)
{
      BASS_ChannelGetData(encstream,buffer,length);
...
When you want to start encoding, create the custom stream, and start the encoder...
encstream=BASS_StreamCreate(samplerate,BASS_STREAM_DECODE,&encstreamproc,0);
// ^ add MONO/8BITS/FLOAT flags if appropriate - should be the same format as the sample data you're going to pass through it
BASS_Encode_Start(encstream,...);

QuoteOne question... does this library support multi Bass instances?
Yep, in the same way as the other add-ons (remove "enc" :))
QuoteI haven't had a chance to take this library for a spin yet, but me thinks the Delphi header file may need the following constants inserted for clarity and simplicity :)

// BASS_Encode_Start commands
  STDIN  = STD_INPUT_HANDLE;  // -10
  STDOUT = STD_OUTPUT_HANDLE; // -11
  STDERR = STD_ERROR_HANDLE;  // -12
Why? ;D

When I said "the encoder's input needs to be set to STDIN", I just meant the command-line has to tell the encoder to use STDIN... the DLL will handle the rest :)

Sebastian_Mares

(w00t) This is so great!!! (w00t)
RAD, WORD, GR8!!!
:-*

DanaPaul

A Delphi multiple instance flavor of BassEnc.pas has been uploaded.  This file follows the Bass multiple instance header file conventions established in Bass_Two.pas, BassWMA_Two.pas and BassCD_Two.pas.

http://members.aol.com/wtgdana/private/Bass/

MB_SOFT

Do this in your RECORDPROC...

BOOL CALLBACK RecordProc(void *buffer, DWORD length, DWORD user)
{
     BASS_ChannelGetData(encstream,buffer,length);
 
 


But Bass help state that:
BASS_ChannelGetData should not be called (with RECORDCHAN) from within a RECORDPROC callback.
Is there anymore this limitation?

Ian @ un4seen

It's not using RECORDCHAN in the BASS_ChannelGetData call, it's using the "encstream" :)

It's passing the recorded data through the custom stream, so that it can be encoded. You can also add FX/DSP to recorded data (or any other sample data for that matter) like this.