Giter Site home page Giter Site logo

portaudio's Introduction

This repository provides bindings for the portable audio library 'portaudio' for the Racket language. It started life as part of the 'rsound' library.

Install it using

raco pkg install portaudio

portaudio's People

Contributors

gottreu avatar jbclements avatar leifandersen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

portaudio's Issues

ffi-lib can't find callbacks.so on linux

when I try to include portaudio I get this error:


Welcome to Racket v7.7.
> (require portaudio)
; ffi-lib: couldn't open "callbacks.so" (callbacks.so: cannot open shared
;   object file: No such file or directory) [,bt for context]
> ,bt
; ffi-lib: couldn't open "callbacks.so" (callbacks.so: cannot open shared object file: No such file or directory)
;   context...:
;    /usr/share/racket/collects/ffi/unsafe.rkt:131:0: get-ffi-lib
;    "/home/dagon/.racket/7.7/pkgs/portaudio/portaudio/callback-support.rkt": [running body]
;    temp35_0
;    for-loop
;    run-module-instance!
;    for-loop
;    [repeats 1 more time]
;    run-module-instance!
;    perform-require!
;    for-loop
;    eval-one-top
;    /usr/share/racket/pkgs/xrepl-lib/xrepl/xrepl.rkt:1478:0
;    /usr/share/racket/collects/racket/repl.rkt:11:26
> 

I know that callbacks.so exists, I can see it, I just don't know where the ffi wants it.

RSound function breaks its own contract using stream-play/unsafe

This might be a problem with either RSound or Portaudio. The contract on RSound's signal/block-play/unsafe promises that it will treat its first argument, block-filler, as a (-> cpointer? natural? void?) function, but it passes it to Portaudio's stream-play/unsafe, which treats it as a (-> cpointer? int? void?) function.

So, stream-play/unsafe calls it with the int -630867962 where signal/block-play/unsafe promised a natural number.

Is stream-play/unsafe in the wrong here? Is this some kind of overflow, or is it supposed to be able to use negative integers?

.../collects/racket/contract/private/blame.rkt:163:0: signal/block-play/unsafe: broke its own contract
  promised: natural?
  produced: -630867962
  in: the 2nd argument of
      the 1st argument of
      (->
       (-> cpointer? natural? void?)
       nonnegative-real?
       (or/c nonnegative-real? false?)
       (-> nonnegative-real?))
  contract from: 
      <pkgs>/rsound/rsound/rsound-commander.rkt
  blaming: <pkgs>/rsound/rsound/rsound-commander.rkt
   (assuming the contract is correct)
  at: <pkgs>/rsound/rsound/rsound-commander.rkt:46.3

Raco exe does not work.

How to reproduce:
Create a test.rkt with contents

#lang racket
(require portaudio)

(displayln "This will fail")

Run raco exe test.rkt

Try running ./test

Output

collection-file-path: collection not found
  collection: "portaudio/lib"
  in collection directories:
  context...:
   /Applications/Racket v7.7/collects/racket/private/collect.rkt:26:58: fail
   '#%embedded:portaudio/portaudio:: [running body]
   temp35_0
   for-loop
   run-module-instance!
   for-loop
   [repeats 1 more time]
   run-module-instance!
   for-loop
   [repeats 1 more time]
   run-module-instance!
   for-loop
   [repeats 1 more time]
   run-module-instance!
   for-loop
   [repeats 1 more time]

Because of this I am unable to create any executable files that depend on rsound, what could be the issue?

Thanks for the lib!

PS, I had opened an issue in Rsound, this is the root cause. Put it there for others' reference if they face the same issue.

This package does not appear to work on travisci

When I run the following commands:

> (require portaudio)
> (pa-mabybe-initialize)
> (pa-get-device-count)

The library returns that there are 0 devices. (It also complains that it cannot connect to alsa or jack):

...
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM dmix
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started

I should mention that I do have portaudio installed from the repos. Also, a quick google search seems to indicate that other projects are able to test portaudio just fine, which makes me think there is something about this setup that is confusing travis.

Add `cs` directories

The shared objects in the 3m directories only work on the 3M variant of Racket. If you use the CS variant, they won't be found. I got around this using symlinks, but the libraries should be available in either case.

Issues with .dylibs

I'm running racket from macos 12 on an m1 chip,
using (require portaudio) I encountered this:

ffi-lib: could not load foreign library
  path: callbacks.dylib
  system error: dlopen(callbacks.dylib, 0x000A): tried: 'callbacks.dylib' (no such file),
 '/usr/local/lib/callbacks.dylib' (no such file), '/usr/lib/callbacks.dylib' (no such file)...

Also the paths didnt seem to match for portaudio.dylib either, for that one, I recompiled portaudio and linked it.

Update portaudio dylib for os x.

The version of portaudio that this ships is old, and causes an error message like this to be printed:

2018-06-13 11:05:23.781 DrRacket[12511:1288003] 11:05:23.781 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.

It seems like the right thing to do here would be to update the dylib that portaudio ships with for os x.

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.