|Re: [hatari-devel] Re: PortAudio replaced|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Re: PortAudio replaced
- From: laurent.sallafranque@xxxxxxx
- Date: Tue, 11 Jan 2022 22:59:02 +0100 (CET)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1641938342; bh=Y2aiAIu4JDT9snCFOHNLrK9W5a7ThPbbrpuLiOx8LwQ=; h=Date:From:To:In-Reply-To:Subject:From; b=ZXl/1m8GydUuxd2uz8f6iw4rMwEGVg+Thbhj9EkQInYvYw+5Ho2jd2YH/1yCP0fU/ f3Zdkze1mNI2m43eZhC3sRWdrhBVGeZWYhjMDi6DbZ33fXThpewokOAg95lbh2IDnZ Nel8c1JrUl5ETypZQOQcBIRAuRlP6niTslRYcGyThgFA4CYo5Lw9t5kzMyMEh5qcMn RjbxrF6wbmgHXc+9z4JqLx5rsOXyp1BLFPq76iOnFo8TYNWpOpeL2/iSVFi7DmPa3D De4U7aItpyL8XYqmSZl6pjcmsA3+Tckar80PdfH3xHhjOxmROFn3rpdEDexfOQmSJt SLMsJLkhXUGJg==
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.
----- Mail original -----
De: "Laurent Sallafranque" <laurent.sallafranque@xxxxxxx>
Envoyé: Mardi 11 Janvier 2022 21:21:08
Objet: Re: [hatari-devel] Re: PortAudio replaced
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
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.
> 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>:
>>> 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
>>> 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).
>> 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