Skip to content

Commit

Permalink
add a sample about how python use C# dll
Browse files Browse the repository at this point in the history
  • Loading branch information
peitaosu committed Sep 29, 2017
1 parent 6dadb16 commit 43860dc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ pip install pulsectl
--time capture specific milliseconds
--int-16 attempts to coerce data to 16-bit integer format
# Python (DLL)
> import os, sys, platform, clr
> if platform.architecture()[0] == "32bit":
> DLL_PATH = r"win32\dll\LoopbackCapture\LoopbackCapture\bin\x86\Release"
> elif platform.architecture()[0] == "64bit":
> DLL_PATH = r"win32\dll\LoopbackCapture\LoopbackCapture\bin\x64\Release"
> DLL_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), DLL_PATH)
> sys.path.append(DLL_PATH)
> clr.AddReference("LoopbackCapture")
> from LoopbackCapture import LoopbackCapture
> lc = LoopbackCapture()
> lc.Capture("record.wav", 15000)
# Python (macOS)
> from mac.LoopbackCapture import record_sounds
Expand Down

0 comments on commit 43860dc

Please sign in to comment.