Record sound
#1
I seem to be unable to record sound with gnome-soundrecorder or any other recording software. Is this a known problem? Is there a way to fix it? Help would be greatly appreciated as i need voice recording on my phone for work.
  Reply
#2
Have you tried with an external mic? I had problems with telegram desktop but was able to call with a crappy set of earbuds and then much better with real usb headphones/mic using a usb-c adaptor. HTH
  Reply
#3
Lots of issues recording sound because many applications arbitrarily use settings suitable for the desktop and the sound card on the Pinephone does not have that kind of flexibility. The sound card settings can be seen by:

arecord -l
aplay -l
pactl list sinks
pactl list sources

The following line:

arecord -f dat -d 10 test.wav

will successfully record 10 seconds from the microphone. The "-f dat" is required, as it sets the frequency and endianness of the sound stream.

Currently trying to figure out how to apply this knowledge to various microphone dependant apps, lol

HTH
LF

PS: You will need to install the alsa-utils package for aplay and arecord
  Reply
#4
There is a problem with recording from the microphone with a sample rate of 16K. I am able to record at 24K sample rates and above. I can also record at sample rates of 12K and below. Many applications default to a 16K sample rate when recording from a microphone.

Recording with a sample rate of 16K usually crashes immediately and always within 10 seconds. Recording at 20K will always crash but often not for 30 or 40 seconds.

Arch, pacman -Syu run this morning

As always
YMMV
LF
  Reply
#5
Thanks, will try now.
I should have made clearer that i´m unable to record at all until now not just in bad quality.

Thanks, will try now.
I should have made clearer that i´m unable to record at all until now not just in bad quality.

EDIT: Works even with gnome-soundrecorder if i select mono & mp3. Will investigate further.
  Reply
#6
(12-30-2020, 12:54 AM)Veraendert Wrote: Thanks, will try now.
I should have made clearer that i´m unable to record at all until now not just in bad quality.

Thanks, will try now.
I should have made clearer that i´m unable to record at all until now not just in bad quality.

EDIT: Works even with gnome-soundrecorder if i select mono & mp3. Will investigate further.
Well, it is a single microphone so mono makes sense. lol. I need a wink icon.
File type should not matter.
Any settings you can figure out will be very helpful.

My problem has become the wakeword models for the voice assistant are in 16K format so I am researching how to resample within pulse between the mike and app. It is the final piece I need before attempting an alpha build.

Any one line examples would be hugely appreciated.
YMMV, TIA and HTH
LF
  Reply
#7
It definitely does not work with flac although the codec is installed. I just checked.

I recorded using gnome-soundrecorder with the opus codec for more than one minute. No crash. Flac doesn't work at all (doesn't record anything). It worked using the mp3 codec this morning. No it doesn't anymore (again, nothing is recorded). Strange.
  Reply
#8
After a pacman -Syu on January 8th I am now able to record at 16K with alsa.
arecord -f dat -r 16000

However accessing the microphone at 16K through python still fails. Using the speech_recognition library, I create a Microphone and a Recognizer.
import speech_recognition as sr
mic = sr.Microphone()
r = sr.Recognizer()
with mic as source:
    audio = r.listen(source)

When listening to the Microphone with the Recognizer I get the following:
Expression 'alsa_snd_pcm_poll_descriptors_revents(...params...)' failed in src/hostapi/alsa/pa_linux_alsa.c, line: 3654
Expression 'PaAlsaStreamComponent_EndPolling(...params...)' failed in src/hostapi/alsa/pa_linux_alsa.c, line: 3871
Expression 'PaAlsaStream_WaitForFrames(...params...)' failed in src/hostapi/alsa/pa_linux_alsa.c, line: 4418

This happens in site-packages/speech_recognition/__init__.py line 161 in read() and line 652 in Recognizer.listen()
    buffer = source.stream.read(source, CHUNK)
and the actual python line which fails is in site-packages/pyaudio.py line 608
    pa.read_stream(...params...)

At this point I think the Microphone is not being initialized properly from pyaudio, Endianness perhaps?
Any nuggets of wisdom will be greatly appreciated

LF
  Reply
#9
And....., after a whole bunch of python updates today, everything magically works.
On Arch, pacman -Syu today

Everything excludes my code of course. Other than that, I can record at 16K. and STT recognizes words in the audio so my issues have been resolved.

YMMV
LF
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)