Author Topic: Mono Streams  (Read 242 times)

Chris Oakley

  • Posts: 78
Mono Streams
« on: 12 Sep '18 - 09:51 »
Quick question regarding making a stream mono. I presume if I wanted to start casting as a mono stream I would have to provide a command line to lame.exe like this

Code: [Select]
lame.exe -m m -a -r -s 44.1 --cbr --flush -h -b 128 --resample 44.1 - -
A stereo stream would be like this

Code: [Select]
lame.exe -r -s 44.1 --cbr --flush -h -b 128 --resample 44.1 - -
Also, if I'm casting as mono, when I create my split mixer which sets the sample rate to match the streams preferred sample rate, I have to make sure I still create the mixer as 2 channels? My understanding is the split slave mixer must always have the same channel configuration as the main / parent mixer. Is that correct? Or is there something else I need to do?

This is how I'm creating the mixer which will be delivering to the mono encoder

Code: [Select]
CastingMixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE)

Ian @ un4seen

  • Administrator
  • Posts: 21211
Re: Mono Streams
« Reply #1 on: 12 Sep '18 - 14:28 »
When you say "split mixer", do you mean a splitter stream created with BASS_Split_StreamCreate? If so, a splitter will have the same sample rate as its source but can have a differen number of channels, eg. the source could be stereo and the splitter mono, or vice versa.

In this case, I believe the combination of "-m m -a" LAME options means that the input should be stereo (LAME will downmix to mono).

Chris Oakley

  • Posts: 78
Re: Mono Streams
« Reply #2 on: 12 Sep '18 - 14:37 »
Yes the splitter stream sorry. I create a split off the main mixer like this:

Code: [Select]
        'Make a split stream off the main mixer
        CastingSplitStream = BassMix.BASS_Split_StreamCreate(MixerChan, BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SPLIT_SLAVE, Nothing)

        'Now make a mixer to resample the split stream - it's this that we pass to the encoder to stream
        CastingMixer = BassMix.BASS_Mixer_StreamCreate(Frequency, TheMainMixerChannels, BASSFlag.BASS_STREAM_DECODE)
        BassMix.BASS_Mixer_StreamAddChannel(CastingMixer, CastingSplitStream, BASSFlag.BASS_MIXER_BUFFER Or BASSFlag.BASS_MIXER_LIMIT)

This has come up because when we originally did this we set TheMainMixerChannels to 1 in the code above and the stream started going double speed.

I then realised that I would need to set TheMainMixerChannels to be the same as the main mixer. But from what you say, you can set it to 1 - which poses the question, why the double speed?

Ian @ un4seen

  • Administrator
  • Posts: 21211
Re: Mono Streams
« Reply #3 on: 12 Sep '18 - 17:36 »
It sounds like the issue there is that the LAME command-line is saying to expect stereo data, so if the data is actually mono then it would end up being encoded at double speed. If it is mono, I think removing "-a" from the command-line should fix the problem.

Chris Oakley

  • Posts: 78
Re: Mono Streams
« Reply #4 on: 14 Sep '18 - 09:29 »
Thanks Ian, with your input we've got it sorted :)