×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Question How to play mp3 and midi through QML

    I found that Audio in QtMobilityKit can only play wav file and it cannot play mp3 and midi file.
    and there are no example on the internet that shows how to play mp3 and midi file directly (from the qrc file, not streaming).
    is there any solution for this problem?
    I made a music game and it would be a problem if it cannot play mp3 or midi file at all.

    I know N950 must be able to play mp3 because music player can play mp3 music after all.

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: How to play mp3 and midi through QML

    Hi,
    Mobility should support mp3 because it makes use of GStreamer.
    So actually Mobility itself, cannot really distinguish between a wav or mp3 file.
    If you are not able to play mp3 with mobility then you are running in a bug.

    About midi, there is no midi syntethizer (eg: timidity) on harmattan as well as its decoders.
    So this is what you get if you try to play an midi file on the device.
    But if you really need it your package could install it.

    /home/developer $ ./gst-launch-0.10 -v playbin uri=file:///home/developer/7steps2h.mid
    Setting pipeline to PAUSED ...
    /GstPlayBinlaybin0/GstDecodeBin2:decodebin20: caps = video/x-raw-yuv, format=(fourcc){ UYVY, YUY2 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; audio/x-sbc, rate=(int){ 16000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], mode=(string){ mono, dual, stereo, joint }, blocks=(int){ 4, 8, 12, 16 }, subbands=(int){ 4, 8 }, allocation=(string){ snr, loudness }, bitpool=(int)[ 2, 64 ]; audio/mpeg; audio/x-raw-int, endianness=(int){ 1234, 4321 }, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-raw-float, endianness=(int){ 1234, 4321 }, width=(int)32, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, endianness=(int){ 1234, 4321 }, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, endianness=(int){ 1234, 4321 }, signed=(boolean)true, width=(int)24, depth=(int)24, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, endianness=(int){ 1234, 4321 }, signed=(boolean)true, width=(int)32, depth=(int)24, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-alaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; audio/x-mulaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 32 ]; video/x-raw-rgb, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-raw-yuv, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 8, 2048 ], height=(int)[ 8, 2048 ]; video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[ 8, 2048 ], height=(int)[ 8, 2048 ]
    /GstPlayBinlaybin0/GstDecodeBin2:decodebin20/GstTypeFindElement:typefind.GstPad:src: caps = audio/midi
    Pipeline is PREROLLING ...
    ERROR: from element /GstPlayBinlaybin0/GstDecodeBin2:decodebin20: Your GStreamer installation is missing a plug-in.
    Additional debug info:
    gstdecodebin2.c(3246): gst_decode_bin_expose (): /GstPlayBinlaybin0/GstDecodeBin2:decodebin20:
    no suitable plugins found
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    /GstPlayBinlaybin0/GstDecodeBin2:decodebin20/GstTypeFindElement:typefind.GstPad:src: caps = NULL
    Freeing pipeline ...

  3. #3
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: How to play mp3 and midi through QML

    What gnuton said - however, I have seen seen that some mp3-files do not work (even though I can playback those files on my Mac). Could be something related to encoding....

    Hartti

  4. #4
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: How to play mp3 and midi through QML

    Hi Hartti,
    I guess Mp3 PRO format doesn't work on device. Standard MP3s should work fine.
    If you need to play Mp3 PRO then you have to install some missing plugins.
    Last edited by gnuton; 2011-10-19 at 06:12.

  5. #5
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Re: How to play mp3 and midi through QML

    Quote Originally Posted by gnuton View Post
    Hi Hartti,
    I guess Mp3 PRO format doesn't work on device. Standard MP3s should work fine.
    If you need to play Mp3 PRO then you have to install some missing plugins.
    I don't really understand about Mp3 PRO format. what is that?

    and I always get this error codec or something whenever I play mp3 file.

    hey do you have any source for the built-in music player on the meego?
    or maybe example of mp3 player through QML?
    Last edited by gnuton; 2011-10-19 at 06:13.

  6. #6
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Re: How to play mp3 and midi through QML

    oh yeah I remember some said that mobility cannot play file from Qrc file.
    so how should I play the file?
    where should I put the music file instead of qrc ?
    I don't really understand about meego file directory structure though.

  7. #7
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: How to play mp3 and midi through QML

    Packaging and playing music file is strait-forward in QML. Just put your music file in your working folder (for example where you have your .qml files Or create one directory to place all those resources).

    For playing, if your music file is in same directory that your .qml file have then use following code:

    Code:
    Audio {
            id: musicFile
            source: "myFile.wav"
            volume: 0.5
        }
    if your music file is in a some directory (say, myDir) which is at same directory level to your .qml file then use

    Code:
    Audio {
            id: musicFile
            source: "myDir/myFile.wav"
            volume: 0.5
        }

  8. #8
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    Re: How to play mp3 and midi through QML

    Quote Originally Posted by savaj View Post
    Packaging and playing music file is strait-forward in QML. Just put your music file in your working folder (for example where you have your .qml files Or create one directory to place all those resources).

    For playing, if your music file is in same directory that your .qml file have then use following code:

    Code:
    Audio {
            id: musicFile
            source: "myFile.wav"
            volume: 0.5
        }
    if your music file is in a some directory (say, myDir) which is at same directory level to your .qml file then use

    Code:
    Audio {
            id: musicFile
            source: "myDir/myFile.wav"
            volume: 0.5
        }
    that's it?
    no need to play with .pro file ?
    I thought it need to be like in symbian. wew

  9. #9
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: How to play mp3 and midi through QML

    If you place your .wav file in same directory as your .qml file Or sub-directories of it then no need to change in .pro file as that directory already included in .pro file. And all files in that directory will automatically copied to respective directories in mobile. However you place .wav file to some external directory then you have to include it in .pro file.

Similar Threads

  1. Play MIDI notes without writing a MIDI file
    By himork in forum Symbian
    Replies: 2
    Last Post: 2010-06-07, 23:30
  2. MIDI play only twice
    By loles in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2009-07-07, 04:00
  3. Generate and play midi
    By korakotc in forum Symbian
    Replies: 1
    Last Post: 2005-08-09, 18:11
  4. Is it possible to play a midi ?
    By mouldnadif in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-12-27, 15:29
  5. Replies: 1
    Last Post: 2003-06-21, 16:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×