Comments (3)
From libsndfile's FAQ it appears that it doesn't actually do any interleaving/deinterleaving automatically. So my guess is that the problem has to do with the implementation of Base.read
for AudioFile
s. This currently returns arr[1:nread]
. Now for stereo files this is a 2 x n_frames array. Since Julia reads through arrays in column-major order, every sample from the stereo file is 'repeated', which results in stereo files playing back at half speed (or something along those lines).
Returning arr[:, 1:nread]
instead should solve this. I have implemented this in #20. I've tested a stereo file and it was mixed down properly into a single channel playing at regular speed. Since playing files was broken for me I wasn't able to check the behavior you describe here.
A point for discussion is given that Julia uses column-major order, should AudioIO perhaps use this to its advantage by representing audio data in n_frames x n_channels arrays instead of in n_channel x n_frames. The upside is that this would (theoretically) improve performance when working in Julia. The downside being that the latter is the convention for most C libraries AudioIO interfaces with, so any function interfacing with those should take care of proper conversion.
from audioio.jl.
Looking a bit more into the code. I think most of AudioIO already expects audio data to be in this format when dealing with stereo audio. So I've added a commit to #20 that makes sure audio data is read from a file as n_frames x n_channels.
from audioio.jl.
#20 fixes this, thanks!
from audioio.jl.
Related Issues (20)
- WARNING: libportaudio: Input overflowed HOT 4
- AudioIO should have a `versioninfo` method
- [PkgEval] AudioIO may have a testing issue on Julia 0.3 (2014-10-17) HOT 4
- Playing a file with a sample rate != 44100 does not work
- Use Wav.jl for opening .wav files HOT 4
- support writemime
- Support auto samplerate conversion
- design contract for buffers of AudioNode HOT 2
- Warning: libportaudio: Input overflowed HOT 7
- The play()-function is broken HOT 2
- SinOsc should take an initial phase HOT 2
- AudioIO uses deprecated Dict syntax
- Close audio stream when nothing is playing HOT 1
- Hook into FileIO `load` `save` mechanism
- Real Time audio recording examples missing HOT 5
- Coordinate various audio and DSP packages HOT 10
- PaStream as Ptr{Void} loses information about the data stream HOT 1
- Make Error in Fedora 23 HOT 1
- not working in Julia version 0.5.0-rc3+0 HOT 2
- Info about upcoming removal of packages in the General registry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audioio.jl.