Active Topics

 


Reply
Thread Tools
Posts: 11 | Thanked: 33 times | Joined on Jan 2010 @ Sweden
#1
Hey everyone,

As an exercise in learning Qt and figuring out if low latency audio works, I started making a simple metronome app.

Source here: https://github.com/krig/metronom-sailfish

My conclusion so far: The OS is not quite ready for this yet.

I thought I'd write down what I've been doing here, so that it can help others that try to do the same thing in the future. The two main problems that I had will both hopefully be fixed in the next update.

First, I tried playing sound using the QML SoundEffect class which is part of the QtMultimedia package, and it works with only one issue: The system volume is bypassed, so the sound is always played at maximum volume.

To get around that problem, I started experimenting with using libpulse-simple to play sound, but I haven't gotten this to work. I suspect that maybe it needs a glib mainloop, because I can create the stream OK, but writing to it hangs. Maybe it's something obvious I'm doing wrong, comments from someone with more experience working with Pulseaudio are more than welcome.

The second problem is obtaining permission from the system to play sound, which should be done using libaudioresource, or libaudioresource-qt. Only problem there is that those libraries aren't actually on the device yet. So right now my app is using libresourceqt5. Now, thanks to the previous bug in SoundEffect it doesn't really need to, but...

One thing that would be nice would be example apps in this area. Maybe a game which uses PulseAudio directly to play sound, and a Qt UI app which needs low-latency audio, like a drum machine for example.

More info on libaudioresource-qt can be found here:

https://github.com/nemomobile/libaud...ple/player.cpp
 

The Following 3 Users Say Thank You to krig For This Useful Post:
kimmoli's Avatar
Posts: 562 | Thanked: 2,744 times | Joined on Dec 2013 @ Espoo, Finland
#2
Originally Posted by krig View Post
playing sound using the QML SoundEffect class which is part of the QtMultimedia package, and it works with only one issue: The system volume is bypassed, so the sound is always played at maximum volume.
My app was rejected at harbour QA for that reason...
Then i switched to use Audio class from the same package, but it has bugs too. it starts with a delay, and after playing is stopped, it makes a glitch in possible screen animations.

Do you have any plans how to avoid timers stretching when phone goes to suspend?
 
Posts: 11 | Thanked: 33 times | Joined on Jan 2010 @ Sweden
#3
Well, I think my plan right now is to wait and see what the next update fixes before submitting If there are still serious issues, I think I'll try to rewrite it to use the Qt C++ APIs for sound and timers.

I hadn't noticed the issue with suspend, that's going to be a problem... Maybe it's just not feasible to do these kinds of apps in QML.
 
Reply


 
Forum Jump


All times are GMT. The time now is 19:24.