Code Monkey home page Code Monkey logo

cl-portaudio's People

Contributors

fare avatar filonenko-mikhail avatar marcowahl avatar sjl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cl-portaudio's Issues

Not working with SBCL on Mac os

This library is working well using CCL on MacBook Pro with sierra at least the sample echo from here and print-devices the only problem is that you must shadow the symbol portaudio:terminate.

I'm using

CL-USER> (machine-instance)
"MacBook-Pro-de-Antonio.local"
CL-USER> (machine-type)
"X86-64"
CL-USER> (machine-version)
"Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz"
CL-USER> (software-type)
"Darwin"
CL-USER> (software-version)
"16.7.0"

and

brew info portaudio                                                                                                                                                                                                 
portaudio: stable 19.6.0 (bottled), HEAD
Cross-platform library for audio I/O
http://www.portaudio.com
/usr/local/Cellar/portaudio/19.6.0 (33 files, 452.7KB) *
  Poured from bottle on 2017-07-28 at 15:43:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/portaudio.rb
==> Dependencies
Build: pkg-config โœ”

But working with SBCL (print-devices) never returns

CL-USER> (print-devices)
PortAudio version number = 1246720
PortAudio version text = PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4
Number of devices = 3
---------------------- device 0
[ Default Input ]
Name = Built-in Microphone
Host API = Core Audio
Max inputs = 2, Max outputs = 0
Default low input latency = 0.0029
Default low output latency = 0.0100
Default high input latency = 0.0247
Default high output latency = 0.1000
Default sample rate = 44100.0000
Supported standard sample rates
for half-duplex float 32 bit 2 channel input =
<===== Hangs here forever

Then when I stop the process I get this stack:

Interrupt from Emacs
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [CONTINUE] Continue from break.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10030A8003}>)

Backtrace:
  0: ("bogus stack frame")
  1: ("foreign function: _ZN10Resampler215ConstructorBodyEddidd28ResamplerSpecificationMethodid")
  2: ("foreign function: _ZN17Resampler2WrapperC2EP19SampleRateConverteriddiiidjb")
  3: ("foreign function: _ZN17Resampler2WrapperC1EP19SampleRateConverteriddiiidjb")
  4: ("foreign function: _ZN19SampleRateConverter16ReplaceResamplerEv")
  5: ("foreign function: _ZN19SampleRateConverterC2ERK14StreamDescPairRK18ChainBuildSettings")
  6: ("foreign function: _ZN19PCMConverterFactory6AddSRCER14StreamDescPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS5_9allocatorIS8_EEEE")
  7: ("foreign function: _ZN19PCMConverterFactory27BuildConverterChainSRCNoMixERK14StreamDescPairRK17ChannelLayoutPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS9_9allocatorISC_EEEE")
  8: ("foreign function: _ZN19PCMConverterFactory22BuildSubConverterChainERK14StreamDescPairRK17ChannelLayoutPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS9_9allocatorISC_EEEE")
  9: ("foreign function: _ZN19PCMConverterFactory19BuildConverterChainERK14StreamDescPairRK18ChainBuildSettingsP19AudioConverterChainPS_")
 10: ("foreign function: _ZN17ConverterRegistry15CreateConverterERK14StreamDescPairPP19AudioConverterChainjPK21AudioClassDescription")
 11: ("foreign function: _AudioConverterNewInternal")
 12: ("foreign function: OpenAndSetupOneAudioUnit")
 13: ("foreign function: OpenStream")
 14: ("foreign function: IsFormatSupported")
 15: ("foreign function: Pa_IsFormatSupported")
 16: (PORTAUDIO::%IS-FORMAT-SUPPORTED #<STREAM-PARAMETERS {1004C6E153}> NIL 8000.0d0)
 17: (PORTAUDIO::IS-FORMAT-SUPPORTED #<STREAM-PARAMETERS {1004C6E153}> NIL 8000.0d0)
 18: (PORTAUDIO::PRINT-SUPPORTED-STANDARD-SAMPLE-RATES #<STREAM-PARAMETERS {1004C6E153}> NIL)
 19: (PRINT-DEVICES)
 20: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PRINT-DEVICES) #<NULL-LEXENV>)
 21: (EVAL (PRINT-DEVICES))
 22: (SWANK::%EVAL-REGION "(print-devices) ..)
 23: ((LAMBDA NIL :IN SWANK::%LISTENER-EVAL))
 24: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {1004C6DD4B}>)
 25: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {1004C6DD2B}>)
 26: (SWANK::%LISTENER-EVAL "(print-devices) ..)
 27: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(print-devices) ..)
 28: (EVAL (SWANK-REPL:LISTENER-EVAL "(print-devices) ..)
 29: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(print-devices) ..)
 30: (SWANK::PROCESS-REQUESTS NIL)
 31: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 32: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 33: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {10030A7FEB}>)
 34: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/toni/.roswell/lisp/slime/2017.02.27/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {..
 35: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1002FB67E3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {100308F6C3}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 36: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1002F587F3}> NIL)
 37: ((FLET #:WITHOUT-INTERRUPTS-BODY-1148 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 38: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 39: ((FLET #:WITHOUT-INTERRUPTS-BODY-358 :IN SB-THREAD::CALL-WITH-MUTEX))
 40: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {724DCFB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
 41: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {10030A8003}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {10030A7F6B}> (#<SB-THREAD:THREAD "re..
 42: ("foreign function: call_into_lisp")
 43: ("foreign function: new_thread_trampoline")
 44: ("foreign function: _pthread_body")
 45: ("foreign function: _pthread_body")
 46: ("foreign function: thread_start")

and when I try to run the example:

(use-package :portaudio)


 (defconstant +frames-per-buffer+ 1024)
 (defconstant +sample-rate+ 44100d0)
 (defconstant +seconds+ 15)
 (defconstant +sample-format+ :float)
 (defconstant +num-channels+ 2)


 (defun test-read-write-converted-echo ()
  "Record input into an array; Separate array to channels; Merge channels into array; Play last array." 
  (with-audio
    (format t "~%=== Wire on. Will run ~D seconds . ===~%" +seconds+) 
    (with-default-audio-stream (astream +num-channels+ +num-channels+ :sample-format +sample-format+ :sample-rate +sample-rate+ :frames-per-buffer +frames-per-buffer+) 
      (dotimes (i (round (/ (* +seconds+ +sample-rate+) +frames-per-buffer+)))
         (write-stream astream
                                    (merge-channels-into-array astream
                                                               (separate-array-to-channels astream
                                                                                           (read-stream astream))))))))

I get this error depending only the first time, if I execute print-devices or this again it only hangs

arithmetic error DIVISION-BY-ZERO signalled
   [Condition of type DIVISION-BY-ZERO]

Restarts:
 0: [*ABORT] Return to SLIME's top level.
 1: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10030D0003}>)

Backtrace:
  0: ("bogus stack frame")
  1: ("foreign function: _ZN17SincKernelFactory19ReferenceSincKernelEiidd")
  2: ("foreign function: _ZN10Resampler215ConstructorBodyEddidd28ResamplerSpecificationMethodid")
  3: ("foreign function: _ZN17Resampler2WrapperC2EP19SampleRateConverteriddiiidjb")
  4: ("foreign function: _ZN17Resampler2WrapperC1EP19SampleRateConverteriddiiidjb")
  5: ("foreign function: _ZN19SampleRateConverter16ReplaceResamplerEv")
  6: ("foreign function: _ZN19SampleRateConverterC2ERK14StreamDescPairRK18ChainBuildSettings")
  7: ("foreign function: _ZN19PCMConverterFactory6AddSRCER14StreamDescPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS5_9allocatorIS8_EEEE")
  8: ("foreign function: _ZN19PCMConverterFactory27BuildConverterChainSRCNoMixERK14StreamDescPairRK17ChannelLayoutPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS9_9allocatorISC_EEEE")
  9: ("foreign function: _ZN19PCMConverterFactory22BuildSubConverterChainERK14StreamDescPairRK17ChannelLayoutPairRK18ChainBuildSettingsRNSt3__16vectorIP22BufferedAudioConverterNS9_9allocatorISC_EEEE")
 10: ("foreign function: _ZN19PCMConverterFactory19BuildConverterChainERK14StreamDescPairRK18ChainBuildSettingsP19AudioConverterChainPS_")
 11: ("foreign function: _ZN17ConverterRegistry15CreateConverterERK14StreamDescPairPP19AudioConverterChainjPK21AudioClassDescription")
 12: ("foreign function: _AudioConverterNewInternal")
 13: ("foreign function: _ZN23AUInputFormatConverter210SetFormatsERK27AudioStreamBasicDescriptionS2_")
 14: ("foreign function: _ZN15AUConverterBase14SetupConverterEjb")
 15: ("foreign function: _ZN5AUHAL14SetupConverterEjb")
 16: ("foreign function: _ZN15AUConverterBase18SetupAllConvertersEbj")
 17: ("foreign function: _ZN5AUHAL10InitializeEv")
 18: ("foreign function: _ZN6AUBase12DoInitializeEv")
 19: ("foreign function: _ZN6AUBase22ComponentEntryDispatchEP19ComponentParametersPS_")
 20: ("foreign function: _ZN19ComponentEntryPointI5AUHALE8DispatchEP19ComponentParametersPS0_")
 21: ("foreign function: AudioUnitInitialize")
 22: ("foreign function: OpenAndSetupOneAudioUnit")
 23: ("foreign function: OpenStream")
 24: ("foreign function: Pa_OpenStream")
 25: ("foreign function: Pa_OpenDefaultStream")
 26: (PORTAUDIO::%OPEN-DEFAULT-STREAM #.(SB-SYS:INT-SAP #X0744DFF0) 2 2 1 44100.0d0 1024 #.(SB-SYS:INT-SAP #X00000000) #.(SB-SYS:INT-SAP #X00000000))
 27: (OPEN-DEFAULT-STREAM 2 2 :FLOAT 44100.0d0 1024)
 28: (TEST-READ-WRITE-CONVERTED-ECHO)
 29: (SB-INT:SIMPLE-EVAL-IN-LEXENV (TEST-READ-WRITE-CONVERTED-ECHO) #<NULL-LEXENV>)
 30: (EVAL (TEST-READ-WRITE-CONVERTED-ECHO))
 31: (SWANK::%EVAL-REGION "(test-read-write-converted-echo) ..)
 32: ((LAMBDA NIL :IN SWANK::%LISTENER-EVAL))
 33: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {100409FDCB}>)
 34: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {100409FDAB}>)
 35: (SWANK::%LISTENER-EVAL "(test-read-write-converted-echo) ..)
 36: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(test-read-write-converted-echo) ..)
 37: (EVAL (SWANK-REPL:LISTENER-EVAL "(test-read-write-converted-echo) ..)
 38: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(test-read-write-converted-echo) ..)
 39: (SWANK::PROCESS-REQUESTS NIL)
 40: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 41: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 42: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {10030CFFEB}>)
 43: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/toni/.roswell/lisp/slime/2017.02.27/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {..
 44: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1002FE64B3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {10030B7353}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 45: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1002F587F3}> NIL)
 46: ((FLET #:WITHOUT-INTERRUPTS-BODY-1148 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 47: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 48: ((FLET #:WITHOUT-INTERRUPTS-BODY-358 :IN SB-THREAD::CALL-WITH-MUTEX))
 49: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {724DCFB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
 50: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {10030D0003}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {10030CFF6B}> (#<SB-THREAD:THREAD "re..
 51: ("foreign function: call_into_lisp")
 52: ("foreign function: new_thread_trampoline")
 53: ("foreign function: _pthread_body")
 54: ("foreign function: _pthread_body")
 55: ("foreign function: thread_start")

Conditions are not raised upon error

raise-if-error doesn't work as it should.

For example

(pa:host-api-device-index-to-device-index 1 3)

returns -9978 instead of raising a condition.

cl-portaudio fails to load

Fails with

ASDF could not load cl-portaudio because
Component :METABANG-BIND not found, required by #<SYSTEM "ffa">.

Solved with
(ql:quickload :ffa)
It was enough to do it once to make it work perpetually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.