breizhn / DTLN

Tensorflow 2.x implementation of the DTLN real time speech denoising model. With TF-lite, ONNX and real-time audio processing support.
MIT License
585 stars 161 forks source link

PortAudioError: Error opening Stream: Invalid sample rate [PaErrorCode -9997] #40

Open RXAldreezee opened 3 years ago

RXAldreezee commented 3 years ago

Hi, I'm currently using a Raspberry Pi 4, I have installed the dependencies, I'm trying to make it work but I'm stuck on this error. Can you please help? Thank you.

pi@raspberrypi:~/Downloads/DTLN-master $ python3 real_time_dtln_audio.py --list-devices 0 bcm2835 HDMI 1: - (hw:0,0), ALSA (0 in, 8 out) 1 bcm2835 Headphones: - (hw:1,0), ALSA (0 in, 8 out) 2 USB PnP Sound Device: Audio (hw:2,0), ALSA (1 in, 2 out) 3 sysdefault, ALSA (0 in, 128 out) 4 lavrate, ALSA (0 in, 128 out) 5 samplerate, ALSA (0 in, 128 out) 6 speexrate, ALSA (0 in, 128 out) 7 pulse, ALSA (32 in, 32 out) 8 upmix, ALSA (0 in, 8 out) 9 vdownmix, ALSA (0 in, 6 out) 10 dmix, ALSA (0 in, 2 out)

pi@raspberrypi:~/Downloads/DTLN-master $ python3 real_time_dtln_audio.py -i 2 -o 2
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 PortAudioError: Error opening Stream: Invalid sample rate [PaErrorCode -9997]

My USB headset with microphone is at 2 USB PnP Sound Device: Audio (hw:2,0), ALSA (1 in, 2 out)

Thank you very much!

abhinavchandel0 commented 2 years ago

@RXAldreezee facing same issue. can you help me with it?

StuartIanNaylor commented 2 years ago

Prob you using a hw: device rather than plughw: plughw: is just the device with the auto resample and format running.

create a /etc/asound.conf or ~/.asoundrc (i usually do system and wondering if the user one is right)

something like this

#pcm default to allow auto software plughw converion
pcm.!default {
  type asym
  playback.pcm "play"
  capture.pcm "cap"
}

#pcm is pluhw so auto software conversion can take place
#pcm hw: is direct and faster but likely will not support sampling rate
pcm.play {
  type plug
  slave {
    pcm "plughw:1,0"
  }
}

#pcm is pluhw so auto software conversion can take place
#pcm hw: is direct and faster but likely will not support sampling rate
pcm.cap {
  type plug
  slave {
    pcm "plughw:1,0"
    }
}

Then use the play & cap pcms

RXAldreezee commented 2 years ago

Hi Abhinav,

I have moved on from this project.

I have used this instead - https://github.com/werman/noise-suppression-for-voice

Thank you and good luck in your endeavors!

On Fri, May 6, 2022 at 10:48 AM StuartIanNaylor @.***> wrote:

Prob you using a hw: device rather than plughw: plughw: is just the device with the auto resample and format running.

create a /etc/asound.conf or ~/.asoundrc (i usually do system and wondering if the user one is right)

something like this

pcm default to allow auto software plughw converion

pcm.!default { type asym playback.pcm "play" capture.pcm "cap" }

pcm is pluhw so auto software conversion can take place

pcm hw: is direct and faster but likely will not support sampling rate

pcm.play { type plug slave { pcm "plughw:1,0" } }

pcm is pluhw so auto software conversion can take place

pcm hw: is direct and faster but likely will not support sampling rate

pcm.cap { type plug slave { pcm "plughw:1,0" } }

Then use the play & cap pcms

— Reply to this email directly, view it on GitHub https://github.com/breizhn/DTLN/issues/40#issuecomment-1119213047, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASN5V64IKDEXL6AYFTKZDC3VISB7XANCNFSM43SCE5KA . You are receiving this because you were mentioned.Message ID: @.***>

RXAldreezee commented 2 years ago

It works fine in Raspberry Pi 4.