Gstreamer crackling sound on Raspberry Pi 3 while playing video - raspberry-pi

I am playing a hardware accelerated video on the Raspberry Pi 3 using this simple pipeline:
gst-launch-1.0 playbin uri=file:///test/test.mp4
As soon as the video begins to play, any sound being played in parallel using ALSA begins to crackle (tested with gstreamer and mplayer). It's a simple WAV-file and I am using a USB audio interface.
Listening to the headphone jack already crackles without playing an audio file (but this jack is very low quality and I don't know if that's a different effect).
Playing the audio in the same pipeline as the video does not help. CPU is only on approx. 30 % load and there's plenty of free memory. I already overclocked the SD card. Playing two videos in parallel with omxplayer has no impact and sound still plays well. But as soon as I start the pipe above, the sound begins to crackle.
I tried "stress" to simulate high CPU load. This had no impact either, so CPU does not seem to be the problem (but maybe the GPU?).
This is the gstreamer pipeline to test the audio:
gst-launch-1.0 filesrc location=/test/test.wav ! wavparse ! audioconvert ! alsasink device=hw:1,0
GST_DEBUG=4 shows no problems.
I tried putting queues on different places but nothing helped. Playing a video without audio tracks works a little bit better. But I have no idea, where the ressource shortage may lie, if it even is one.
It somehow seems like gstreamer is disturbing audio streams.
Any ideas where the problem may be are highly appreciated.

It seems like the USB driver of my interface is expecting a very responsive system. I bought a cheap new USB audio interface with a bInterval value of 10 instead of 1 and everything works fine now. More details can be found here: https://github.com/raspberrypi/linux/issues/2215

Related

How to do High End video encoding on BeagleboneBlak

As we know BeagleBone Black dont have a DSP on SoC specific for the Video processing but is there any way we can achieve that by adding some extra DSP board.
I mean like Raspberry got Video Processing, so anyone tried to integrate both to get, so we have both the things to make that work.
I know its not the optimal way and these both are different but i have only one BBB and one Raspberry and I am trying to achieve some 1080p video streaming with better quality.
There is no DSP on BeagleBoneBlack, you need to use DSP functions.
If your input is audio, you can use ALSA.
When you say "dont have a DSP on SoC specific for the Video processing" - I think you mean what is usually called a VPU (Video Processing Unit), and indeed Beaglebone Black's AM3358 processor doesn't have it (source: http://www.ti.com/lit/gpn/am3358)
x264 has ARM NEON optimizations, so it can encode video reasonably well in software, 640x480#30fps should be fine, but 1920x1080#30fps is likely out of reach (you may get 8-10fps).
On Raspberry Pi, you can use gstreamer with omxh264enc to take advantage of the onboard VPU to encode video. I think it is a bit rough (not as solid as raspivid etc) but this should get you started: https://blankstechblog.wordpress.com/2015/01/25/hardware-video-encoding-progess-with-the-raspberry-pi/

How do I record a video of my iPhone app from the simulator?

I am using OSX mountain lion, and I have been able to record a video using quick time to screen capture, but it does not record the sound generated from the iOS Simulator, but rather from the microphone.
I want to record audio and video from the iOS Simulator.
You could:
- try a professional screen recording software (Camtasia, Screenflow,...)
- use a virtual sound output device that captures the sound and writes it to disk
- connect your sound output to your input (using a Cinch cable)
See http://bit.ly/UXBJ9N for more info on the latter two.
I ended up using sound flower (which I can't praise enough - it was much more simple than I expected - and tiny app size too) to capture audio, and a random screen capture utility to capture video, then I married them up in a video editing application. Not perfect, but it works.
I will post here if I find a simpler solution, because despite all the blog posts about this matter, I could not find something ideal.

Beat Detektion: Detecting audio from app and produce a wave or bar for that audio... Just like Winamp or Windows Media Player

I am trying to understand the concept of Beat Detektion and I found that it works on the basis of detecting sound through Microphone. So, my first question is will it not be a disadvantage if i am detecting sound from Microphone? Because when we are using the device it happens that other sound from environment is also there so the actual beat will not produce for sound.
My second question (actually where i got stuck) I found that this Beat Detektion is not able to access iPod Library. Will i be able to play beats if i fetch the song from ipod Library in my app and then i use with beat detektion.
http://www.cubicproductions.com/index.php?option=com_content&view=article&id=67&Itemid=82
http://www.gearslutz.com/board/product-alerts-older-than-2-months/457617-beatdetektor-iphone-app-open-source-algorithm-bpm-detection.html
I will be very thankful if any reference/link other then above provided to understand Beat Detektion more...
Edit 1
I have got the code for the above from this link But this code is in C++ and there it is written that we have to convert the code to XCODE project using CMAKE software. I am somehow able to convert the code to xcode project but then i am only having cpp files then how should i run the program in iphone???
ok I am somehow able to solve my problem with the Apple's sample code : AurioTouch
I have implemented song in that example and produced the beats of the song on the basis of the beats.. In Iphone we can access sound beat using mic only. So aurioTouch uses same for beat detection

Outputting sound using multiple audio routes at the same time in an iPhone App?

I'm playing around with audio routes in AVAudioSession at the moment and I'm wondering whether it is possible to output sound to multiple audio routes at the same time i.e. a sound playing from the speaker and a different sound playing in the headphones? Ideally I'd like to be able to play separate sounds via a dock connector (using a 3.5mm jack adapter) and the headphone jack at the same time so if someone could tell me whether or not this is actually possible that would be a great help.
Thanks
I don't think it was possible three years ago when you wrote this, but it is possible now to play one sound through the headphone jack and another through a USB audio interface connected to the dock connector. This WWDC presentation walks you through it and provides sample code.
I don't think it's possible to play separate sounds through the headphone jack and the speaker because the AVAudioSessionRouteDescription only shows one of these built-in output ports at a time. You'd have to add a second audio interface via USB, which adds a second output port to the AVAudioSessionRouteDescription. I'm testing with a Roland Duo-Capture mk2 right now and it's working.

Which audio playback technology do I need for this?

I have trouble choosing the right audio playback technology. There's a ton of technologies to use on the iPhone, it's so confusing.
What I need to do is this:
start playing short sounds ranging between 0.1 and 2 seconds
high quality playback, no crackle (I heard some of the iPhone audio playback technologies do a crackle sound on start or end, which is bad!)
ability to start playback of a sound, while there's already another one playing right now (two, three or more sounds at the same time)
What would you suggest here, and why? Thanks :-)
There are basically four options for playing audio on the iPhone:
Audio Toolbox. Easy, but only good for playing sound effects in applications (sample code).
Audio Queue Services. Very powerful, can do anything. C API, pretty messy to work with. Callbacks, buckets, pain.
AVAudioPlayer. About the easiest option. Can play compressed audio, with a simple wrapper you can easily play multiple instances of the same sample at once (non-compressed audio only, as there is only one HW audio decoder). Starting to play a sound with AVAudioPlayer seems to lag about 20 ms, could be a problem.
OpenAL. Decent compromise between complexity and features. Sounds do not lag, you can play multiple sounds just fine, but you have to do a lot of the work yourself. I’ve written a sound engine called Finch that can help you.
Don’t know much about cracking, never experienced it. I think there were some issues with playing seamless compressed loops with AVAudioPlayer, can be overcome by saving the loop without compression.