Author Topic: HELP! Bass.Net recording issue...problem exists in sample code, too  (Read 1385 times)

blugrasmaniac

  • Posts: 2
Hi all,  I have a simple task of recording an .mp3 file using the input device.  This is not too difficult, given the amount of sample code provided in the Bass.Net install.

However, I am experiencing a problem with the volume and quality of the recording stream.  As a test case, if I say "ahhhh..." and hold that out, the peak values that are sent to the Recording callback function decrease more and more until it bottoms out at a very low volume.  If I vary the volume of my voice quite a bit or take a breath, the recording volume temporarily bounces back to normal.

Below is the code I am using.  Listen to this mp3 http://www.box.net/shared/msug7xf4aq for an example of what I am referring to.  This same problem exists if I run the Encoder C# sample.

Please help!! Any ideas are appreciated.  :)  Thanks!

Code: [Select]
        private void _StartRecording(string fileName)
        {
            //just before starting recording, set input line level to saved position
            float level = ((float)Properties.Settings.Default.LineVolume) / 100;
            Bass.BASS_RecordSetInput(_currentInput, BASSInput.BASS_INPUT_ON, level);

            // start recording paused
            _myRecProc = new RECORDPROC(MyRecording);
            _recHandle = Bass.BASS_RecordStart(44100, 1, BASSFlag.BASS_RECORD_PAUSE, _myRecProc, IntPtr.Zero);

            lame = new EncoderLAME(_recHandle);
            lame.InputFile = null;    //STDIN
            lame.LAME_Bitrate = Convert.ToInt32(EncoderLAME.BITRATE.kbps_192);
            lame.LAME_Mode = EncoderLAME.LAMEMode.Default;
            lame.LAME_TargetSampleRate = Convert.ToInt32(EncoderLAME.SAMPLERATE.Hz_44100);
            lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality;

            //lame.OutputFile = fileName;
            lame.OutputFile = @"c:\temp\test.mp3";

            // really start recording
            lame.Start(null, IntPtr.Zero, false);

            Bass.BASS_ChannelPlay(_recHandle, false);

        }

        private void _StopRecording()
        {
            Bass.BASS_ChannelStop(_recHandle);
            if (lame != null)
            {
                lame.Stop();
            }
        }

        // the recording callback
        private unsafe bool MyRecording(int handle, IntPtr buffer, int length, IntPtr user)
        {
            return true;
        }

aybe

  • Posts: 145
Don't you have some microphone enhancements set in Windows ?

On my driver they come set on by default ...

blugrasmaniac

  • Posts: 2
Thanks for the tip.  I did some digging, and yes, there were some advanced "enhancements" enabled in windows.  I turned them off and it is better, although not eliminated.  However, I think you have answered the root of my question, which is that there's nothing wrong with the way I'm trying to record that is causing the issue.

I can watch the level meters in the Windows device setup, and they exhibit the same behavior, so it looks like my code is capturing the device output properly.

Thanks again!

aybe

  • Posts: 145
You welcome  :D