julienaubert / nim-sndfile Goto Github PK
View Code? Open in Web Editor NEWWrapper of libsndfile for nimrod
Wrapper of libsndfile for nimrod
Hi there,
I'm running a fork of your bindings with this code:
import sfi
import os
var frames = 34
var sndfile: ptr TSNDFILE
var info: TINFO
info.channels = 1
info.frames = int64(frames)
info.samplerate = cint(44100)
info.format = cint(65542)
info.seekable = cint(1)
info.sections = cint(1)
sndfile = sfi.open(
paramStr(1).expandTilde(),
sfi.WRITE,
cast[ptr TINFO](info.addr)
)
var samples = cast[ptr UncheckedArray[cfloat]](alloc0(sizeof(cfloat) * frames))
for i in 0..frames-1:
samples[i] = cfloat(i)
echo format_check(cast[ptr TINFO](info.addr))
var num_items = cast[int64](info.channels * info.frames)
echo sfi.writef_float(sndfile, samples[0].addr, num_items)
discard sfi.close(sndfile)
dealloc(samples)
but it always returns 0 items written.
In my bindings I simply added the write functions which are almost identical to the read functions.
Any ideas on how I can make this work because right now it doesn't crash but the file is always empty after the program is complete.
First of all, thanks for this small wrapper. I noticed that the PR for writing files #7 has not been merged, or any other activity for that matter, in over a year. Currently, I'm using the PR without issues, but it would be great if I could just install it via nimble. Will there be any further updates?
@jamesb93: If there is no more development here, would you be okay if someone changed the URL in the nimble directory to your fork? Are you still using this? Or should I fork your fork, in case people want support?
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.