×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    3

    playing plain pcm sound

    Hello

    I would like to play a sound directly from an array of pcm-values. So far, I only find examples that expect a whole wav-file with its header. But I just have an array of pcm-values (generated nearly just in time, for a synthesizer) and now want to play it. How can I do this?

    Greetings
    Michael

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: playing plain pcm sound

    You will need to encode the data in a format that the device understands. This is certainly going to involve some kind of header (samples per second, bits per sample, etc.).

    You can use code like this:

    Code:
    String[] types = javax.microedition.media.Manager.getSupportedContentTypes(null);
    to get a list of content types your device will support. You must choose one of these, and encode your data appropriately.

    For compatibility, WAV is the format that works on most devices. (MIDP2 requires that, if any sampled format is supported, it must support WAV, 8kHz, 8bit mono linear.)

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    3

    Re: playing plain pcm sound

    So I have to add the appropriate header at the beginning of my pcm-array and then to play this as a ByteArrayInputStream?

    Is there no way to configure the player for a specific data-format and then to feed it with the music data? I do not really like the above solution, because I then have to give a length of the data (that I do not necessarily know...).

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: playing plain pcm sound

    It plays the formats it plays. You can't change that in Java.

    (On a Series 60 device, I think that new codecs you install into the platform can become available to Java. But you'd have to find (or write, in C) a Symbian audio codec.)

    Cheers,
    Graham.

Similar Threads

  1. Replies: 3
    Last Post: 2008-08-03, 09:04
  2. Sound recording and playing
    By sasa in forum Symbian
    Replies: 0
    Last Post: 2004-10-12, 13:41
  3. Problem on playing sound in emulator
    By mhahn0106 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-01-12, 06:00
  4. strange problem playing Sound on 7650
    By Poldipold in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-07-11, 13:12
  5. Playing wav sound with the nokia api
    By yuvalgeva in forum Mobile Java General
    Replies: 0
    Last Post: 2002-12-18, 12:50

Posting Permissions

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