18 Jun '13 - 07:27 *
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] 2 3 ... 9
  Reply  |  Print  
Author Topic: BASSmix beta (mixing & resampling add-on)  (Read 93097 times)
Ian @ un4seen
Administrator
Posts: 15352


« on: 16 Oct '05 - 17:22 »
Reply with quoteQuote

A fairly common question is how to mix and/or resample channels. To make that task simple, here's an add-on that'll do it...

   [see the BASS page]
« Last Edit: 30 Jul '07 - 15:07 by Ian @ un4seen » Logged
Wolfgang.Wester
Guest
« Reply #1 on: 18 Oct '05 - 07:39 »
Reply with quoteQuote

@Ian,

looks very promisingly....
How about the performance ?

Cheers, Wolfgang
Logged
Sebastian Andersson
Posts: 372


« Reply #2 on: 18 Oct '05 - 10:37 »
Reply with quoteQuote

How about the performance ?

I think it's fast enough already, or I'm not sure what speed you expected it to process at.
Logged
Sebastian Andersson
Posts: 372


« Reply #3 on: 18 Oct '05 - 11:06 »
Reply with quoteQuote

I wrapped up a C example for BASSmix yesterday. It's based on "contest", and allows users to specify sample rate/channels and the files to mix.

     http://www.un4seen.com/filez/2/contest.c
Logged
Wolfgang Wester
Posts: 19


« Reply #4 on: 18 Oct '05 - 13:40 »
Reply with quoteQuote

Thanks for the example  Cheesy
Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #5 on: 19 Oct '05 - 11:58 »
Reply with quoteQuote

An update is now in the BASSmix ZIP, with a new downmixing option. There are also a couple of bug fixes.
Logged
radio42
Posts: 4030


« Reply #6 on: 19 Oct '05 - 22:13 »
Reply with quoteQuote

Nice work!!!

One thing:
What is the BASS_SPEAKER_xxx in the "BASS_Mixer_StreamAddChannel" good for.

The downmix stuff is clear, but you state, that for any multi-channel sources the respective chans are taken anyhow?!

So when and why to use the BASS_SPEAKER_xxx flags ?

THX

Soon in BASS .NET for C# as well ;-)
Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #7 on: 20 Oct '05 - 13:55 »
Reply with quoteQuote

The SPEAKER flags come into play in exactly the same way as with normal playback channels. If you have a multi-channel mixer, you can place stereo/mono source channels on specific "speakers" in the mix.

The SPEAKER flags do not apply to multi-channel sources, again, just like with normal playback channels Smiley ... If you want, you can downmix a multi-channel source, then you can use the SPEAKER flags with it, ie. use the DOWNMIX flag together with the SPEAKER flag.
Logged
radio42
Posts: 4030


« Reply #8 on: 20 Oct '05 - 20:03 »
Reply with quoteQuote

I see,
so if I have simple stereo sources only
and
the output mixer channel is also only stereo
and
eg. the output mixer already was set up with SPEAKER flag in "BASS_Mixer_StreamCreate"

-> then it wouldn't make much sense to use it - right?!
Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #9 on: 21 Oct '05 - 16:52 »
Reply with quoteQuote

I see,
so if I have simple stereo sources only
and
the output mixer channel is also only stereo
and
eg. the output mixer already was set up with SPEAKER flag in "BASS_Mixer_StreamCreate"

-> then it wouldn't make much sense to use it - right?!

Do you mean it wouldn't make much sense to use SPEAKER flags in the BASS_Mixer_StreamAddChannel calls? If so, yep - you could use BASS_SPEAKER_FRONT, but it wouldn't achieve anything Smiley
Logged
wmm
Posts: 3


« Reply #10 on: 4 Nov '05 - 08:15 »
Reply with quoteQuote

Any VB sample code to mix a few channels? For example I want to mix 3 Mp3 tracks and finally output the mixed one to a WAV. Any help will be appreciated.  Cool
Logged
engineeer
Posts: 86


« Reply #11 on: 4 Nov '05 - 11:16 »
Reply with quoteQuote

  • BASS_MIXER_DOWNMIX definition missing in BASSmix.pas
  • It seems that small amount of data stays in buffer when remove source channel. If remove last source and add new source, part of previous source will be heard
  • Is it possible to add pause/play functions for mixer source? Channel functions don't work because mixer source is decoding channel
« Last Edit: 4 Nov '05 - 11:33 by engineeer » Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #12 on: 4 Nov '05 - 13:50 »
Reply with quoteQuote

Any VB sample code to mix a few channels? For example I want to mix 3 Mp3 tracks and finally output the mixed one to a WAV. Any help will be appreciated.  Cool

If you take the writewav example as a starting point, you would change the "btnLoadFile_Click" stuff to something like this...

chan = BASS_Mixer_StreamCreate(44100, 2, BASS_STREAM_DECODE) ' 44100hz stereo 16-bit mixer
source1 = BASS_StreamCreateFile(BASSFALSE, FileName1, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source1, 0) ' plug source1 into mixer
source2 = BASS_StreamCreateFile(BASSFALSE, FileName2, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source2, 0) ' plug source2 into mixer
source3 = BASS_StreamCreateFile(BASSFALSE, FileName3, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source3, 0) ' plug source3 into mixer

BASS_MIXER_DOWNMIX definition missing in BASSmix.pas

That's strange. I can see it in there Smiley

  BASS_MIXER_DOWNMIX = $400000; // downmix to stereo (or mono if mixer is mono)
 
It seems that small amount of data stays in buffer when remove source channel. If remove last source and add new source, part of previous source will be heard

I guess that's when playing the mixer output? It's because of the playback buffer - there'll be some data from the old channel still in the buffer. You shouldn't hear an overlap though, as the new channel will be equally delayed.

Reducing the buffer length (BASS_CONFIG_BUFFER) will improve things (reduce the latency).

Is it possible to add pause/play functions for mixer source? Channel functions don't work because mixer source is decoding channel

Removing/adding (BASS_Mixer_ChannelRemove/BASS_Mixer_StreamAddChannel) the source channels should have the same effect as pausing/resuming. When the source is re-added, it'll be at the position it was when it was removed.
Logged
wmm
Posts: 3


« Reply #13 on: 4 Nov '05 - 15:41 »
Reply with quoteQuote

Thanks Ian. I am planning to get a shareware license for my product however I need to get some of my issues resolved, one of which I have posted in another thread. Mainly I intend to add a Mixing capability to the applicattion. For now I have done this using 3 handles and using the stereo mix as the selected source. However this is not a true solution.

so what i am looking for is like this -
load 3 files on 3 channels (handles) and show the osc graph.
copy and paste track portions of the tracks to a new track with fade in fade out feature.
save new track as wav file.

Can this be accomplished? Please suggest.
Logged
engineeer
Posts: 86


« Reply #14 on: 4 Nov '05 - 22:55 »
Reply with quoteQuote

I'm getting access violation in bassmix.dll when source channel ends.
Let me know if you need additional info...
Logged
robertpnl
Posts: 37


« Reply #15 on: 5 Nov '05 - 13:47 »
Reply with quoteQuote

I'm getting access violation in bassmix.dll when source channel ends.
Let me know if you need additional info...

Here also. Only with WAV files. By ending a MP3 file, i didn't get a access violation in bassmix.dll.

Here the code that i taken from the bassmix.chm:

// Bass Init
if (!Bass.BASS_Init(-1, 44100, 0, 0, null))
  throw new ApplicationException("Error BAS Init.");

// this will be the final mixer output stream being played
 int mixerStream = BassMix.BASS_Mixer_StreamCreate(44100, 2, 0 );
// now we need some channels to plug them in...
int streamA = Bass.BASS_StreamCreateFile,@"C:\WINDOWS\Media\ding.wav", 0, 0, BASSStream.BASS_STREAM_DECODE | BASSStream.BASS_SAMPLE_FLOAT);
int streamB = Bass.BASS_StreamCreateFile(@"testfile.mp3", 0, 0, BASSStream.BASS_STREAM_DECODE | BASSStream.BASS_SAMPLE_FLOAT);
// finally we plug them into the mixer (just to be sure, we use the downmix option to stereo)
bool okA = BassMix.BASS_Mixer_StreamAddChannel(mixerStream, streamA, (int)BASSStream.BASS_MIXER_DOWNMIX);
//bool okB = BassMix.BASS_Mixer_StreamAddChannel(mixerStream, streamB, (int)BASSStream.BASS_MIXER_DOWNMIX);
// and play it...
Bass.BASS_ChannelPlay(mixerStream, false);
Console.ReadLine();

And when stream A (.wav) is ending the file, a access violation will be viewed.
Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #16 on: 5 Nov '05 - 17:23 »
Reply with quoteQuote

Oops! That crash should be sorted now (update in the BASSmix ZIP).


so what i am looking for is like this -
load 3 files on 3 channels (handles) and show the osc graph.
copy and paste track portions of the tracks to a new track with fade in fade out feature.
save new track as wav file.

Can this be accomplished? Please suggest.

Yes, you could do that with BASSmix. You can position the source channels (BASS_ChannelSetPosition) to their start points before you start processing (BASS_ChannelGetData). BASSmix doesn't have automated attributes, ie. you can't tell it to fade channels in/out (you can use BASS_ChannelSlideAttributes but that'll only be any good during playback). But you can choose how much data to process, so during fades, you could do small amounts, adjust the channel volumes (BASS_ChannelSetAttributes), and repeat.
Logged
engineeer
Posts: 86


« Reply #17 on: 6 Nov '05 - 13:45 »
Reply with quoteQuote

Ian, can you implement autofree of source channels as option?
If not, please suggest efficient way how to accomplish this.
Logged
Ian @ un4seen
Administrator
Posts: 15352


« Reply #18 on: 7 Nov '05 - 17:39 »
Reply with quoteQuote

Ok, I've added support for the BASS_STREAM_AUTOFREE flag in the BASS_Mixer_StreamAddChannel function (update in the ZIP). I've not tested it much yet, so let me know if you have any problems with it.
Logged
3delite
Posts: 627


« Reply #19 on: 7 Nov '05 - 18:29 »
Reply with quoteQuote

If I would use a mixer stream for ASIO output what would be the simplest way to do this?  Roll Eyes
Logged
Pages: [1] 2 3 ... 9
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines