V module exposing the excellent miniaudio C audio library.
Current version of miniaudio is v0.11.9 (4d813cf)
The wrapper is mostly auto generated.
VVrap of the excellent miniaudio C audio library
License: MIT License
V module exposing the excellent miniaudio C audio library.
Current version of miniaudio is v0.11.9 (4d813cf)
The wrapper is mostly auto generated.
Hello.
Could you please tell, if it is possible to record from microphone and play to speakers simultaneously?
if yes, could you give me a hint?
Thanks.
Thanks a lot for the module @Larpon!
At some point in the recent past It must have broken.
E.g., I was using it in an app. Now I can't successfully compile it anymore due to an error from miniaudio.
Trying to compile it results in:
/opt/hostedtoolcache/v/0.4.2/x64/vlib/sync/sync_default.c.v:52:8: error: struct `C.pthread_mutex_t` was declared as private to module `miniaudio`, so it can not be used inside module `sync`
50 | [heap]
51 | pub struct Mutex {
52 | mutex C.pthread_mutex_t
| ~~~~~~~~~~~~~~~~~
53 | }
54 |
Error: Process completed with exit code 1.
Ref.: https://github.com/ttytm/emoji-mart-desktop/actions/runs/6599637443/job/17928908286
Looks like the C struct clashes with the struct in sync, though I'm not actively importing or using sync in the app.
import miniaudio
sound_source_channel_count
with u32import miniaudio
miniaudio/miniaudio.auto.c.v:10405:40: error: overflow in implicit type `int`, use explicit type casting instead
10403 | }
10404 |
10405 | pub const sound_source_channel_count = 0xFFFFFFFF
| ~~~~~~~~~~
10406 |
10407 | [typedef]
Hey there,
the wrapper works just fine, but the module adds A LOT (like, 5-10 seconds) to compile time (Windows, tried gcc because tcc didn't work). Do you think this might be resolved in any way or is it just miniaudio being huge?
% v install v-miniaudio
failed cmd: "/Users/brandon/v/v" -skip-unused "/Users/brandon/v/cmd/tools/vpm.v"
failed code: 1
==================
^~~~~~~
/tmp/v/vpm.13283713496981284215.tmp.c:12884:3: error: implicit declaration of function 'OPENSSL_init_ssl' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, 0);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12884:3: note: did you mean 'OPENSSL_init'?
/opt/local/include/openssl/crypto.h:600:6: note: 'OPENSSL_init' declared here
void OPENSSL_init(void);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12884:20: error: use of undeclared identifier
'OPENSSL_INIT_LOAD_SSL_STRINGS'
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, 0);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12985:4: warning: expression result unused [-Wunused-value]
...
==================
(Use v -cg to print the entire error message)
`builder error:` `==================` `C error. This should never happen.`
This is a compiler bug, please report it using v bug file.v.
I just came to work with it since the recent fixes. Thank for addressing the issue.
Unfortunately, it is not yet possible to use it on Windows again.
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3037:9: error: unknown type name 'pthread_mutex_t'
3037 | typedef pthread_mutex_t C__ma_pthread_mutex_t;
| ^~~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3038:9: error: unknown type name 'pthread_cond_t'
3038 | typedef pthread_cond_t C__ma_pthread_cond_t;
| ^~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3039:9: error: unknown type name 'pthread_mutex_t'
3039 | typedef pthread_mutex_t C__ma_mutex;
| ^~~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c: In function 'miniaudio__version_string':
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:68729:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
...
==================
(Use `v -cg` to print the entire error message)
builder error:
==================
C error. This should never happen.
Hey, it's me, XenialDan from Discord.
i tried my example code under linux, and it crashes via segmentation fault
code: https://github.com/thebigsmileXD/v-pong/blob/master/sound.v
warning: miniaudio/miniaudio.v:53:15: `frames_read` declared and not used
Loading wav
[miniaudio] Endian: LE
[miniaudio] SSE2: YES
[miniaudio] AVX2: NO
[miniaudio] AVX512F: NO
[miniaudio] NEON: NO
[PulseAudio] Playback attr: maxlength=5280, tlength=1760, prebuf=-1, minreq=-1, fragsize=1760; internalBufferSizeInFrames=1320
[PulseAudio] Playback actual attr: maxlength=5280, tlength=1760, prebuf=1324, minreq=440, fragsize=1760; internalBufferSizeInFrames=1320
[PulseAudio]
Built-in Audio Analog Stereo (Playback)
Format: 16-bit Signed Integer -> 16-bit Signed Integer
Channels: 2 -> 2
Sample Rate: 44100 -> 44100
Buffer Size: 1320/3 (440)
Conversion:
Pre Format Conversion: NO
Post Format Conversion: NO
Channel Routing: NO
SRC: NO
Channel Routing at Start: NO
Passthrough: YES
Playing wav 0
Seeking frame 0
Segmentation fault
What is weird is that the length seems to be 0 on linux. On windows it is the actual length.
On windows the program silently exits, which is also a segfault i guess:
C compiler=gcc
warning: miniaudio\miniaudio.v:53:15: `frames_read` declared and not used
Loading wav
Playing wav 1593
Seeking frame 0
Hello
Compiling using the normal miniaudio
module works fine, but once add import miniaudio.x
, it errors on compile.
Because the error is so big, I have uploaded it onto pastebin instead.
https://pastebin.com/USqTrcP1
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.