Cristiana
Posts: 2
Joined: Tue Jul 16, 2019 8:06 am

pocketsphinx.c - writing raw audio file- Segmentation Fault

Tue Jul 16, 2019 8:09 am

Hi,

I am working on a smart home system project that uses speech recognition. We have 2 raspberry pi devices. The source code, written in python, works perfectly on one of them but crashes on the other one. The error it's a segmentation fault right after the execution of: INFO: pocketsphinx.c(985): Writing raw audio file: /home/pi/PiASR/python/Transcriptions/000000000.raw I can give you more details if needed but I don't really now which right now.

Thank you a lot!

pcmanbob
Posts: 6445
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: pocketsphinx.c - writing raw audio file- Segmentation Fault

Tue Jul 16, 2019 9:28 am

Hi.

I assume you are using 2 different SD cards, what happens if you swap the SD cards , does the problem move with the SD card or stay with a particular pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

blimpyway
Posts: 120
Joined: Mon Mar 19, 2018 1:18 pm

Re: pocketsphinx.c - writing raw audio file- Segmentation Fault

Wed Jul 17, 2019 9:32 am

You can start with details of what hardware version of Pi is each device and which raspibian version is running on each other.

Did you ran:

Code: Select all

$ sudo apt-get update
$ sudo apt-get upgrade
on both?

Cristiana
Posts: 2
Joined: Tue Jul 16, 2019 8:06 am

Re: pocketsphinx.c - writing raw audio file- Segmentation Fault

Thu Jul 25, 2019 8:12 am

Hi again,
The hardware version is Raspberry Pi 3, model B Rev 1.2 and the raspbian version is 9.9(strech).
I did try swapping the cards and it turns out the card is the problem.

But now I have another problem. I also updated and upgraded one of the devices and now I get some other errors :

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "Program.py", line 24, in <module>
stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=4096)
File "/home/pi/.local/lib/python3.5/site-packages/pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9997] Invalid sample rate

Thanks

Return to “Python”