×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    12

    Question Help with sounds on S40s

    Please can someone tell me how I can play a series of notes using the Nokia API.

    I know how to play individual notes using the following:

    com.nokia.mid.sound.Sound sound = new com.nokia.mid.sound.Sound( 523, 500 );
    sound.play(1);

    I can play 7 notes of a scale using the following:

    byte [] data = { (byte) 0x02, (byte) 0x4A, (byte) 0x3A, (byte) 0x80,
    (byte) 0x40, (byte) 0x01, (byte) 0x12, (byte) 0x04,
    (byte) 0x58, (byte) 0x4D, (byte) 0x85, (byte) 0x58,
    (byte) 0x59, (byte) 0x86, (byte) 0x18, (byte) 0x69,
    (byte) 0x87, (byte) 0x18, (byte) 0x00};

    com.nokia.mid.sound.Sound sound = new com.nokia.mid.sound.Sound( data,
    com.nokia.mid.sound.Sound.FORMAT_TONE );
    sound.play(1);

    However I don't understand what goes into the data bytes to make different notes. Can anyone tell me what is involved, or give me a URL where it is explained.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    39
    You're talking about the OTT format, I remember there's a pdf somewhere in this Forum Nokia addressing the formats(you need to dig deep), I believe you got those bytes using the Nokia Development Suite to convert from midi?

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    12
    The notes above were lifted from the Nokia UI API PDF. Unfortunately the document does not explain how to generate the byte notes.

    I've seen pages explaining how to play music from an OTT file (e.g. http://www.gamedev.net/community/for...age=1&#1724454). This uses getResourceAsStream to get the file - does this mean the OTT file has to be in the /res directory?

    I now need to create OTT files. I believe to do this I need to create a MIDI file first - can anyone recommend a decent tool for this. I found a program called Midi Maker, which is very basic, and managed to make a "Yankee Doodle" tune. I converted this to OTT using RingtoneCreator. As well as the OTT file, I also got a .noktxt file which contains the text: 024A3A400400431C8655B25A05A042160C42B9A816810856350AA62046042150B429968188523502D0A25A056140C40000.

    Now if I cut this text up and put in into the above data, I can hear Yankee Doodle through the Midlet - progress!!!

    Unfortunately the volume decreases as the sound is played. Maybe I need a better utility to make the MIDI file, and I will get a better OTT file - the search goes on.

Posting Permissions

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