Author Topic: rectest recording very slowly  (Read 627 times)

dbaxter

  • Posts: 81
rectest recording very slowly
« on: 7 Oct '23 - 16:57 »
Built the rectest example for Delphi just as it comes and the resulting file is a vveerryy ssslllooowww recording of what the microphone hears. It sounds like what they use to disguise voices on a mystery show. What could be causing this? Using Delphi 11.3 on a Windows 11 machine. Date on the rectest.pas file is 10/27/21. Thank you.
..Dave

Chris

  • Posts: 2210
Re: rectest recording very slowly
« Reply #1 on: 7 Oct '23 - 17:04 »
Hi do you have set "What you here/StereoMix" or the Mic ?

dbaxter

  • Posts: 81
Re: rectest recording very slowly
« Reply #2 on: 7 Oct '23 - 21:45 »
Windows is set for the Mic. Set to Stereo Mix, you don't get anything recorded.

Ian @ un4seen

  • Administrator
  • Posts: 26026
Re: rectest recording very slowly
« Reply #3 on: 9 Oct '23 - 12:25 »
To check whether the problem is something specific to the Delphi version, please try running the pre-compiled RECTEST.EXE example included in the BASS package (C\BIN folder) and see if you can reproduce the problem with that.

dbaxter

  • Posts: 81
Re: rectest recording very slowly
« Reply #4 on: 9 Oct '23 - 19:45 »
Yes, the precompliled version still has the problem. I still have a Windows 10 machine around, I'll copy it there to see if it's different and report back.

dbaxter

  • Posts: 81
Re: rectest recording very slowly
« Reply #5 on: 9 Oct '23 - 21:01 »
Update - the C version has additional output selections from the Delphi one and if I select the Mono 41000  option, it does work! Now, I have to figure out how to get Delphi to show that option. (C is not a language I know).
« Last Edit: 9 Oct '23 - 21:07 by dbaxter »

Chris

  • Posts: 2210
Re: rectest recording very slowly
« Reply #6 on: 9 Oct '23 - 22:59 »
Ah yes I see that C Version is much newer as the Delphi Version.
I`m at this moment a little bit busy with 2 other Delphi Projects , but i will look to update the Demo Demo this Week.
« Last Edit: 10 Oct '23 - 09:46 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 26026
Re: rectest recording very slowly
« Reply #7 on: 10 Oct '23 - 15:22 »
Update - the C version has additional output selections from the Delphi one and if I select the Mono 41000  option, it does work! Now, I have to figure out how to get Delphi to show that option. (C is not a language I know).

Interesting. Does it also sound alright if you select the Mono 22050 or 48000 options? If you check the microphone device's properties in the Sound control panel, what is its "Default Format" set to?

dbaxter

  • Posts: 81
Re: rectest recording very slowly
« Reply #8 on: 11 Oct '23 - 05:03 »
Windows reports the microphone to be Mono, 16 bit, 48000.
Using the C version that has the input options gives good recordings at all 3 bit rates and mono. Stereo selections at 44100 and 22050 give slow recordings, 48000 is OK.

So my initial problem came from the Delphi sample not having those input selections.

I'll see if I can figure out what needs to change since Chris is busy. It's not the line

Code: [Select]
  rchan := BASS_RecordStart(44100, 2, 0, @RecordingCallback, nil);

because if I change that to 48000, The recording now sounds like Micky Mouse.

Chris

  • Posts: 2210
Re: rectest recording very slowly
« Reply #9 on: 11 Oct '23 - 09:06 »
Hi, for a fast fix (on the fly untested)you can try the following.
If the Mic does only support mono so you must change 2 things in the Delphi Demo
 rchan := BASS_RecordStart(Samplerate, Channels, 0, @RecordingCallback, nil);
so
rchan := BASS_RecordStart(44100, 1, 0, @RecordingCallback, nil);

in the wavehdr (line 154)
just change wNumChannels to 1
and set dwSampleRate to one of the supported Samplerates.
(the supported Samplerates can you get via Bass_RecordGetInfo).

e.g or use The device's current sample rate, changing the wavehdr and BASS_RecordStart :
// the WaveHeader (wavehdr) is in the Demo based on 44100, 2 Channels, changing the following make it more flexible
Code: [Select]
var rInfo :  BASS_RECORDINFO;
   Bass_RecordGetInfo(rInfo);
with wavehdr do
begin
  wBitsPerSample := 16; 
  dwSampleRate := rInfo.freq;
  wNumChannels := (rInfo.formats shr 24);
  wBlockAlign := wNumChannels * wBitsPerSample div 8;
  dwBytesPerSec := dwSampleRate * wBlockAlign;
end;
rchan := BASS_RecordStart(rInfo.freq, (wavehdr.wNumChannels), 0, @RecordingCallback, nil);
   


« Last Edit: 11 Oct '23 - 14:08 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 26026
Re: rectest recording very slowly
« Reply #10 on: 11 Oct '23 - 13:33 »
Windows reports the microphone to be Mono, 16 bit, 48000.
Using the C version that has the input options gives good recordings at all 3 bit rates and mono. Stereo selections at 44100 and 22050 give slow recordings, 48000 is OK.

Ah, I think I see what's going wrong there. Here's a BASS update for you to try:

   www.un4seen.com/stuff/bass.zip

Please let me know if you still see the problem happening.

dbaxter

  • Posts: 81
Re: rectest recording very slowly
« Reply #11 on: 11 Oct '23 - 21:03 »
Thank you both for your efforts. Using the changes from Chris and adding the rest of the wave header:
Code: [Select]
with wavehdr do
begin
    riff := 'RIFF';
    len := 36;
    cWavFmt := 'WAVEfmt ';
    dwHdrLen := 16;
    wFormat := 1;
  wBitsPerSample := 16;
  dwSampleRate := rInfo.freq;
  wNumChannels := (rInfo.formats shr 24);
  wBlockAlign := wNumChannels * wBitsPerSample div 8;
  dwBytesPerSec := dwSampleRate * wBlockAlign;
    cData := 'data';
    dwDataLen := 0;
end;
works fine. It works with both the old and new bass.dll, so, Ian, it's not clear you need to change anything. Using the  new bass.dll with the old code works also.
Thanks again for the support!
..Dave