Author Topic: Problem of recording sound from microphone if the audio outputs are turned off  (Read 156 times)

lamborgine

  • Posts: 3
I need to record audio from a microphone, but if all audio outputs are disabled on windows, an MP3 BASS_ERROR_FILEOPEN error occurs. In the code, an error occurs after the execution of the BASS_Encode_Start function, it returns 0, which throws an exception.

Code: [Select]
RecStream: = BASS_Encode_Start (Stream, PChar ('lame.exe --abr 56 -mm - rec.mp3'), BASS_ENCODE_AUTOFREE or BASS_ENCODE_FP_32BIT or BassUnicode, nil, nil)
How can this be fixed?

Ian @ un4seen

  • Administrator
  • Posts: 23553
If I understand correctly, you have no output devices enabled in Windows but you do have a recording device (microphone) enabled? Output devices shouldn't have any bearing on encoding from a recording device, so it's strange if that is what you're seeing. Are your BASS_RecordInit and BASS_RecordStart calls (before the BASS_Encode_Start call) definitely successful, ie. returning true? Does the problem still happen if you write a WAV file instead?

Code: [Select]
RecStream: = BASS_Encode_Start (Stream, PChar ('rec.wav'), BASS_ENCODE_AUTOFREE or BASS_ENCODE_PCM or BassUnicode, nil, nil)

lamborgine

  • Posts: 3
Microphone in windows is detected. BASS_RecordInit and BASS_RecordStart return true. I tried to write wav, the file is not created and there are no errors. I took an example of sound recording from the site, it works with the audio outputs turned off. So the problem is somewhere in my code. I will look for. Thanks.

lamborgine

  • Posts: 3
I figured out, the problem was that if you do not use the BASS_ENCODE_PCM flag when there are no audio outputs, then BASS_Encode_Start will return 0. Is this the correct behavior? Can you do something about this?

Chris

  • Posts: 1933
I don`t think so.
for Bass_encode is a realoutput not needed.
maybe something with the lame binary is not ok.
You can try also to test that with bassenc_mp3 .


Ian @ un4seen

  • Administrator
  • Posts: 23553
I figured out, the problem was that if you do not use the BASS_ENCODE_PCM flag when there are no audio outputs, then BASS_Encode_Start will return 0. Is this the correct behavior? Can you do something about this?

That sounds like the LAME.EXE file probably can't be found. You could try providing its full path in your BASS_Encode_Start call, or use BASS_Encode_MP3_StartFile instead (from the BASSenc_MP3 add-on).