Skip to content

Error when executing CAToneFileGenerator #1

Open

Description

@jiaxiongjiao

System: macOS Monterey, Version 12.6
Xcode: Version 14.0.1
Swift: Version 5.7

I built the target CAToneFileGenerator in Xcode, went to the debug directory which contains the executable and typed the following:

./CAToneFileGenerator 440

Got the following:

Generating 440.0 hz tone.
Error 1718449215 creating file.

To get more information, I went to file CAToneFileGenerator.swift and did the following changes:

    guard CommandLine.argc > 0 else {  // Change #1: disabled command-line argument checking
        print("Usage: \(CommandLine.arguments[0]) n")
        print("(where n in tone in Hz)")
        return
    }
    
    let hz = Double("440")             // Change #2: pretend <"440"> is the second command-line argument

In the Xcode command-line output window, the following appeared:

Generating 440.0 hz tone.
2022-10-09 01:24:49.256664-0400 CAToneFileGenerator[37100:7639184]  SetDataFormat failed
Error 1718449215 creating file.
Program ended with exit code: 0

The SetDataFormat failed part is the exact reason why I searched if there is other swift implementation of this part of the book.
I did bit of research before I came across your repository on hacking with swift.
This Stack Overflow answer seems to be talking about something related to this problem but I am too new to even understand anything. Hope this may help to clear the bug.

Thank you for this amazing repository!!! Much love!!!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions