Recent

Author Topic: UOS - recording issue  (Read 452 times)

process_1

  • Guest
UOS - recording issue
« on: July 17, 2020, 04:52:59 pm »
Demo: simplerecorder

While testing UOS, this weird noise appears while trying to record from MIC without actual sound/voice (attached).

For instance, Audacity and Skype recording is fine.

FPC 3.2.0, Lazarus 2.0.10, Linux distro Neon 64-bit
« Last Edit: July 17, 2020, 05:06:25 pm by process_1 »

Fred vS

  • Hero Member
  • *****
  • Posts: 1872
    • StrumPract is the musicians best friend
Re: UOS - recording issue
« Reply #1 on: July 17, 2020, 05:21:36 pm »
Quote
While testing UOS, this weird noise appears while trying to record from MIC without actual sound/voice (attached).

Did you try the SimpleRecorder demo?
Is it ok?

The bad sound in your attachment is typically from a wrong sample format used in code.

What code are you using to save the record?

What audio driver are you using, pure ALSA or PulseAudio?

I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

process_1

  • Guest
Re: UOS - recording issue
« Reply #2 on: July 17, 2020, 05:29:16 pm »
As noticed, I have tested SimpleRecorder demo and this is result from it (just made MP3 from WAV in order to be able to attach it). All default demo  parameters, used as is, no changes where made in the latest code from github.

ALSA is present here by default and as well pulseaudio is running as daemon.

« Last Edit: July 17, 2020, 05:32:50 pm by process_1 »

Fred vS

  • Hero Member
  • *****
  • Posts: 1872
    • StrumPract is the musicians best friend
Re: UOS - recording issue
« Reply #3 on: July 17, 2020, 05:44:25 pm »
Quote
Default parameters, uses as is.

For recording, the default parameter is set as format int16, 2 channels and suggested latency.

I fear that if the sound is not ok using default parameters, you should use uos_AddFromDevIn() with custom parameters.

Code: Pascal  [Select][+][-]
  1. function AddFromDevIn(Device: cint32; Latency: CDouble;
  2.   SampleRate: cint32; OutputIndex: cint32;
  3.   SampleFormat: cint32; FramesCount : cint32 ; ChunkCount: cint32): cint32;
  4. // Add a Input from Device Input with custom parameters
  5. // Device ( -1 is default Input device )
  6. // Latency  ( -1 is latency suggested ) )
  7. // SampleRate : delault : -1 (44100)
  8. // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to a existing OutputIndex  (if multi-output then OutName = name of each output separeted by ';')
  9. // SampleFormat : default : -1 (1:Int16) (0: Float32, 1:Int32, 2:Int16)
  10. // FramesCount : default : -1 (4096)
  11. // ChunkCount : default : -1 (= 512)
  12. //  result :  otherwise Output Index in array  -1 = error
  13. // example : OutputIndex1 := AddFromDevice(-1,-1,-1,-1,-1, -1);
 
Do you use a 2 channels input audio card?

If no, you should use uos_AddIntoFile() with custom parameters.

Code: Pascal  [Select][+][-]
  1. function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: cint32;
  2.   Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32;
  3. // Add a Output into audio wav file with custom parameters from TFileStream
  4. // PlayerIndex : Index of a existing Player
  5. // FileName : filename of saved audio wav file
  6. // SampleRate : delault : -1 (44100)
  7. // Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...)
  8. // SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16)
  9. // FramesCount : default : -1 (= 65536)
  10. // FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom);
  11. //  result :Output Index in array  -1 = error
  12. // example : OutputIndex1 := uos_AddIntoFile(0,edit5.Text,-1,-1, 0, 1);




I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

process_1

  • Guest
Re: UOS - recording issue
« Reply #4 on: July 17, 2020, 06:13:37 pm »
I don't really know what is the audio card, it is integrated with X470 AOURUS motherboard, CPU is Ryzen 2400G.

I suspect this as well may be due multiple core CPU ( 4 cores, 8 hyperthread) detection, as some earlier Audacity had similar issues with recording speed and reproduced it at least twice faster.

Well, I may try tomorrow to play with a bit and find is it and what will work.
« Last Edit: July 17, 2020, 06:16:08 pm by process_1 »

Fred vS

  • Hero Member
  • *****
  • Posts: 1872
    • StrumPract is the musicians best friend
Re: UOS - recording issue
« Reply #5 on: July 17, 2020, 06:22:26 pm »
Quote
Audacity had similar isssues with recording speed and reproduced it at least twice faster.

Audacity uses the same libraries as uos: PortAudio, SndFile and Mpg123.

If it works with Audacity, with uos and custom parameters, it should work too.
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

process_1

  • Guest
Re: UOS - recording issue
« Reply #6 on: July 17, 2020, 06:28:11 pm »
Well, I think Audacity from default repository (apt-get) have such mentioned issue, but not from snap - that version works fine.

"Record my desktop" also works fine, other recording tools works fine, etc.
A bit of mistery, I'm afraid...

Fred vS

  • Hero Member
  • *****
  • Posts: 1872
    • StrumPract is the musicians best friend
Re: UOS - recording issue
« Reply #7 on: July 18, 2020, 04:50:00 pm »
Quote
A bit of mistery, I'm afraid...

You may try the uos example DeviceInfos.lpr.

It will give the configuration and feature of your audio devices.

And you may adapt your code according to that info.
I use Lazarus 2.0.6 32/64 and FPC 3.2.0 32/64 on Debian 10.2 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs
https://gitlab.com/fredvs

 

TinyPortal © 2005-2018