| ID | Creation date | May 5, 2009 | |
| Platform | S60 2nd Edition, S60 3rd Edition, S60 5th Edition | Tested on devices | Nokia N95, Nokia E90 |
| Category | M | Subcategory | Audio |
| Keywords (APIs, classes, methods, functions): audio |
This article shows how to record and play sound in m.
Note: The play and open functions require the Read permission.
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()
use audio
//Play a tone with a frequency of 850 hz for 1000 milliseconds
audio.beep(850, 1000)
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()
Sound is recorded or played.
No related wiki articles found