Author Topic: Cant get bassmix to resample properly.......  (Read 1978 times)

Lunchbox4eva

  • Posts: 21
Im trying to use BassMix to resample.... my code in VB.....
Code: [Select]

Dim mixstream As Long
Dim Stream As Long
Dim buffer(0 To 10000) As Long
Dim counter As Long
Dim Datasize As Long
Dim buffersize As Long
Dim samplerate as long

Dest_free_file = FreeFile
buffersize = 10000
Datasize = 0
samplerate=22050

mixstream = BASS_Mixer_StreamCreate(samplerate, 2, BASS_STREAM_DECODE)

If BASS_ChannelIsActive(Stream) <> BASS_ACTIVE_PLAYING Then
    Stream = BASS_StreamCreateFile(0, SourceFilename, 0, 0, BASS_STREAM_DECODE)
    result = BASS_Mixer_StreamAddChannel(mixstream, Stream, BASS_STREAM_DECODE)

       Open DestinationFilename For Binary Shared As #Dest_free_file  ' Open file.
                Seek Dest_free_file, FileLen(DestinationFilename) + 1
                Put #Dest_free_file, , "data"
                Put #Dest_free_file, , Datasize
                    Do
                      result = BASS_ChannelGetData(mixstream, buffer(0), buffersize)
                      Put #Dest_free_file, , buffer
                    Loop Until BASS_ChannelGetPosition(Stream) >= BASS_ChannelGetLength(Stream)
       
       Close #free_file   ' Close file.

End If



So im taking a 48 k wav and truying to downsample to 22050 ( as a test...) and it just wont work..what am I missing?

Cheers


Lunchbox4eva

  • Posts: 21
Re: Cant get bassmix to resample properly.......
« Reply #1 on: 15 Nov '06 - 17:28 »
Ok I sorted it....... should read the help better I hadnt realiseed the returned buffer was in bytes not samples...works a treat now  :P