# Generating files with libsndfile

**URL:** <https://www.ruby-forum.com/t/generating-files-with-libsndfile/62128>\
**Category:** Ruby\
**Created:** [May 31, 2006, 7:56pm UTC](https://www.ruby-forum.com/t/generating-files-with-libsndfile/62128 "2006-05-31T19:56:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bc8723/32.png) [@alex789](https://www.ruby-forum.com/u/alex789)\
**Post date:** [May 31, 2006, 7:56pm UTC](https://www.ruby-forum.com/t/generating-files-with-libsndfile/62128/1 "2006-05-31T19:56:12Z")

</div>

I’m trying to generate sound files with the ruby wrapper around  
libsndfile.[1]

I have no problem reading sound files as there are examples for this  
in the documentation. But writing is another matter.

# This script

# require ‘audio’ require ‘audio/sndfile’ sf = Audio::Soundfile.new(“/tmp/anewfile.wav”) silence = Audio::Sound.float(100) sf.write\_float(silence)

Will generate this error when run:

System error.  
(eval):2:in `write\_float’: Format check failed: 0 (RuntimeError)

[1] [ruby-audio](http://hans.fugal.net/src/ruby-audio/doc/)
