Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to record and play sound in m

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition, S60 5th Edition
Symbian
S60 5th Edition
Platform Security
Capabilities: )
Article
Created: bogdan.galiceanu (05 May 2009)
Last edited: hamishwillee (09 May 2013)

Contents

Overview

This article shows how to record and play sound in m.

Preconditions

Note: The play and open functions require the Read permission.

Source code

Recording sound

use audio
 
 
//Open a file for recording
audio.open("C:\\sound.wav", audio.rw)
//Start recording
audio.record()
//Record for 10 seconds and then stop
sleep(10000)
audio.stop()
//Cut 2000 milliseconds from the file at the beginning and end
audio.cut(2000, 2000)
//Show its current duration
print "The file is now " + audio.len() + " milliseconds long"
//Close the audio file
audio.close()

Playing a tone

use audio
 
 
//Play a tone with a frequency of 850 hz for 1000 milliseconds
audio.beep(850, 1000)

Playing a sound file

use audio
 
 
//Set the volume to 80% of the maximum
audio.volume(80)
//Start playing
audio.play("C:\\sound.wav")
//Play for 10 seconds and then stop
sleep(10000)
audio.stop()
//Close the audio file
audio.close()

Postconditions

Sound is recorded or played.

This page was last modified on 9 May 2013, at 02:50.
26 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×