How To Play a MP3

From IronPython Cookbook

(Difference between revisions)
(Play a MP3 with IronPython)
m
Line 1: Line 1:
This code requires a managed version of DirectX which can be downloaded [http://www.microsoft.com/downloads/details.aspx?FamilyID=136a7b29-aa12-4c3b-aa7d-15cd98a9a59c&displaylang=en&Hash=jm0Olyj5bX%2biGK7n%2ftVRf051HC9jXegFyBa9RdtMkqB9naPNkx4O6MOmsVeHTeEYmXA5Ra8N%2f7rErPUcSrxV6A%3d%3d here].
This code requires a managed version of DirectX which can be downloaded [http://www.microsoft.com/downloads/details.aspx?FamilyID=136a7b29-aa12-4c3b-aa7d-15cd98a9a59c&displaylang=en&Hash=jm0Olyj5bX%2biGK7n%2ftVRf051HC9jXegFyBa9RdtMkqB9naPNkx4O6MOmsVeHTeEYmXA5Ra8N%2f7rErPUcSrxV6A%3d%3d here].
 +
<pre>
import clr
import clr
 +
clr.AddReference('Microsoft.DirectX.AudioVideoPlayback')
clr.AddReference('Microsoft.DirectX.AudioVideoPlayback')
Line 7: Line 9:
mp3 = AudioVideoPlayback.Audio("C:\\myreallyfunky.mp3")
mp3 = AudioVideoPlayback.Audio("C:\\myreallyfunky.mp3")
 +
mp3.Play()
mp3.Play()
 +
</pre>

Revision as of 19:51, 14 June 2007

This code requires a managed version of DirectX which can be downloaded here.

import clr

clr.AddReference('Microsoft.DirectX.AudioVideoPlayback')

from Microsoft.DirectX import AudioVideoPlayback

mp3 = AudioVideoPlayback.Audio("C:\\myreallyfunky.mp3")

mp3.Play()
TOOLBOX
LANGUAGES