24 May '13 - 21:00 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: downsampling using bass mix  (Read 419 times)
mark123
Guest
« on: 6 Aug '12 - 17:17 »
Reply with quoteQuote

downsampled a file using bass and bassmix libraries.The problem is whenever i see the file properties it still shows 44.1khz.plz help
here is a snippet of code that i used:


int samplerate=5512;
BASS_Init(0, 44100, 0, 0, NULL);
   HSTREAM stream=BASS_StreamCreateFile(FALSE,"2.mp3", 0, 0,BASS_STREAM_DECODE | BASS_SAMPLE_MONO );
   HSTREAM mix=BASS_Mixer_StreamCreate(samplerate, 1,BASS_STREAM_DECODE | BASS_SAMPLE_MONO);
   if(BASS_Mixer_StreamAddChannel(mix, stream,BASS_ATTRIB_SRC))
   {
        //code that sends this mix(resampled data) to a .wav file using appropriate headers
}
Logged
mark123
Guest
« Reply #1 on: 7 Aug '12 - 10:26 »
Reply with quoteQuote

the problem is that the properties of the downsampled file still show 44.1khz as samplerate............plz help..........
Logged
radio42
Posts: 4012


« Reply #2 on: 7 Aug '12 - 14:40 »
Reply with quoteQuote

Can you show your code which "sends this mix(resampled data) to a .wav file using appropriate headers"?

Could it be, that the wav file header is using the sample rate of the original source stream instead of the mixer?
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #3 on: 7 Aug '12 - 14:52 »
Reply with quoteQuote

Yep, it sounds like the "appropriate headers" may not actually be appropriate Smiley

If you aren't already doing so, you could use the BASSenc add-on to handle the file writing. For example, you could do something like this...

BASS_Encode_Start(mix, "output.wav", BASS_ENCODE_PCM|BASS_ENCODE_AUTOFREE, 0, 0); // set a WAV writer on the mixer

Please see the BASS_Encode_Start documentation for details. Also see the BASS_Mixer_StreamCreate and BASS_Mixer_StreamAddChannel documentation for a list of valid flags, as BASS_SAMPLE_MONO and BASS_ATTRIB_SRC aren't valid there.
Logged
mark123
Guest
« Reply #4 on: 8 Aug '12 - 06:09 »
Reply with quoteQuote

thanks done it using BASSenc
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines