Comments (4)
Hi little-dandan,
I checked the OSStatus, -50
. It's an audio parameter error.
See on OSStatus.com.
-
Would you like to share your testing conditions when you run this demo code? I am also curious about when this error raises.
-
Do you mean to check the OSStatus,
-50
and log the error in the code ?
from learning-core-audio-swift-samplecode.
Thank you for your answer:
as i run your demo, the acquired audio file can not play. its duration is 00:00, you can try it (CH06_AudioConverter).
My Xcode version is: Version 11.3.1(11C504)
Thank you
from learning-core-audio-swift-samplecode.
The issue came from using the latest API AudioFileReadPacketData
. In the original sample code which was written in C language, it used the old API AudioFileReadPackets
which is fine to use zero value of outNumBytes
. But, int the new API AudioFileReadPacketData
, it is no longer using outNumBytes
and uses ioNumBytes
instead. That means we need to specified the correct size of out buffer in bytes.
New Implementation like below
var outByteCount: UInt32 = ioDataPacketCount.pointee * UInt32(audioConverterSettings.inputFilePacketMaxSize)
audioConverterSettings.sourceBuffer = calloc(1, Int(outByteCount))
var result = AudioFileReadPacketData(audioConverterSettings.inputFile!,
true,
&outByteCount,
audioConverterSettings.inputFilePacketDescriptions,
Int64(audioConverterSettings.inputFilePacketIndex),
ioDataPacketCount,
audioConverterSettings.sourceBuffer)
Please check the commit f5b4591
Thanks for @little-dandan to help correct this error.
from learning-core-audio-swift-samplecode.
Thank you:
But there are new problems. output file duration is very short.
You can open the compressed audio file, the sound content will play very fast, completely can not hear the content.
from learning-core-audio-swift-samplecode.
Related Issues (4)
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 learning-core-audio-swift-samplecode.