##// END OF EJS Templates
DOC: Update Audio widget docs to be numpydoc compliant...
Matthias Bussonnier -
Show More
@@ -63,33 +63,41 b' class Audio(DisplayObject):'
63 63
64 64 Examples
65 65 --------
66 ::
67 66
68 # Generate a sound
69 import numpy as np
70 framerate = 44100
71 t = np.linspace(0,5,framerate*5)
72 data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t)
73 Audio(data,rate=framerate)
67 Generate a sound
68
69 >>> import numpy as np
70 ... framerate = 44100
71 ... t = np.linspace(0,5,framerate*5)
72 ... data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t)
73 ... Audio(data,rate=framerate)
74
75 Can also do stereo or more channels
76
77 >>> dataleft = np.sin(2*np.pi*220*t)
78 ... dataright = np.sin(2*np.pi*224*t)
79 ... Audio([dataleft, dataright],rate=framerate)
80
81 From URL:
82
83 >>> Audio("http://www.nch.com.au/acm/8k16bitpcm.wav")
84 >>> Audio(url="http://www.w3schools.com/html/horse.ogg")
74 85
75 # Can also do stereo or more channels
76 dataleft = np.sin(2*np.pi*220*t)
77 dataright = np.sin(2*np.pi*224*t)
78 Audio([dataleft, dataright],rate=framerate)
86 From a File:
79 87
80 Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") # From URL
81 Audio(url="http://www.w3schools.com/html/horse.ogg")
88 >>> Audio('/path/to/sound.wav')
89 >>> Audio(filename='/path/to/sound.ogg')
82 90
83 Audio('/path/to/sound.wav') # From file
84 Audio(filename='/path/to/sound.ogg')
91 From Bytes:
85 92
86 Audio(b'RAW_WAV_DATA..) # From bytes
87 Audio(data=b'RAW_WAV_DATA..)
93 >>> Audio(b'RAW_WAV_DATA..')
94 >>> Audio(data=b'RAW_WAV_DATA..')
88 95
89 96 See Also
90 97 --------
98 ipywidget.Audio
91 99
92 See also the ``Audio`` widgets form the ``ipywidget`` package for more flexibility and options.
100 AUdio widget with more more flexibility and options.
93 101
94 102 """
95 103 _read_flags = 'rb'
General Comments 0
You need to be logged in to leave comments. Login now