kclyu / rpi-webrtc-streamer

This repo's objective is providing something like Web Cam server on the most popular Raspberry PI hardware. By integrating [WebRTC](https://webrtc.org/native-code/) and Raspberry PI, we can stream the Raspberry camera feed to browser or native client which talks WebRTC.
Other
629 stars 108 forks source link

Do you have any working configuration on Audio? #5

Open kclyu opened 7 years ago

kclyu commented 7 years ago

It is not easy to buy as many hardware as possible for the test, and there is not really much time to test it. If you have successfully set up your audio with your Raspberry PI and have verified audio transmission from RWS, please share it. I think it will help a lot of others.

Please add the comment to the issue as shown below.

kclyu commented 7 years ago

My Working Audio configuration: Device Type: USB microphone Device Name: Cosy USB microphone MK1343UB Command Output:

pi@raspberrypi:~ $ lsusb
Bus 001 Device 004: ID 0d8c:0061 C-Media Electronics, Inc. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ cat /proc/asound/cards
 0 [Microphone     ]: USB-Audio - USB Microphone
                      Raysound USB Microphone at usb-3f980000.usb-1.4, full speed
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_usb_audio
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.27-v7+ #997 SMP Tue May 9 19:58:37 BST 2017 armv7l GNU/Linux
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_usb_audio
towolf commented 7 years ago

I have a Zoom H1 that can serve as a pretty good USB mic.

But alsamixer shows this on connection: This sound device does not have any controls.

And I think, this is why the WebRTC streaming does not work:

(audio_device_impl.cc:526): InitMicrophone
(webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenMicrophone(name=default)
(webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_inputMixerHandle, default)
(webrtcvoiceengine.cc:672): webrtc: Could not find capture volume on the mixer.
(webrtcvoiceengine.cc:672): webrtc: Init() failed to initialize the microphone (error=9004)

My settings are these:

audio_processing_enable=true
audio_echo_cancellation=false
audio_gain_control=false
audio_high_passfilter=false
audio_noise_suppression=false
audio_level_control_enable=false

Full log:

Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (websocket_server.cc:346): Found handler URI in config : /rws/ws
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (websocket_server_callback.cc:551): URI Path exist /rws/ws
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (websocket_server_callback.cc:453): LWS_CALLBACK_ESTABLISHED
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (app_channel.cc:177): New WebSocket connnection id : 12
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (app_channel.cc:192): OnMessage(12)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (app_channel.cc:209): JSON Parsing Success: {"cmd":"register","roomid":"987974376","clientid":"97868899"}
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (app_channel.cc:250): Room ID: 987974376, Client ID: 97868899
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (streamer_observer.cc:105): IsStreamSessionActive
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (streamer_observer.cc:66): ActivateStreamSession
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (streamer_observer.cc:147): ObtainStreamer
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (streamer.cc:236): OnPeerConnectedPeer 0,  connected, trying to initialize streamer instance
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (raspi_encoder.cc:454): Raspberry H.264 MMAL encoder factory.
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:238): WebRtcVoiceEngine::WebRtcVoiceEngine
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:245): Supported send codecs in order of preference:
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): opus/48000/2 { minptime=10 useinbandfec=1 } (111)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): ISAC/16000/1 (103)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): G722/8000/1 (9)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): ILBC/8000/1 (102)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): PCMU/8000/1 (0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): PCMA/8000/1 (8)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): CN/16000/1 (105)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): CN/8000/1 (13)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): telephone-event/48000/1 (110)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): telephone-event/16000/1 (113)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:248): telephone-event/8000/1 (126)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:251): Supported recv codecs in order of preference:
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): opus/48000/2 { minptime=10 useinbandfec=1 } (111)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): ISAC/16000/1 (103)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): G722/8000/1 (9)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): ILBC/8000/1 (102)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): PCMU/8000/1 (0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): PCMA/8000/1 (8)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): CN/16000/1 (105)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): CN/8000/1 (13)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): telephone-event/48000/1 (110)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): telephone-event/16000/1 (113)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:254): telephone-event/8000/1 (126)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:262): VoiceEngine 4.1.0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:84): Create
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:62): AudioDeviceBuffer::ctor
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:128): AudioDeviceModuleImpl
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:136): CheckPlatform
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:150): current platform is Linux
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:177): CreatePlatformSpecificObjects
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1844): PlatformAudioLayer
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:275): Linux PulseAudio is *not* supported => ALSA APIs will be utilized instead
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:344): AttachAudioBuffer
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:178): SetRecordingSampleRate(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:185): SetPlayoutSampleRate(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:202): SetRecordingChannels(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:209): SetPlayoutChannels(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1452): RegisterEventObserver
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1465): RegisterAudioCallback
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:77): RegisterAudioCallback
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:467): Init
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1196): SetPlayoutDevice(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 1 - default:CARD=H1
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 2 - sysdefault:CARD=H1
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 3 - front:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 4 - surround21:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 5 - surround40:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 6 - surround41:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 7 - surround50:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 8 - surround51:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 9 - surround71:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 10 - iec958:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 11 - dmix:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 12 - hw:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 13 - plughw:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   number of availiable audio output devices is 14
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:516): InitSpeaker
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenSpeaker(name=default)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_outputMixerHandle, default)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Init() failed to initialize the speaker (error=9005)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1291): SetRecordingDevice(0)
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 1 - default:CARD=H1
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 2 - sysdefault:CARD=H1
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 3 - front:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 4 - surround21:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 5 - surround40:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 6 - surround41:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 7 - surround50:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 8 - surround51:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 9 - surround71:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 10 - iec958:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 11 - dsnoop:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 12 - hw:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     Enum device 13 - plughw:CARD=H1,DEV=0
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   number of availiable audio input devices is 14
Sep 16 17:27:42 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:526): InitMicrophone
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenMicrophone(name=default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_inputMixerHandle, default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find capture volume on the mixer.
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Init() failed to initialize the microphone (error=9004)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1005): StereoPlayoutIsAvailable
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenSpeaker(name=default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Closing playout mixer
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_outputMixerHandle, default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   InitSpeaker() failed
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   InitPlayout open (default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     playout snd_pcm_get_params buffer_size:2048 period_size :1024
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:185): SetPlayoutSampleRate(48000)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:209): SetPlayoutChannels(2)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   handle_playout is now set to NULL
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1015): output: 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1024): SetStereoPlayout(1)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:209): SetPlayoutChannels(2)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:891): StereoRecordingIsAvailable
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenMicrophone(name=default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Closing record mixer
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_inputMixerHandle, default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find capture volume on the mixer.
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   InitMicrophone() failed
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: InitRecording open (default)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:     capture snd_pcm_get_params buffer_size:2048 period_size:1024
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:178): SetRecordingSampleRate(48000)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:202): SetRecordingChannels(2)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   no avaliable input mixer exists
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:901): output: 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:910): SetStereoRecording(1)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:202): SetRecordingChannels(2)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: TransmitMixer::SetAudioProcessingModule(audioProcessingModule=0xf998b8)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: OutputMixer::SetAudioProcessingModule(audioProcessingModule=0xf998b8)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_processing_impl.cc:680): Level controller activated: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_processing_impl.cc:687): Highpass filter activated: 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:338): WebRtcVoiceEngine::ApplyOptions: AudioOptions {aec: true, agc: true, ns: true, hf: true, swap: false, audio_jitter_buffer_max_packets: 50, audio_jitter_buffer_fast_accelerate: false, typing: true, agc_delta: 0, experimental_agc: false, extended_filter_aec: false, delay_agnostic_aec: false, experimental_ns: false, intelligibility_enhancer: false, level_control: false, residual_echo_detector: true, }
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1760): BuiltInAECIsAvailable
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_generic.cc:51): BuiltInAECIsAvailable: Not supported on this platform
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1763): output: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (apm_helpers.cc:106): Echo control set to 1 with mode 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (apm_helpers.cc:116): EC metrics set to 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1776): BuiltInAGCIsAvailable
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_generic.cc:61): BuiltInAGCIsAvailable: Not supported on this platform
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1779): output: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1071): SetAGC(1)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (apm_helpers.cc:70): AGC set to 1 with mode 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:482): Adjusting AGC level from default -2dB to -2dB
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1792): BuiltInNSIsAvailable
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_generic.cc:71): BuiltInNSIsAvailable: Not supported on this platform
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1795): output: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (apm_helpers.cc:141): NS set to 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:513): Stereo swapping enabled? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:518): NetEq capacity is 50
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:524): NetEq fast mode? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:531): Typing detection is enabled? 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (apm_helpers.cc:166): VAD set to 1 for typing detection.
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:542): Delay agnostic aec is enabled? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:551): Extended filter aec is enabled? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:560): Experimental ns is enabled? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:566): Intelligibility Enhancer is enabled? 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:576): Level control: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_processing_impl.cc:680): Level controller activated: 0
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_processing_impl.cc:687): Highpass filter activated: 1
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1441): Recording
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:957): SetRecordingChannel(both)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:216): SetRecordingChannel(2)
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:217): Not implemented
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (adm_helpers.cc:47): Unable to set recording channel to kChannelBoth.
Sep 16 17:27:43 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1291): SetRecordingDevice(0)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:526): InitMicrophone
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find capture volume on the mixer.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (adm_helpers.cc:56): Unable to access microphone.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:891): StereoRecordingIsAvailable
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find capture volume on the mixer.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   InitMicrophone() failed
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:178): SetRecordingSampleRate(48000)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:202): SetRecordingChannels(2)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   no avaliable input mixer exists
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:901): output: 1
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:910): SetStereoRecording(1)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:202): SetRecordingChannels(2)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (adm_helpers.cc:80): Set recording device.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1399): Playing
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1196): SetPlayoutDevice(0)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:516): InitSpeaker
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (adm_helpers.cc:100): Unable to access speaker.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1005): StereoPlayoutIsAvailable
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (webrtcvoiceengine.cc:672): webrtc:   InitSpeaker() failed
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:185): SetPlayoutSampleRate(48000)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_buffer.cc:209): SetPlayoutChannels(2)
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1015): output: 1
Sep 16 17:27:44 zero-w webrtc-streamer[1760]: (audio_device_impl.cc:1024): SetStereoPlayout(1)
kclyu commented 7 years ago

First of all, it is necessary to check whether the USB being used is normally operating ALSA.

pi@raspberrypi:~ $ dmesg
...
...
[3725352.416197] usb 1-1.4: new full-speed USB device number 4 using dwc_otg
[3725352.555438] usb 1-1.4: New USB device found, idVendor=0d8c, idProduct=0061
[3725352.555456] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[3725352.555466] usb 1-1.4: Product: USB Microphone
[3725352.555477] usb 1-1.4: Manufacturer: Raysound
[3725352.555487] usb 1-1.4: SerialNumber: 201409
[3725352.569117] input: Raysound USB Microphone as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.2/0003:0D8C:0061.0001/input/input0
[3725352.569532] hid-generic 0003:0D8C:0061.0001: input,hidraw0: USB HID v1.11 Device [Raysound USB Microphone] on usb-3f980000.usb-1.4/input2
[3725352.700615] usbcore: registered new interface driver snd-usb-audio
pi@raspberrypi:~ $ lsusb
Bus 001 Device 004: ID 0d8c:0061 C-Media Electronics, Inc. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ cat /proc/asound/cards
 0 [Microphone     ]: USB-Audio - USB Microphone
                      Raysound USB Microphone at usb-3f980000.usb-1.4, full speed
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_usb_audio
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.27-v7+ #997 SMP Tue May 9 19:58:37 BST 2017 armv7l GNU/Linux
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_usb_audio
pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Microphone [USB Microphone], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The command below saves the input from the actual mic as a wav file, and if it is confirmed that it is recorded normally on another PC, it will work normally. (Use ^ C to abort the command.)

pi@raspberrypi:~ $ arecord --format S16_LE --rate 44100 -c1 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
^CAborted by signal Interrupt...
arecord: pcm_read:2031: read error: Interrupted system call
towolf commented 7 years ago

Yes, all those work. But there is no volume control. It's not there in my laptop either, but it's works fine generally anyway.

Only the webrtc stuff insists on a mixer, which is not there.

kclyu commented 7 years ago

I do not know if this is relevant, but try setting the volume with alasmixer and saving the changed settings as default values.

alsamixer    #  Adjust volume value
sudo alsactl store  # save the alsa config values to file

It seems that there is a problem with the setting of pi that you are using, but at this moment I do not have the same phenomenon and can not say anything.

Below is the log executed in my pi.

[019:540] [9391] (audio_device_impl.cc:467): Init
[019:546] [9391] (audio_device_impl.cc:1196): SetPlayoutDevice(0)
[019:652] [9391] (webrtcvoiceengine.cc:672): webrtc:   number of availiable audio output devices is 0
[019:652] [9391] (audio_device_impl.cc:516): InitSpeaker
[019:694] [9391] (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenSpeaker(name=default)
[019:695] [9391] (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_outputMixerHandle, default)
[019:696] [9391] (webrtcvoiceengine.cc:672): webrtc: snd_mixer_selem_get_name 0: Mic =750bf260
[019:696] [9391] (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
[019:696] [9391] (webrtcvoiceengine.cc:672): webrtc: Init() failed to initialize the speaker (error=9005)
[019:696] [9391] (audio_device_impl.cc:1291): SetRecordingDevice(0)
[019:739] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 1 - default:CARD=Microphone
[019:739] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 2 - sysdefault:CARD=Microphone
[019:739] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 3 - front:CARD=Microphone,DEV=0
[019:739] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 4 - surround21:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 5 - surround40:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 6 - surround41:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 7 - surround50:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 8 - surround51:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 9 - surround71:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 10 - iec958:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 11 - dsnoop:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 12 - hw:CARD=Microphone,DEV=0
[019:740] [9391] (webrtcvoiceengine.cc:672): webrtc:     Enum device 13 - plughw:CARD=Microphone,DEV=0
[019:741] [9391] (webrtcvoiceengine.cc:672): webrtc:   number of availiable audio input devices is 14
[019:741] [9391] (audio_device_impl.cc:526): InitMicrophone
[019:784] [9391] (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenMicrophone(name=default)
[019:784] [9391] (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_inputMixerHandle, default)
[019:785] [9391] (webrtcvoiceengine.cc:672): webrtc:      Mic element found
[019:785] [9391] (webrtcvoiceengine.cc:672): webrtc:      Using Mic as capture volume.
[019:785] [9391] (webrtcvoiceengine.cc:672): webrtc:   the input mixer device is now open (0x750c4c40)
[019:785] [9391] (audio_device_impl.cc:1005): StereoPlayoutIsAvailable
[019:828] [9391] (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenSpeaker(name=default)
[019:828] [9391] (webrtcvoiceengine.cc:672): webrtc: Closing playout mixer
[019:828] [9391] (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_outputMixerHandle, default)
[019:829] [9391] (webrtcvoiceengine.cc:672): webrtc: snd_mixer_selem_get_name 0: Mic =750c8520
[019:829] [9391] (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
[019:829] [9391] (webrtcvoiceengine.cc:672): webrtc:   InitSpeaker() failed
[019:871] [9391] (webrtcvoiceengine.cc:672): webrtc:   InitPlayout open (default)
[019:892] [9391] (webrtcvoiceengine.cc:672): webrtc:      unable to open playback device: No such file or directory (-2)
[019:892] [9391] (audio_device_impl.cc:1015): output: 0
[019:892] [9391] (audio_device_impl.cc:1024): SetStereoPlayout(0)
[019:892] [9391] (audio_device_buffer.cc:209): SetPlayoutChannels(1)
[019:892] [9391] (audio_device_impl.cc:891): StereoRecordingIsAvailable
[019:936] [9391] (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::OpenMicrophone(name=default)
[019:936] [9391] (webrtcvoiceengine.cc:672): webrtc: Closing record mixer
[019:936] [9391] (webrtcvoiceengine.cc:672): webrtc: Closing record mixer
[019:937] [9391] (webrtcvoiceengine.cc:672): webrtc: Closing record mixer
[019:937] [9391] (webrtcvoiceengine.cc:672): webrtc: Closing record mixer
[019:937] [9391] (webrtcvoiceengine.cc:672): webrtc:      snd_mixer_attach(_inputMixerHandle, default)
[019:937] [9391] (webrtcvoiceengine.cc:672): webrtc:      Mic element found
[019:937] [9391] (webrtcvoiceengine.cc:672): webrtc:      Using Mic as capture volume.
[019:938] [9391] (webrtcvoiceengine.cc:672): webrtc:   the input mixer device is now open (0x750cd958)
[019:980] [9391] (webrtcvoiceengine.cc:672): webrtc: InitRecording open (default)
[019:988] [9391] (webrtcvoiceengine.cc:672): webrtc:     capture snd_pcm_get_params buffer_size:2048 period_size:1024
[019:989] [9391] (audio_device_buffer.cc:178): SetRecordingSampleRate(48000)
[019:989] [9391] (audio_device_buffer.cc:202): SetRecordingChannels(2)
[019:989] [9391] (webrtcvoiceengine.cc:672): webrtc: AudioMixerManagerLinuxALSA::SetMicrophoneMute(enable=0)
[019:990] [9391] (audio_device_impl.cc:901): output: 1
[019:990] [9391] (audio_device_impl.cc:910): SetStereoRecording(1)
[019:990] [9391] (audio_device_buffer.cc:202): SetRecordingChannels(2)
[019:992] [9391] (webrtcvoiceengine.cc:672): webrtc: TransmitMixer::SetAudioProcessingModule(audioProcessingModule=0x750d3130)
[019:992] [9391] (webrtcvoiceengine.cc:672): webrtc: OutputMixer::SetAudioProcessingModule(audioProcessingModule=0x750d3130)
[019:992] [9391] (audio_processing_impl.cc:680): Level controller activated: 0
[019:992] [9391] (audio_processing_impl.cc:687): Highpass filter activated: 1
[019:992] [9391] (webrtcvoiceengine.cc:338): WebRtcVoiceEngine::ApplyOptions: AudioOptions {aec: true, agc: true, ns: true, hf: true, swap: false, audio_jitter_buffer_max_packets: 50, audio_jitter_buffer_fast_accelerate: false, typing: true, agc_delta: 0, experimental_agc: false, extended_filter_aec: false, delay_agnostic_aec: false, experimental_ns: false, intelligibility_enhancer: false, level_control: false, residual_echo_detector: true, }
[019:992] [9391] (audio_device_impl.cc:1760): BuiltInAECIsAvailable
[019:993] [9391] (audio_device_generic.cc:51): BuiltInAECIsAvailable: Not supported on this platform
[019:993] [9391] (audio_device_impl.cc:1763): output: 0
[019:993] [9391] (apm_helpers.cc:106): Echo control set to 1 with mode 0
[019:993] [9391] (apm_helpers.cc:116): EC metrics set to 1
[019:993] [9391] (audio_device_impl.cc:1776): BuiltInAGCIsAvailable
[019:993] [9391] (audio_device_generic.cc:61): BuiltInAGCIsAvailable: Not supported on this platform
[019:993] [9391] (audio_device_impl.cc:1779): output: 0
[019:993] [9391] (audio_device_impl.cc:1071): SetAGC(1)
[019:994] [9391] (apm_helpers.cc:70): AGC set to 1 with mode 0
[019:994] [9391] (webrtcvoiceengine.cc:482): Adjusting AGC level from default -2dB to -2dB
[019:994] [9391] (audio_device_impl.cc:1792): BuiltInNSIsAvailable
[019:994] [9391] (audio_device_generic.cc:71): BuiltInNSIsAvailable: Not supported on this platform
[019:994] [9391] (audio_device_impl.cc:1795): output: 0
[019:994] [9391] (apm_helpers.cc:141): NS set to 1
[019:994] [9391] (webrtcvoiceengine.cc:513): Stereo swapping enabled? 0
[019:994] [9391] (webrtcvoiceengine.cc:518): NetEq capacity is 50
[019:994] [9391] (webrtcvoiceengine.cc:524): NetEq fast mode? 0
[019:994] [9391] (webrtcvoiceengine.cc:531): Typing detection is enabled? 1
[019:994] [9391] (apm_helpers.cc:166): VAD set to 1 for typing detection.
[019:994] [9391] (webrtcvoiceengine.cc:542): Delay agnostic aec is enabled? 0
[019:994] [9391] (webrtcvoiceengine.cc:551): Extended filter aec is enabled? 0
[019:994] [9391] (webrtcvoiceengine.cc:560): Experimental ns is enabled? 0
[019:994] [9391] (webrtcvoiceengine.cc:566): Intelligibility Enhancer is enabled? 0
[019:994] [9391] (webrtcvoiceengine.cc:576): Level control: 0
[019:995] [9391] (audio_processing_impl.cc:680): Level controller activated: 0
[019:995] [9391] (audio_processing_impl.cc:687): Highpass filter activated: 1
[019:995] [9391] (audio_device_impl.cc:1441): Recording
[019:995] [9391] (audio_device_impl.cc:957): SetRecordingChannel(both)
[019:995] [9391] (audio_device_buffer.cc:216): SetRecordingChannel(2)
[019:995] [9391] (audio_device_buffer.cc:217): Not implemented
[019:995] [9391] (adm_helpers.cc:47): Unable to set recording channel to kChannelBoth.
[019:995] [9391] (audio_device_impl.cc:1291): SetRecordingDevice(0)
[020:039] [9391] (audio_device_impl.cc:526): InitMicrophone
[020:083] [9391] (audio_device_impl.cc:891): StereoRecordingIsAvailable
[020:177] [9391] (audio_device_buffer.cc:178): SetRecordingSampleRate(48000)
[020:177] [9391] (audio_device_buffer.cc:202): SetRecordingChannels(2)
[020:178] [9391] (audio_device_impl.cc:901): output: 1
[020:178] [9391] (audio_device_impl.cc:910): SetStereoRecording(1)
[020:178] [9391] (audio_device_buffer.cc:202): SetRecordingChannels(2)
[020:178] [9391] (adm_helpers.cc:80): Set recording device.
[020:178] [9391] (audio_device_impl.cc:1399): Playing
[020:179] [9391] (audio_device_impl.cc:1196): SetPlayoutDevice(0)
[020:222] [9391] (audio_device_impl.cc:516): InitSpeaker
[020:266] [9391] (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
[020:266] [9391] (adm_helpers.cc:100): Unable to access speaker.
[020:266] [9391] (audio_device_impl.cc:1005): StereoPlayoutIsAvailable
[020:309] [9391] (webrtcvoiceengine.cc:672): webrtc: Could not find output volume in the mixer.
[020:310] [9391] (webrtcvoiceengine.cc:672): webrtc:   InitSpeaker() failed
[020:359] [9391] (webrtcvoiceengine.cc:672): webrtc:      unable to open playback device: No such file or directory (-2)
[020:359] [9391] (audio_device_impl.cc:1015): output: 0
[020:359] [9391] (audio_device_impl.cc:1024): SetStereoPlayout(0)
[020:359] [9391] (audio_device_buffer.cc:209): SetPlayoutChannels(1)
[020:359] [9391] (adm_helpers.cc:124): Set playout device.
[020:361] [9391] (audio_processing_impl.cc:680): Level controller activated: 0
[020:361] [9391] (audio_processing_impl.cc:687): Highpass filter activated: 0
[020:361] [9391] (audio_device_impl.cc:1465): RegisterAudioCallback
[020:361] [9391] (audio_device_buffer.cc:77): RegisterAudioCallback
[020:361] [9391] (audio_device_impl.cc:1465): RegisterAudioCallback
[020:361] [9391] (audio_device_buffer.cc:77): RegisterAudioCallback
[020:361] [9391] (webrtcvideoengine2.cc:477): WebRtcVideoEngine2::WebRtcVideoEngine2()
[020:362] [9391] (webrtcvideoengine2.cc:485): WebRtcVideoEngine2::Init
towolf commented 7 years ago

Hello, thanks for your suggestion, but that was my point, that the device does not have volume controls:

image

And I think it may not work because the code is assuming that all audio devices have these controls.

kclyu commented 7 years ago

In my pi, alsamixer is displayed as below. 2017-09-20 10-46-36 Press tab or press F4 to go to Mic item.

Below is what I set pi to. If there is a missing part in pi setting, it is better to try it.

towolf commented 7 years ago

There are no audio volume controls whatsoever. This is basically a handheld recorder which can work as a USB audio interface

https://goo.gl/images/VigWEG

I just don't understand why it is trying to control the volume, when I disabled all volume control settings ...

On 20 Sep 2017 10:46, "Lyu Keun Chang" notifications@github.com wrote:

In my pi, alsamixer is displayed as below. [image: 2017-09-20 10-46-36] https://user-images.githubusercontent.com/22055544/30634263-78574f58-9e29-11e7-9f91-6458b295a690.png Press tab or press F4 to go to Mic item.

Below is what I set pi to. If there is a missing part in pi setting, it is better to try it.

  • /boot/config.txt

...

Enable audio (loads snd_bcm2835)

dtparam=audio=on ## comment out for USB audio

start_x=1 gpu_mem=128 ...

  • /lib/modprobe.d/aliases.conf

...

prevent unusual drivers from appearing as the first sound device

options snd-pcsp index=-2

options snd-usb-audio index=-2 # comment out for USB audio priority

options cx88_alsa index=-2 options snd-atiixp-modem index=-2 ...

When you changed something in your pi, you need to reboot pi to use new updated configuration. and use alsamixer and alsactl store.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kclyu/rpi-webrtc-streamer/issues/5#issuecomment-330787115, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVEevSJNNHQHRStNY0gcMS_NnGrwkBrks5skNDugaJpZM4NikYT .

kclyu commented 7 years ago

There is no particular reason. The audio part of alsamixer should work normally so that the audio part will be used normally in WebRTC native stack as well. It is intended to check whether the related part of audio is operating normally in the ALSA tools.

noliveleger commented 6 years ago

Hi there, I do have a different configuration from you and it doesn't work (not helpful). I think it's because of my configuration. I'm using this speaker and this usb microphone.

pi@raspberrypi:~$ cat /proc/asound/modules
 0 snd_soc_hifiberry_dac
 1 snd_usb_audio

pi@raspberrypi:~$  aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Microphone [USB Microphone], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I know, the speaker and the microphone do work with aplay default.wav and arecord --device=plughw:1,0 --format S16_LE --rate 44100 -c1 default.wav. (I can record a wav and play it after while)

When I try to Connect on the http://<rpi-ip-address>:8889/native-peerconnection/ I get this error from the logs:

Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:750] [2349] (audio_device_buffer.cc:185): SetRecordingSampleRate(48000)
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:750] [2349] (audio_device_buffer.cc:209): SetRecordingChannels(2)
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:750] [2349] (audio_device_impl.cc:751): output: 0
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:750] [2349] (audio_device_impl.cc:826): Recording
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:751] [2349] (audio_device_impl.cc:745): InitRecording
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:751] [2349] (audio_device_impl.cc:764): RecordingIsInitialized
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:751] [2349] (audio_device_impl.cc:801): StartRecording
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:751] [2349] (audio_device_impl.cc:826): Recording
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: [022:751] [2349] (audio_device_buffer.cc:120): StartRecording
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: #
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: # Fatal error in ../rtc_base/platform_thread.cc, line 193
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: # last system error: 0
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: # Check failed: false
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: # This thread is too busy: webrtc_audio_module_capture_thread 18ms sequence=1001 328847 vs 328829, 1 vs 2
Jun 13 09:01:12 raspberrypi webrtc-streamer[2081]: #
Jun 13 09:01:12 raspberrypi systemd[1]: rws.service: Main process exited, code=killed, status=6/ABRT
Jun 13 09:01:12 raspberrypi systemd[1]: rws.service: Unit entered failed state.
Jun 13 09:01:12 raspberrypi systemd[1]: rws.service: Failed with result 'signal'.
Jun 13 09:01:17 raspberrypi systemd[1]: rws.service: Service hold-off time over, scheduling restart.
Jun 13 09:01:17 raspberrypi systemd[1]: Stopped Rpi WebRTC Streamer.
Jun 13 09:01:17 raspberrypi systemd[1]: Started Rpi WebRTC Streamer.

Any ideas why it fails? FYI I don't have ~/.asoundrc, everything is setup in /etc/asound.conf according to Speaker pHAT instructions.

pcm.!default {
        type plug
        slave.pcm "softvol_and_pivumeter"
}

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter
kclyu commented 6 years ago

The meaning of the log message seems to be conveying too many messages from the microphone device. It seems to be a problem because it tried to use the speaker hardware set as a microphone.

# This thread is too busy: webrtc_audio_module_capture_thread 18ms sequence=1001 328847 vs 328829, 1 vs 2

In asound.conf, only one piece of hardware is defined. Refer to Setting the default microphone / capture device for the capture and playback device settings.

It would be better to use the same issue comment https://github.com/kclyu/rpi-webrtc-streamer/issues/45.

noliveleger commented 6 years ago

@kclyu I've posted in this thread because of Audio issue. I just wanted to tell you about my /etc/asound.conf which implies the Speaker pHat, but if you want me to post in the other thread, let me know. So in /etc/asound.conf, only the speaker was configured, but I could record flawlessly with this command arecord --device=plughw:1,0 --format S16_LE --rate 44100 -c1 default.wav.

I did change the configuration for this

pcm.!default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "softvol_and_pivumeter"
        }
        capture.pcm {
                type plug
                slave.pcm  "hw:1,0"
        }
}

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter

If I don't specify the --device=plughw:1,0, arecord still works but gives an empty wav file. I have to specify the device.

pi@raspberrypi:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
    Playback/recording through the PulseAudio sound server
pivumeter
softvol_and_pivumeter
sysdefault:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
front:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Front speakers
...
iec958:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample mixing device
dsnoop:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample snooping device
hw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Hardware device with all software conversions

Is there a way to specify the input device in your configuration files?

kclyu commented 6 years ago

In my opinion, the following changes should be made in asound.conf.

pcm.usb
{
    type hw
    card 1
}

pcm.!default
{
    type asym
    playback.pcm
    {
        type plug
        slave.pcm "dmix"
    }
    capture.pcm
    {
        type plug
        slave.pcm "usb" 
    }
}

Currently there is no config option to specify the audio device. The config function is not considered at this time because it needs a little low level work like video processing.

noliveleger commented 6 years ago

Ok, I'm gonna do my homework to make my USB microphone as default device for recording and I let you know as soon as it works. Thank you for your help.

noliveleger commented 6 years ago

@kclyu : FYI: The problem was the Speaker pHat. It uses PulseAudio. I could not find a way to make PulseAudio choose the microphone as the default recording device. After removing PulseAudio and restoring /etc/asound.conf to

pcm.!default {
   type asym
   playback.pcm "plug:hw:0"
   capture.pcm "plug:dsnoop:1"
}

it works. Device Type: USB microphone & on-board output 3.5 mm jack Device Name: Mini USB Microphone Command Output:

pi@raspberrypi:~ $ lsusb
Bus 001 Device 005: ID 8086:0808 Intel Corp.
Bus 001 Device 007: ID 06cb:0009 Synaptics, Inc. Composite TouchPad and TrackPoint
Bus 001 Device 006: ID 04b3:3019 IBM Corp.
Bus 001 Device 004: ID 04b3:3016 IBM Corp. UltraNav Keyboard Hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ cat /proc/asound/cards
 0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA
 1 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.5, full spe
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_bcm2835
 1 snd_usb_audio
pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.50-v7+ #1122 SMP Tue Jun 19 12:26:26 BST 2018 armv7l GNU/Linux
k-cactus commented 6 years ago

Does anybody try to connect GPIO mic like Adafruit ? I tried, but no luck ....

the configs are

pi@raspberrypi:~ $ cat /proc/asound/cards
 0 [memsmic        ]: mems-mic - mems-mic
                      mems-mic
 1 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA

pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: memsmic [mems-mic], device 0: bcm2835-i2s-ics43432-hifi ics43432-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pi@raspberrypi:~ $ cat .asoundrc
pcm.!default {
    type asym
    capture.pcm {
        type softvol
        slave.pcm {
            type hw
            format S32_LE
            channels 2
            card memsmic
        }
        control {
        name "Volume"
        card memsmic
        }
    min_dB -3.0
    max_dB 30.0
    }
}

defaults.ctl.!card "memsmic";
defaults.pcm.!card "memsmic";

and the outputs are


Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_device_impl.cc:884): output: 0
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_processing_impl.cc:710): Highpass filter activated: 1
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_processing_impl.cc:724): Gain Controller 2 activated: 0
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_processing_impl.cc:726): Pre-amplifier activated: 0
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_device_impl.cc:764): RecordingIsInitialized
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_device_impl.cc:826): Recording
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_device_impl.cc:745): InitRecording
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:290] [1171] (audio_device_impl.cc:764): RecordingIsInitialized
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:308] [1171] (audio_mixer_manager_alsa_linux.cc:882): Could not find capture volume on the mixer.
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:308] [1171] (audio_device_alsa_linux.cc:880): InitMicrophone() failed
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:326] [1171] (audio_device_alsa_linux.cc:919): unable to open record device: No such file or directory
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:327] [1171] (audio_device_impl.cc:751): output: -1
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:327] [1171] (audio_device_impl.cc:826): Recording
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:327] [1171] (audio_device_impl.cc:745): InitRecording
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:327] [1171] (audio_device_impl.cc:764): RecordingIsInitialized
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:342] [1171] (audio_mixer_manager_alsa_linux.cc:882): Could not find capture volume on the mixer.
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:342] [1171] (audio_device_alsa_linux.cc:880): InitMicrophone() failed
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:356] [1171] (audio_device_alsa_linux.cc:919): unable to open record device: No such file or directory
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:357] [1171] (audio_device_impl.cc:751): output: -1```
drewcovi commented 6 years ago

@k-cactus any luck on your end? I have a GPIO mic as well. would love to crack this nut.

BloodyF commented 5 years ago

@noliveleger I have same settings but just get sound from Pi to PC, not with reverse direction. Did you do 'sudo apt-get upgrade' on Pi? My debug info:

How did you make bidirection audio work? Thank you

noliveleger commented 5 years ago

@BloodyF , which configuration? SpeakerPHat or USB microphone? I could not make it work with the SpeakerPHat because it uses PulseAudio. To make two-ways audio work, I used the frontend files @k-cactus made from this thread https://github.com/kclyu/rpi-webrtc-streamer/issues/45#issuecomment-399320898 tway-audio.zip I just replaced the files and it worked flawlessly.

BloodyF commented 5 years ago

thank @noliveleger very much, you saved my life :)

k-cactus commented 5 years ago

@k-cactus any luck on your end? I have a GPIO mic as well. would love to crack this nut.

unfortunately, that nut is hard for me... so still waiting when someone can crack it....

noliveleger commented 5 years ago

@k-cactus I have ordered one. I let you know if I have some success.

kclyu commented 5 years ago

If you create a recording file through ALSA with GPIO mic and the file plays without problems, it seems to be OK to use it in RWS as well.

If you are considering the sound quality of the mic, it would be better to use hardware noise removal and echo cancellation from the mic if possible. Of course, there is noise and echo-related audio processing in the native stack of WebRTC, but the CPU load can be a problem for raspberry pi, which has low CPU performance.

noliveleger commented 5 years ago

@k-cactus: Are you able to make the mic work with arecord?

k-cactus commented 5 years ago

@k-cactus: Are you able to make the mic work with arecord?

arecord works perfect... but WEBRTC log have something like

.... Could not find capture volume on the mixer.
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:308] [1171] (audio_device_alsa_linux.cc:880): InitMicrophone() failed
Sep 06 01:22:41 raspberrypi webrtc-streamer[1161]: [007:326] [1171] (audio_device_alsa_linux.cc:919): unable to open record device: No such file or directory ....

and any sound present on webview, only video

leofds commented 5 years ago

I use a usb adapter with input and output audio with p2 connectors. This adapter uses the CM108 Audio Controller IC.

pi@raspberrypi:~ $ lsusb
Bus 001 Device 008: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I edited only the file /usr/share/alsa/alsa.conf

defaults.ctl.card 1
defaults.pcm.card 1
mintu19 commented 5 years ago
pi@raspberrypi:~ $ lsusb
Bus 001 Device 003: ID 0e6f:010c Logic3
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ cat /proc/asound/cards
 0 [Device         ]: USB-Audio - PDP Audio Device
                      Performance Designed Products PDP Audio Device at usb-3f980000.usb-1, full spee
pi@raspberrypi:~ $ cat /proc/asound/modules
 0 snd_usb_audio
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [PDP Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Device [PDP Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Also was able to get it to work with WM8960 IC (which is used in many of audio hats of PI) but it required driver install and all.

blademckain commented 5 years ago

Device Type: USB dongle https://www.adafruit.com/product/1475 Command Output:

`root@raspberrypi:~# lsusb Bus 001 Device 002: ID 8086:0808 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@raspberrypi:~# cat /proc/asound/modules 0 snd_usb_audio

root@raspberrypi:~# aplay -l List of PLAYBACK Hardware Devices card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0

root@raspberrypi:~# arecord -l List of CAPTURE Hardware Devices card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 tested with speaker-test -c2 ` works

and with ` arecord --device=hw:0,0 --format S16_LE --rate 44100 -c1 test.wav

aplay --device=plughw:0,0 test.wav ` both commands works

But when I plug audio source to pi the client couldn't establish ws channel between peers ( without usb dongle stream from pi to Pc works)

logs here log_rpi-webrtc-streamer.txt

mcmara commented 5 years ago

I'm using the following board:

pi@raspberrypi:~/Workspace/rws $ aplay -l List of PLAYBACK Hardware Devices card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0

pi@raspberrypi:~/Workspace/rws $ arecord -l List of CAPTURE Hardware Devices card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0


The only thing I had to do, besides installing the drivers, was disabling raspberry pi audio:

sudo emacs /boot/config.txt

dtparam=audio=on ## comment out



Sensitivity is very good. The only issue I have is a small delay in audio (about 0.5s). This makes the audio stream not perfectly synced with the video. Not sure is this is an issue of this board or if the delay in the audio stream exists with every other mic.
thiagotta commented 4 years ago

I have the same setup as mcmara (Respeaker HAT) on a Raspberry Pi Zero W with "Raspbian GNU/Linux 10 (buster)"

pi@raspberrypi:~ $ aplay -l List of PLAYBACK Hardware Devices card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 pi@raspberrypi:~ $ arecord -l List of CAPTURE Hardware Devices card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 pi@raspberrypi:~ $

The video only WebRTC session works fine, but when I have audio_enable=true, the CPU goes to 100% (webrtc-streamer) as soon as the connection is established, without any apparent error in the log:

[011:135] [7127] (audio_device_buffer.cc:181): SetRecordingSampleRate(48000) [011:136] [7127] (audio_device_buffer.cc:201): SetRecordingChannels(2) [011:136] [7127] (audio_device_impl.cc:768): output: 0 [011:136] [7131] (bitrate_allocator.cc:519): UpdateAllocationLimits : total_requested_min_bitrate: 32 kbps, total_requested_padding_bitrate: 0 bps, total_requested_max_bitrate: 32 kbps [011:136] [7127] (audio_device_impl.cc:843): Recording [011:136] [7127] (audio_device_impl.cc:762): InitRecording [011:136] [7127] (audio_device_impl.cc:781): RecordingIsInitialized [011:137] [7127] (audio_device_impl.cc:818): StartRecording [011:137] [7127] (audio_device_impl.cc:843): Recording [011:137] [7127] (audio_device_buffer.cc:118): StartRecording [011:138] [7127] (audio_device_impl.cc:825): output: 0 [011:138] [7127] (channel.cc:817): Changing voice state, recv=1 send=1 [011:138] [7127] (thread.cc:635): Message took 442ms to dispatch. Posted from: UpdateMediaSendRecvState@../../pc/channel.cc:796

tholmgren commented 3 years ago

Incase anyone else runs into an audio issue, please check the media player control on the HTML, make sure it's not muted. :-)

DocSneider commented 3 years ago

https://github.com/kclyu/rpi-webrtc-streamer/issues/5#issuecomment-719679184

Same here :disappointed:

I'm using the following board:

Video stream works very well, but when I set audio_enable=true, the cpu-usage goes up to 100%. Even when I am only using audio but no video, the cpu-usage goes up to 70-90%.

Audio_processing_enable is set to false. The ReSpeaker 2-Mics Pi HAT contains an onboard stereo codec, so the CPU should normally don´t have that much to do. When I am executing the following command, it uses max 2% of the cpu: arecord -D hw:0,0 -V stereo -r 16000 -f S16_LE -c 2 /dev/null

I am using "DietPii" without desktop enviroment, should be almost the same as Raspberry Pi OS lite.