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
Racket Bindings for PortAudio
License: Other
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
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.
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
018e7c9 changed the version number in toplevel info.rkt, but in order to get rsound working I also needed to change portaudio/info.rkt
Should there really be two separate version numbers or info files to maintain anyway?
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.
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.
I have been looking for a way to get an audio stream into racket. Portaudio seems to be able to do that:
http://files.portaudio.com/docs/v19-doxydocs/open_default_stream.html
However, the bindings don't seem to allow anything like this. Is this still in the works?
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.