Background music
Closed, ResolvedPublic


In the Gtk+ version we had background musics. Some people miss them on the new version. We should keep this as an optional download

Related Objects

bcoudoin created this task.Feb 7 2016, 1:03 AM
rkaur added a subscriber: rkaur.Mar 12 2016, 12:46 PM
rkaur removed a subscriber: rkaur.
rkaur added a subscriber: rkaur.
jjazeix assigned this task to dmadaan.Aug 20 2016, 10:30 AM
jjazeix moved this task from Backlog to WIP on the GCompris board.
dmadaan removed dmadaan as the assignee of this task.Nov 25 2017, 7:56 PM
dmadaan added a project: Season of KDE.
dmadaan added a subscriber: dmadaan.
amankumargupta added a subscriber: amankumargupta.EditedDec 27 2017, 3:44 AM


Other feature to add: lower the default background music sound (we need to be able to hear the introduction voices distinctly without having the background music blocking the child to listen)

okay, that's good. I'll do it today.

Features to be added:

  1. Show the currently playing music in the main menu config dialog.
  2. Have a left/right arrows to switch between music.
  3. Have a menu like filter from which the user can select only the musics he wants to play.

Points 1 and 2 are done. Kindly test the branch for the above-linked commit.

jjazeix added a comment.EditedOct 6 2019, 9:36 AM

Hi, thanks for the update. The design needs to be improved: we should not use a button to display the actual music (except if you plan to use it to select the playable pieces of music (point 3)). We'll also need to clean up the filenames so we have something understandable displayed.

Can you rebase the branch on master too?

  1. Yes, the overall design can be improved (I think @timotheegiet would surely do it better once it's ready to be merged ;)). I just used the current design to check the working first.
  2. I'll go on to implement the point #3 now.
  3. For the file names, yes, me and @timotheegiet had discussed it on IRC few days back and he'll probably look at it next week :)
  4. Sure, I'd also prefer to rebase it on master before proceeding to #3 and make other changes in the commit as per your comments.

The feature to filter background musics and save/load them to play is implemented. At present, the changes get into effect after the software is restarted.
Next thing to do is to dynamically change the playlist in GCAudio element for background music to make the changes get into effect immediately.

The final feature is done as well!
Further steps:

  1. Needs testing by other members.
  2. Discuss more features if needed.
  3. Update music names on the server.
  4. Update the design if required.
  5. Probably merge in master for next release, if possible.

Tested quickly, it seems to work fine.

However, more than just updating the music names, I would like to completly review the current set of music we have and remove/add some. Some music in the list don't really fit with the mood of GCompris (some are too much dark, some too much heavy... I would go with more cute and light music themes).

As for the visual design, I would change a little the size of the button to fit the arrow height, and maybe a few others little cosmetic changes, but I'm fine with the way it works currently.

I would also like this to be ready and merged to master before next release.

That's great to hear! :D

Can you add a unit test for the ApplicationSettings changes?
I did one new comment in
At some places, can you take a look if you can use algorithms instead of while/for loops (using filter for example if it works to do the difference between filtered music and all music)?

Otherwise, it seems good to me :)

I updated the music set on the gcompris-data repository, and uploaded the .rcc files to the server.
Let me know if you find any issue with that new set.

On a side note, it would be nice to also display the author and license info of each track somewhere, I think in the selection list would be the right place.
Ideally, we should fetch those infos from the music metadata (in which case I'll edit the files to include those metadata), but I'm not sure if that's possible with Qt only.

Also, I think we should add a slider to adjust the volume of the background music, and maybe also for the sound effects while we are at it; for voices it may not be needed as those are the most important sounds so it's ok to always play them at full volume).

Finally, I just found a little bug: if starting GCompris with music disabled, enabling it doesn't work (no music played) until restarting the application.

jjazeix added a comment.EditedOct 22 2019, 4:29 PM
Audio can be tagged using:

vorbiscomment -w colors.ogg -t "ARTIST=Gregoire Giet" -t "TITLE=colors" -t "COPYRIGHT=CC-BY-SA 3.0" -t "DATE=2011"

Info is accessible via:

Audio {
      metaData.onMetaDataChanged: {
          console.log(metaData.title, metaData.year, metaData.copyright, metaData.contributingArtist);

Also, having the title via the metadata will avoid having to find a naming convention :)
It's to be tested on other platform (due to conversion).

Thanks, I'll add the tags to ogg files; I've read ffmpeg should keep them during conversion by default, I'll double check and update the rcc on the server.

it does not seem to be the case. I updated the script to keep metadata from ogg to mp3 conversion, but didn't manage yet to find something for aac :/

Indeed, here I found a way to transfer metadata to aac using id3v2 command line, at least for ARTIST, TITLE and YEAR.
This should be usable for mp3 too, I'll update the script accordingly.

For the copyright info I'll add them in the COMMENTS tag.

All rcc files updated on the server with proper tags (artist, title, year and copyright in comments) :)

amankumargupta added a comment.EditedOct 26 2019, 4:28 AM

So, getting back on this, this is the checklist of things to do:

  1. Fix bug: if starting GCompris with music disabled, enabling it doesn't work (no music played) until restarting the application.
  2. Add volume slider for background music and audio effects.
  3. Display the author and license info of each track.
  4. Consider the format of the music according to the platform.
  5. Add unit test for the ApplicationSettings changes.

@jjazeix @timotheegiet AFAIR, I once experimented with adding metadata to a piece of music and yes, it gets lost when converted to other formats. If we can extract the metadata in the conversion script and add it back once converted, it would be nice.

I'm currently putting point #3 in the above comment on hold for now. The metadata needs to be tested first.

All features completed, bugs fixed, and thoroughly tested.
@jjazeix can you please merge it to master ?

Ouch, actually I found a last remaining bug: when the music reaches the end of last track in the list, it restarts on track 2 instead of track 1... (it doesn't happen when using the "Next" button, only when playing normally).
I'll look at it.

Ok, the "missing track" issue is fixed, at the cost of bringing back the "restart needed to re-enable music if started without" bug.
As I noted in the commit comment, ideally fixing both would be best, but if not possible it's less bad to keep the restart-needed issue than the missing track one.

I spend most of the afternoon digging for a fix but didn't find any way to fix both.
If someone else want to try, else I'm ok to merge and ship like this.
To make it easier to test/fix, I added a temporary music of a few seconds at the end of the list (it's in the music rcc on the server; I'll replace those with proper rcc without the extra test file in a few days).

amankumargupta added a comment.EditedOct 29 2019, 5:52 PM

I tried taking a look at it in the noon. What I figured out is, when the tracks are freshly appended (after the music reaches the end of the last track and the stop signal initiates the re-append of tracks), the 1st music indeed plays, but that's for a very small period of time. After all the songs are appended, I don't know why, but the stop signal of the audio element is triggered again for some reason. This causes the 2nd track to play. I can't see why it happens :/

Even stranger is, "next" button follows the same code, but this doesn't happen there.

Since aman managed to fix the remaining bug, I'd say it's good to merge now.

jjazeix moved this task from WIP to Done on the GCompris board.Oct 30 2019, 8:39 PM
jjazeix closed this task as Resolved.

It's merged, please check the master branch to be sure it works fine :)

Tested on master, all works good :)