Comments (8)
wavplay
uses the AudioToolbox framework on the Mac. I'm not sure what is causing the buzzing sound on your system. Do you still hear the buzzing sound if you install the pulseaudio libraries (and use libpulse-simple.dylib
)? The WAV package will use the pulse library when it is found in the system path. I test the pulse audio path by using brew to install the package (brew install pulseaudio
).
from wav.jl.
closing due to lack of follow up
from wav.jl.
I can definitely reproduce this problem on my MacBook Pro (Retina, 13-inch, Early 2013) with macOS 10.15.6 Catalina, using both Julia 1.4.2 and 1.5.0 and the current main
branch of this package.
The wavplay output has under macOS a clearly audible additional buzz that the same waveform played with afplay
lacks:
using WAV
fs = 48000;
t = 0:1/fs:2;
f = 100 .+ t .* 600;
s = 0.1 * sin.(2π * cumsum(f)/fs);
wavplay(s,fs)
wavwrite(s,"test.wav",Fs=fs)
run(`afplay test.wav`);
Something appears to corrupt the waveform played by the AudioQueue backend. Perhaps some samples being added or dropped at high frequency?
Sadly, Apple's Audio Queue Services online documentation is hardly illuminating. Do you know any better documentation for the API used here?
from wav.jl.
Could you please reopen this issue until it is fixed?
The following patch prevents that enqueueBuffer
duplicates each 512th sample by resubmitting the last sample of each 512-sample block again at the start of the next 512-sample block:
diff --git a/src/wavplay-audioqueue.jl b/src/wavplay-audioqueue.jl
index ded2dff..8188823 100644
--- a/src/wavplay-audioqueue.jl
+++ b/src/wavplay-audioqueue.jl
@@ -199,7 +199,7 @@ function enqueueBuffer(userData, buf)
idx = ntuple(i -> i > 1 ? (1:size(userData.samples, i)) : (userData.offset:end_offset),
ndims(userData.samples))
AudioQueueEnqueueBuffer(userData.aq, buf, getindex(userData.samples, idx...))
- userData.offset = end_offset
+ userData.offset = end_offset + 1
userData.nBuffersEnqueued += 1
return true
end
This off-by-one error explains the buzz reported.
from wav.jl.
Before I prepare a PR, I'm trying to more fully understand wavplay-audioqueue.jl. It looks surprisingly complicated. Where did that originally come from? Why are there Doxygen-style comments? Is there some C or ObjectiveC example code that you used as a template?
from wav.jl.
This code is based on an objective c version that I wrote previously. There is not a lot of documentation online (at least not when wrote this code). I cobbled this together by reading the system headers, which included some documentation.
There is a Core Audio book now, but I wrote this code prior to acquiring a copy. I vaguely remember referencing the author’s blog when I could not piece something together.
https://www.oreilly.com/library/view/learning-core-audio/9780321636973/
Core Audio basically has an audio thread running that this code feeds. The system manages the memory in an opaque manner in the name of efficiency.
from wav.jl.
While my + 1
patch above fixes the problem for mono output (Array{Float64,1}
waveform data), there are still very audible clicks when I try stereo output (2-column Array{Float64,2}
waveform data), e.g. after adding a second channel to the above example with s = [s reverse(s)]
. I've now ordered the book from a local library.
from wav.jl.
Sorry for my disappearance (extremely heavy semester), and thanks for fixing the problem. I was also having issues with #89, but installing 1.0.4 solved both problems.
from wav.jl.
Related Issues (20)
- Caption for WAV display HOT 3
- Extra \0 bytes in RIFF INFO tags causes wav_info_read() to raise ArgumentError HOT 2
- Buggy interaction with Gtk.jl HOT 2
- wavread needs a "float" data type
- WAV.jl not reading wav files with incorrect file size in header HOT 3
- 256x smaller values using "native" format HOT 5
- wavrecord and simultaneous play and record HOT 7
- Support Julia v0.7? HOT 9
- Playing with @async is blocking HOT 7
- wavplay example not working on Linux HOT 16
- wavread with subrange of step >1 gives wrong result HOT 4
- Add some support for reading from pipe HOT 2
- `wavplay(y, fs)` does not work HOT 11
- Chunk padding not recognized HOT 3
- TagBot trigger issue HOT 3
- Slower loading because of GC issue
- Affiliate this package with JuliaAudio HOT 4
- Read operations do not start at the start of the file
- wavread cannot access a sample number 59614786 or higher HOT 2
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 wav.jl.