Guest User

Untitled

a guest
Dec 10th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import sounddevice as sd
  2. import numpy as np
  3. fs = 48000
  4. duration=5
  5. rec = sd.rec(int(duration * fs), samplerate=fs, channels=1, blocking=True)
  6. print(rec)
  7.  
  8. array([[0.],
  9. [0.],
  10. [0.],
  11. ...,
  12. [0.],
  13. [0.],
  14. [0.]], dtype=float32)
  15.  
  16. sd.default.device # Output is [2, 3]
  17.  
  18. python3 -m sounddevice
  19. 0 DisplayPort, Core Audio (0 in, 2 out)
  20. 1 DisplayPort, Core Audio (0 in, 2 out)
  21. > 2 MacBook Pro Microphone, Core Audio (1 in, 0 out)
  22. < 3 MacBook Pro Speakers, Core Audio (0 in, 2 out)
Add Comment
Please, Sign In to add comment