Difference between revisions of "PlaySound Command"

From GeoGebra Manual
Jump to: navigation, search
(deprecate JFugue syntax, change PlaySound[File] -> URL)
(Note: playing Midi files will work only in some browsers)
Line 186: Line 186:
 
: Plays a MIDI (*.mid) or MP3 (.mp3) file
 
: Plays a MIDI (*.mid) or MP3 (.mp3) file
 
: e.g. PlaySound["http://archive.geogebra.org/static/welcome_to_geogebra.mp3"]
 
: e.g. PlaySound["http://archive.geogebra.org/static/welcome_to_geogebra.mp3"]
 +
 +
{{Note|1= playing Midi files will work only in some browsers
 +
}}
  
 
;PlaySound[ <Function>, <Min Value>, <Max Value> ]
 
;PlaySound[ <Function>, <Min Value>, <Max Value> ]

Revision as of 11:34, 14 May 2015



PlaySound[ <Note>, <Duration>, <Instrument> ]
Plays a MIDI note.
Note is an integer from 0 to 127 that represents a musical note given by the table below. When note = 60 a Middle C is played.
Duration is the time to play the note in seconds.
Instrument is an integer that represents the synthesized instrument used to play the note. See technical specifications for possible instruments.
Most instruments are supported, but there are differences between computer platforms.
MIDI Notes
Octave C C# D D# E F F# G G# A A# B
0 0 1 2 3 4 5 6 7 8 9 10 11
1 12 13 14 15 16 17 18 19 20 21 22 23
2 24 25 26 27 28 29 30 31 32 33 34 35
3 36 37 38 39 40 41 42 43 44 45 46 47
4 48 49 50 51 51 53 54 55 56 57 58 59
5 60 61 62 63 64 65 66 67 68 69 70 71
6 72 73 74 75 76 77 78 79 80 81 82 83
7 84 85 86 87 88 89 90 91 92 93 94 95
8 96 97 98 99 100 101 102 103 104 105 106 107
9 108 109 110 111 112 113 114 115 116 117 118 119
10 120 121 122 123 124 125 126 127
PlaySound[ <JFugue Note Sequence>, <Instrument> ]
This command is deprecated and will be removed from GeoGebra soon
PlaySound[ <URL> ]
Plays a MIDI (*.mid) or MP3 (.mp3) file
e.g. PlaySound["http://archive.geogebra.org/static/welcome_to_geogebra.mp3"]
Note: playing Midi files will work only in some browsers
PlaySound[ <Function>, <Min Value>, <Max Value> ]
Plays a sound generated by Function, a time-valued function with range [-1,1]. The time units are seconds and the sound is played from time Min Value to Max Value. Sound is generated by 8-bit samples taken at a rate of 8000 samples per second.
Example: PlaySound[sin(440 2Pi x), 0, 1]
This plays a pure sine wave tone at 440 Hz (musical note A) for one second.


PlaySound[ <Function>, <Min Value>, <Max Value>, <Sample Rate>, <Sample Depth> ]
Plays a sound generated by Function, a time-valued function with range [-1,1]. The time units are seconds and the sound is played from time Min Value to Max Value. The sampling method is specified by "Sample Depth" and "Sample Rate".
"Sample Rate" is the number of sample function values taken each second. Allowable values are 8000, 11025, 16000, 22050, or 44100
"Sample Depth" is the data size of a sample in bits. Allowable values are 8 and 16.


PlaySound[ <Boolean Play> ]
Pause or resume play.
PlaySound[true] = play, PlaySound[false] = pause.
© 2024 International GeoGebra Institute