DOC: Update Audio widget docs to be numpydoc compliant...
Matthias Bussonnier -
r25895:44493872
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -63,33 +63,41 class Audio(DisplayObject):
63
63
64 Examples
64 Examples
65 --------
65 --------
66 ::
67
66
68 # Generate a sound
67 Generate a sound
69 import numpy as np
68
70 framerate = 44100
69 >>> import numpy as np
71 t = np.linspace(0,5,framerate*5)
70 ... framerate = 44100
72 data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t)
71 ... t = np.linspace(0,5,framerate*5)
73 Audio(data,rate=framerate)
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
86 From a File:
76 dataleft = np.sin(2*np.pi*220*t)
77 dataright = np.sin(2*np.pi*224*t)
78 Audio([dataleft, dataright],rate=framerate)
79
87
80 Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") # From URL
88 >>> Audio('/path/to/sound.wav')
81 Audio(url="http://www.w3schools.com/html/horse.ogg")
89 >>> Audio(filename='/path/to/sound.ogg')
82
90
83 Audio('/path/to/sound.wav') # From file
91 From Bytes:
84 Audio(filename='/path/to/sound.ogg')
85
92
86 Audio(b'RAW_WAV_DATA..) # From bytes
93 >>> Audio(b'RAW_WAV_DATA..')
87 Audio(data=b'RAW_WAV_DATA..)
94 >>> Audio(data=b'RAW_WAV_DATA..')
88
95
89 See Also
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 _read_flags = 'rb'
103 _read_flags = 'rb'
Comments 0
You need to be logged in to leave comments. Login now