Copyright (c) Hyperion Entertainment and contributors.
AmigaOS Manual: Sounds
Playing
/* Program 16. Play.rexx */
/* ** Play AIFF audio file */ fileName = 'test.aiff' /* Audio file name */ frequency = 22050 /* Playback frequency */ volume = 100 /* Full volume */ unit = 0 /* Use device unit 0 */ /* Audio stream properties */ properties = 'TYPE=AIFF/' properties = properties || 'FREQUENCY=' || frequency || '/' properties = properties || 'VOLUME=' || volume || '/' properties = properties || 'UNIT=0' /* Open stream */ IF ( ~OPEN( 'audio', 'AUDIO:' || properties, "W" ) ) THEN DO SAY 'Failed to open audio stream.' EXIT 0 END /* Open audio file */ IF ( OPEN( 'file', fileName, "R" ) ) THEN DO /* Play */ DO UNTIL ( EOF( 'file' ) = 1 ) buffer = READCH( 'file', 4096 ) WRITECH( 'audio', buffer ) END /* Close audio file */ CLOSE( 'file' ) END ELSE DO SAY 'Failed to open file "' || fileName || '".' END /* Close stream */ CLOSE( 'audio' )