Re: [hatari-devel] Re: PortAudio replaced

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Thomas,

I've done more tests, without success.
- I've listed all my record devices and forced the USB one directly into the code
- I've changed my microphone to a standard 3.5mm jack one
- I've checked is request and obtain are equal (they are)

I started to suspect my SDL library, so I've quickly created an SDL2 program that records and immediatly replays sound and it works.


Maybe something that could be interresting :

I've added a printf ("CB\n"); in the callback function.
It displays CB in columns in the console window.
But instead of scrolling "fluently", it displays a burst of lines, then it "freezes" during 2 seconds, then it displays again a burst of lines, and so on.

With the recorder program I used to test SDL, I also added a printf in the Callback function, and "CB" scrolls fluently.



I checked the SDL wiki function SDL_LockAudioDevice : https://wiki.libsdl.org/SDL_LockAudioDevice

--> If your application fails to unlock the device appropriately, your callback will never run, you might hear repeating bursts of audio

It really looks like the problem I encounter.

Maybe this will ring a bell !


I don't know where to search now.

Regards
Laurent



----- Mail original -----
De: "Laurent Sallafranque" <laurent.sallafranque@xxxxxxx>
À: hatari-devel@xxxxxxxxxxxxxxxxxxx
Envoyé: Mardi 11 Janvier 2022 21:21:08
Objet: Re: [hatari-devel] Re: PortAudio replaced

Thomas,


Can you try

#define FRAMES_PER_BUFFER 4096  // instead of 512

to see if the sound with SDL2 is better (I see this value very often in 
examples).

Regards

Laurent



Le 11/01/2022 à 19:13, Laurent Sallafranque a écrit :
> Hi thomas,
>
>
> I've done many tries yesterday evening without success for now.
>
> I've forced the microphone in hard in the code, I've forced 
> frequencies, added some printf, read about SDL sound recording, ...
>
>
> There must be a little something, but I still haven't found what.
>
> I continue to investigate.
>
> Regards
>
> Laurent
>
>
>
> Le 11/01/2022 à 17:49, Thomas Huth a écrit :
>> Am Mon, 10 Jan 2022 00:11:51 +0100
>> schrieb Laurent Sallafranque <laurent.sallafranque@xxxxxxx>:
>>
>>> Hi,
>>>
>>> I'll try to complete my reply:
>>>
>>>> 1) Which Linux distro and which SDL version are you using?
>>> Distro: Ubuntu 20.04.3 LTS
>>> sdl :     using SDL2 v2.0.10
>> Ok, thanks, so that should be fine, I guess. I read somewhere about
>> problems with microphone input in SDL versions < 2.0.5, but I don't
>> think that these versions are still in use these days (i.e. in
>> maintained distros).
>>
>>>> 2) Do you have multiple microphone inputs on your computer? E.g. a
>>>> direct mic on the Laptop and one in the dock? If so, could it be
>>>> that SDL uses a different default mic than PortAudio?
>>> Yes, at least 1 mic in front and another one at the rear of the
>>> computer.
>>>
>>> And the headphone I use for my tests is an USB one with a microphone.
>> Could you please check whether the input now comses from one of these
>> other inputs? Maybe we need to add an input selector now...
>>
>>>> are these freely available somewhere?
>>> You can find them here (I don't know if it's free or not, but at
>>> least, it's for testing purpose).
>>>
>>> If you test with AFM, just stop the equalizer (it makes a very
>>> glitchy sound, I've never found why).
>>>
>>> http://christophe.bray.free.fr/informatique/falcon/archives/atari_falcon_musique.htm 
>>>
>> Thanks! I've checked them now, and for me they work with both, SDL and
>> PortAudio. However, sound quality seems to be a bit worse with SDL, so
>> that needs some more fine tuning at least...
>>
>>> I can record the sound (tomorrow) if you want.
>> Thanks, but that likely does not help much to debug this issue... I
>> guess I'll better revert the patch for now until the problem is
>> understood...
>>
>>   Thomas
>>
>>
>>
>>
>
>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/