Click noise in ALSA playback - audio

I have configured ALSA for 44.1 KHZ . The alsa framework is used to capture data from the analog input using "snd_pcm_readi" api. But in our application we find that there is a click noise in the background for playback. The click noise is available in the playback even when there is no analog input, this ensures that there is no buffering issue.But we were not able to get the cause for the click noise.

Related

ALSA Card for Respeaker 4-Mic Setup

During the installation, we are supposed to check the sound card by pressing ‘arecord -L’ to obtain a certain output like shown below,
pi#raspberrypi:~ $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
playback
ac108
sysdefault:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Hardware device with all software conversions
usbstream:CARD=seeed4micvoicec
seeed-4mic-voicecard
USB Stream Output
usbstream:CARD=ALSA
bcm2835 ALSA
USB Stream Output
However, the output that I have received is as shown below,
Screenshot of Output
It basically shows that I don’t have the ALSA soundcard, and I cant move on to the sound localization process. Please show how can I move forward, thanks!

Recording composite video to an audio file

I'm trying to record raw composite video siganl to an audio file by connecting the yellow rca cable from a player to the mic input in my pc so I can then put the cable in my audio output and connect it with the video input in an old crt tv and play back the signal to the tv so that I can view the original video.
But that didn't work and I can only see random white lines.
Is that due to frequency limits in the audio format or in the onboard audio chip, or is analog-digital conversion and the other way when recording and playing back damaging the signal?
Video signals operate in ranges above 1 Mhz, where high-quality audio signals only max out at ~96Khz. Video signals would likely need to be be encoded in a format that an audio recorder could pick up, then decoded back into a video signal before a television could render it properly. This answer on the Sound Design exchange may be of interest to you.
A very high bitrate uncompressed audio file may be able to store a low-fidelity video signal, a black and white signal could be stored at sub-vhs quality, but could be at least a resolvable image, recording component video may be possible even though syncing the seperate tracks would be hard.
I tried it.
Sampling rate is 192KHz. It can record up to 192/2=96KHz.
I succeed to capture part of luminance signal.
Color signal is in very high frequency.
So we can't record color signal using soundcard.
Video is very distorted.
However we may can caputure more clearly using soundcard more highter sampling rate.
https://m.youtube.com/watch?v=-Q_YraNAGhw&feature=youtu.be

Setting channel volume in ALSA

My app plays raw PCM audio data through various channels using ALSA. I'm allocating a new audio channel by using snd_pcm_open(), then setting the PCM format via the snd_pcm_hw_params_xxx() calls and finally feeding raw PCM audio data to ALSA by using the snd_pcm_writei() API.
This is all working fine so far but I haven't found any way to tell ALSA to reduce the volume of a sound channel allocated in the way outlined above. Of course, I could just manually apply volume scaling to the PCM data before sending it to ALSA via snd_pcm_writei() but is there really no way to have ALSA do this on its own?
ALSA has no such function.
You have to do the scaling yourself, or use a sound server like PulseAudio.
You can via amixer:
amixer cset name='Headphone Playback Volume' 98%,100%
To get the name value - check alsamixer, appending 'Playback Volume' to each.
And via alsamixer:
Keyboard z is left channel decrease.
q is left increase.
and
c is right decrease.
e is right increase

sounddriver with aplay/arecord works fine not with another application

I wrote an I2S sound driver for the Raspberry Pi. I looks like it works fine.
With alsa-aplay I can playback some music and with alsa-arecord I can record some sound which sounds great!
Now, the thing is.. I crosscompiled a simple application with the pjproject/pjsip with the aim of using the Raspberry Pi as a softphone. Some additional info: I build my own kernel (angstrom distribution) and rootfs with Openembedded, also with PJproject included.
PJproject has some test-applications and one of them (pjsystest) am I using to simply test if my sounddriver works fine. and it doesn't..
The pjsysstest had some different test options like, Play a Tone and Record Audio.
Through debbugging I can conclude that when I start to play a tone option, the next callbacks are called.
- PCM playback open
- PCM playback hw params
- PCM playback prepare
- PCM playback trigger (start)
- PCM playback trigger (stop)
- PCM playback prepare
Using just aplay:
- PCM playback open
- PCM playback hw params
- PCM playback prepare
- PCM playback trigger (start)
//when the file is at the end:
- PCM playback trigger (stop)
- PCM playback hw free
- PCM playback close
Debugging with the pjsystest gives some strage results.
I don't understand why the trigger callbacks is called a second time to stop the stream and after that just the prepare callback is called (and not the trigger start callback aswell). Because of that there is no tune playing(because the playback stream is already stopted and nog started again).
Now, I hope you'll do understand what my problem is, and I hope someone can give me an answer or suggestion in the right direction too (or even better the solution).
Thanks a lot!
[edit]
In the meantime I tried some other PJproject sample applications: stereotest and auddemo. Those are actually working :) Thats good, this says (I think):
- nothing is wrong with my kernel and rootfs
- nothing is wrong with my driver.
The question now is: Why is the PJSYSTEST not working. Why does it calls the trigger start and then stops it directly ?
[/edit]

With Python/PySide/PyQt/Phonon how to control a USB Soundcards output sample clock rate?

I am trying to O/P audio to a USB soundcard (Lindy PnP SoundCard device) via Python/PySide/PyQT by the use of Phonon and/or QTMultimedia.
I can O/P the aduio (mp3/wav) which is no problem - the issue is that I want to control the USB's output sample clock rate, I need to be able to change this from 44.1 to 48 kHz. The soundcard comes with its own s/w that allows this so it is possible.
I can play Audio through Phonon like so..
self.mediaObj=phonon.Phonon.MediaObject(self)
self.audioSink=Phonon.AudioOutput(Phonon.MusicCategory, self)
self.audioPath=Phonon.createPath(self.mediaObj, self.audioSink)
self.audioSink.setVolume(0.3)
However I do not see any way to change the sample clock rate of the USB device from looking at the Class Reference doc's it seems its not possible.
http://www.pyside.org/docs/pyside/PySide/phonon/index.html
So then I have tried to use Qt Multimedia to change the USB soundcards O/P clock rate..
format = QtMultimedia.QAudioFormat()
format.setChannels(2)
format.setFrequency(44100)
format.setSampleSize(16)
format.setByteOrder(QtMultimedia.QAudioFormat.LittleEndian)
format.setSampleType(QtMultimedia.QAudioFormat.SignedInt)
This has no effect. Does anyone know how I would do this and if it is even possible with Phonon/PyQT? I am guessing I need to go lower and try find the USB Soundcard directly which will be messy..
Much appeciate any help!!
Alan

Resources