23 May '13 - 00:10 *
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: Bass Create File Bytes Error  (Read 358 times)
Blink123123
Posts: 6


« on: 18 Jun '12 - 17:31 »
Reply with quoteQuote

Hello,
I am designing an application that runes music at a certain mp3 Sample Rate.
I Used
Player1 = Bass.BASS_StreamCreateFile(Songs(CurrPlay), Integer.Parse(MixPoints(CurrPlay, 0) / 4), 0, BASSFlag.BASS_STREAM_DECODE)

Where MixPoints (Currplay,0) contains the starting position of the song in bytes.
But there is always a small delay in it
I tried:
Player1 = Bass.BASS_StreamCreateFile(Songs(CurrPlay), 0, 0, BASSFlag.BASS_STREAM_DECODE)
it worked
I started trying going up a bit from 0 till 123034 no audio was outputted. after that
Player1 = Bass.BASS_StreamCreateFile(Songs(CurrPlay), 123035, 0, BASSFlag.BASS_STREAM_DECODE)
Worked.
This value varies from one song to another
So there is an empty space that is taking "123034" but what is it ? and how can i call a function that returns this value
so my start position is accurate.
I'm using the latest dlls
Logged
Ian @ un4seen
Administrator
Posts: 15269


« Reply #1 on: 18 Jun '12 - 18:09 »
Reply with quoteQuote

Are you sure your MP3 files don't just have some silence at the beginning, eg. is it not present with other players? If so, please upload an example troublesome file to have a look at here...

   ftp.un4seen.com/incoming/

If the files do contain silence, and you would like to skip it, you can use BASS_ChannelSetPosition (rather than the BASS_StreamCreateFile "offset" parameter) for that. Detecting the silence and skipping it could be done something like this...

DWORD silence=0;
while (BASS_ChannelIsActive(handle)) {
short buf[20000];
int a, b;
a=BASS_ChannelGetData(handle, buf, sizeof(buf)); // decode some data
a/=sizeof(short); // bytes to samples
for (b=0; b<a && !buf[b]; b++) ; // count silent samples
silence+=b*sizeof(short); // add it to the total
if (b<a) break; // sound has begun!
}
BASS_ChannelSetPosition(chan, silence, BASS_POS_BYTE); // seek to the start of the sound

You may also want to add the BASS_STREAM_PRESCAN flag to your BASS_StreamCreateFile call, to enable precise seeking on MP3 files.
Logged
Blink123123
Posts: 6


« Reply #2 on: 18 Jun '12 - 19:22 »
Reply with quoteQuote

Thank you for your reply.
But no i dont want to skip silence i want to skip lets say 20 secs from the file.
The thing is when im using createfile("offset") the mp3 doesent play at all
Plus the silence in the mp3 is about 0.3 secs
im telling the prog to skip 500 samples lets say
at that offset no sound occures for as long as i wait.
Logged
Blink123123
Posts: 6


« Reply #3 on: 18 Jun '12 - 19:33 »
Reply with quoteQuote

I used BASS_ChannelSetPosition(Player, x) using bass_mix it works now
Logged
Ian @ un4seen
Administrator
Posts: 15269


« Reply #4 on: 19 Jun '12 - 16:24 »
Reply with quoteQuote

The thing is when im using createfile("offset") the mp3 doesent play at all

It might be that there is a large ID3v2 tag block at the start of the file, and by using an offset, BASS misses the tag header and therefore doesn't know where the tag ends and MP3 data begins. That's just another reason why BASS_ChannelSetPosition should be used instead of the BASS_StreamCreateFile "offset" parameter Smiley
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines