Author Topic: needed help for bass headphone  (Read 690 times)

juelin

  • Posts: 6
needed help for bass headphone
« on: 27 May '24 - 13:35 »
Hello,
I'm new here. My name is Jürgen from Mannheim Germany and I'm 74 year old.
I writting a program at Delphi 11.2 on Windows 10.
I am a radioamateur and i will make a program which receive weatherfax from satellite.
So I receive the Audiosignal from mein Receiver at Soundcard 8_USB.
I'm writtung the sound to a WAV-File.
It working well.
But I want to control the sound with my headphone at soundcard 6-USB
But there are no sound. I don't know why.
I show you the important instruction of my program
audioein2 = Number of soundcard 8-USB from BASS_RecordGetDevice
audioaus2 = Number of Soundcard 6-USB from BASS_GetDevice
Code: [Select]
    if BASS_Init(audioaus2,44100,0,Handle,nil) then
    begin
      bassret:=BASS_Start;
      bassret:=BASS_SetConfig(BASS_CONFIG_BUFFER,50);
      bassret:=BASS_SetConfig(BASS_CONFIG_DEV_BUFFER,50);
      bassret:=BASS_SetDevice(audioaus2);
      ChannelOutput:=Bass_StreamCreate(44100,2,Bass_Sample_Float or BASS_STREAM_DECODE,@Proc_Out,nil);
      if ChannelOutput > 0 then
      begin
        bassret:=BASS_ChannelPlay(ChannelOutput, False);
        bassret:=BASS_ChannelSetAttribute(ChannelOutput,BASS_ATTRIB_VOL,1);
        if BASS_RecordInit(audioein2) then
        begin
          if InitDevice(audioein2) then
          begin
            bassret:=BASS_RecordSetInput(0,BASS_INPUT_ON,-1);
            ChannelInput:=BASS_RecordStart(44100,2,0,@RecordingCallback,nil);
            if (ChannelInput > 0) then
            begin
              lautin:=lautina;
              bassret:=BASS_ChannelPlay(ChannelInput, True);
              bassret:=BASS_ChannelGetInfo(ChannelInput,audioinfo);
              bassret:=BASS_ChannelSetAttribute(ChannelInput,BASS_ATTRIB_VOL,lautin/100);
.......................

function Proc_Out(Handle: HRecord; buffer: Pointer; length: DWord; user: Pointer): boolean; stdcall;
  var x2: Cardinal;
begin
  Result:=True;
end;

function RecordingCallback(Handle: HRecord; buffer: Pointer; length: DWord; user: Pointer): boolean; stdcall;
  var rueck: Boolean;
  var x4: integer;
  var x2: Cardinal;
  var x8: string;
begin
  rueck:=False;
  if Length > 0 then
  begin
    x2:=WaveStream.Write(buffer^,length);
    x2:=Bass_StreamPutData(ChannelOutput,buffer,length);
    rueck:=True;
    x4:=satname.Length;
    if x4 > 3 then
    begin
      x8:=Copy(satname,1,4);
      if modulation <> '' then
      begin
        if x8 = 'AFU-' then
        begin
// RTTY
        end else begin
// FAX
// must have the real Volume
        end;
      end;
    end else begin
      rueck:=False;
    end;
  end;
Can anybody help me?
Another Questions:
How ca I get the real Volume of the Sound?
  the instruction 'bassret:=BASS_ChannelGetAttribute(ChannelInput,BASS_ATTRIB_VOL,volume);'brings only the set volumelevel, no change.
I have seen at this forum a version with BASS_Mixer. But they need the WASAPI and I don't know where I get it.
How can I get the real Frequencies of the Audiosignal?
Satellite Audiosignal is 2400 Hz AM.
Thank you and kind regards
Jürgen

Ian @ un4seen

  • Administrator
  • Posts: 26095
Re: needed help for bass headphone
« Reply #1 on: 27 May '24 - 15:11 »
If I understand correctly, you want to listen to the recording while it's recording? If so, you could make the output stream (ChannelOutput) a "push" stream and call BASS_StreamPutData to feed it in your RECORDPROC (RecordingCallback). I see you are already calling BASS_StreamPutData, so you just need to change the BASS_StreamCreate call to create a push stream:

Code: [Select]
      ChannelOutput:=Bass_StreamCreate(44100,2,0,STREAMPROC_PUSH,nil);

Note that the output stream must have the same sample format as the recording, ie. don't use BASS_SAMPLE_FLOAT in one without the other.

Another Questions:
How ca I get the real Volume of the Sound?

It sounds like BASS_ChannelGetLevel(Ex) may be what you're looking for. Please see the documentation for details.

juelin

  • Posts: 6
Re: needed help for bass headphone
« Reply #2 on: 27 May '24 - 19:23 »
Hello Ian,
thank you for yor helpful instruction.
Now it works all.
But 1 Problem.
If I have a microphone as input the sound is ok.
But when I use my Shortwavereceiver when people speak they have a very deep voice and speak slowly..
What is that?
And at last how can I get the frequenzy of the audio stream?
kind regards
Jürgen

juelin

  • Posts: 6
Re: needed help for bass headphone
« Reply #3 on: 27 May '24 - 19:49 »
here is an example.

Chris

  • Posts: 2217
Re: needed help for bass headphone
« Reply #4 on: 28 May '24 - 00:23 »
Hi
 
Code: [Select]
var Freq: integer;
 BASS_ChannelGetAttribute(FChannel, BASS_ATTRIB_FREQ,round(Freq);

by the way  the Shortwavereceiver will have a other freq (Satellite Audiosignal is 2400 Hz) and  your Bass_StreamCreate(44100)
 

juelin

  • Posts: 6
Re: needed help for bass headphone
« Reply #5 on: 28 May '24 - 10:30 »
hello chris,
this is not the real frequenzy of audio.
I need the real frequenzy of the bigest audiosignal.
best regards
Jürgen

Ian @ un4seen

  • Administrator
  • Posts: 26095
Re: needed help for bass headphone
« Reply #6 on: 28 May '24 - 17:18 »
If I have a microphone as input the sound is ok.
But when I use my Shortwavereceiver when people speak they have a very deep voice and speak slowly..

Please confirm the sample format of the input (recording?) and output. It sounds like there's a mismatch, eg. the output has a lower sample rate or perhaps it's mono instead of stereo.

I need the real frequenzy of the bigest audiosignal.

You can find the peak frequency in FFT data from BASS_ChannelGetData. There's some discussion and code for that in this old thread:

   www.un4seen.com/forum/?topic=20030

juelin

  • Posts: 6
Re: DetectPeakFrequency
« Reply #7 on: 28 May '24 - 22:04 »
Hello Ian,
sorry I found the solution for my problem with the deep voice.
At my stream for input I use the following instruction.
     ChannelInput:=BASS_RecordStart(44100,2,0,@RecordingCallback,nil);
When I use the microphone it works well, but when I use my shortwavereceiver the sound was not ok.
so I found in description: when I set the frequenzy to 0 the system found the frequenzy by him self.
The frequenzy from my shortwavereceiver is 48000 Hz.
now it works.
thank you and good luck
Jürgen

jpf

  • Posts: 196
Re: needed help for bass headphone
« Reply #8 on: 28 May '24 - 23:13 »
You should better attach a sample of the audio for which you want to find the frequency. From your sayings I suspect it may not be voice but data transmited as FSK modulation of a 2400 Hz audio carrier which in turns AM the microwave RF satellite carrier. Back in the early 70s when I was working at a ham radio repair shop this method was used to transmit fax, telemetry, and even morse code. Later PSM and QAM were used as well.