Automatically import raw data files?

Help for Audacity on macOS.
Forum rules
ImageThis forum is for Audacity on macOS 10.4 and later.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
cyrano
Posts: 2629
Joined: Fri Apr 17, 2015 11:54 pm
Operating System: macOS 10.13 High Sierra

Re: Automatically import raw data files?

Post by cyrano » Wed Aug 12, 2015 4:24 pm

My only guess here is that it probably is a compressed format since storage is very limited on the ios platform. With high compression and hopefully, lossless. But there's a lot of those around...

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Automatically import raw data files?

Post by Gale Andrews » Wed Aug 12, 2015 4:26 pm

steve wrote:
Gale Andrews wrote:Audacity should decode ATRAC if you add FFmpeg to your computer. Decoding will not work if the file is encrypted (most ATRAC files are encrypted).
There are many variations of ATRAC so I'd not be confident that FFmpeg (using a reverse engineered decoder) will succeed.
According to https://www.ffmpeg.org/general.html ATRAC 1, 3 and 3+ are decodable.
steve wrote:Would FFmpeg be able to correctly identify ATRAC if it is headerless?
I don't think so. You usually have to use -f to tell FFmpeg the input format of raw audio, but there is no way in Audacity to pass that information to FFmpeg.

IMO, Robotman should ask RODE what format the audio is in, and if it is headerless, given using this was their suggestion.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

robotman
Posts: 10
Joined: Tue Aug 11, 2015 7:37 pm
Operating System: Please select

Re: Automatically import raw data files?

Post by robotman » Thu Aug 13, 2015 12:22 am

Just to clarify ... importing as Raw Data does work.

I was asking if there's a way to get Audacity to automatically detect the file as raw data and open it.

Thanks for your suggestions.

cyrano
Posts: 2629
Joined: Fri Apr 17, 2015 11:54 pm
Operating System: macOS 10.13 High Sierra

Re: Automatically import raw data files?

Post by cyrano » Thu Aug 13, 2015 8:31 am

What you're asking is how OSX can detect raw data and send the file to Audacity when you double click it.

This can be done with RCDefaultApp, see:

http://www.rubicode.com/Software/RCDefaultApp/

It's a prefs panel that will load into System Preferences and allows you to set an app for every creator code, every file extension and every file type.

It might not work with raw data if the file extension differs. E.g. you have a file with an extension .1 and .2 and you would need to define each one, as raw dat usually has no creator code.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Automatically import raw data files?

Post by Gale Andrews » Thu Aug 13, 2015 2:01 pm

cyrano wrote:What you're asking is how OSX can detect raw data and send the file to Audacity when you double click it.

This can be done with RCDefaultApp, see:

http://www.rubicode.com/Software/RCDefaultApp/
The OS X built-in method to change default application for a file type should work too.

I don't think that is what Robotman was ultimately asking. He asked:
Robotman wrote:Is there a way to have Audacity automatically recognize and import the files as raw data files so I don't need to choose "Import Raw Data" for each file?
Which I answered:
Gale Andrews wrote:Audacity can't pass a file with .RAW extension directly to the "Import Raw Data" dialogue.
The only way you might get Audacity to open the file automatically is to install FFmpeg and see if it will open the file, just in case the file has headers but Audacity's default PCM decoder cannot understand them.

After installing FFmpeg, open Extended Import Preferences. If your files have .RAW extension, create a rule called

Code: Select all

*.raw
Or create two rules per the extensions you mentioned:

Code: Select all

*.00

Code: Select all

*.01

Then drag "FFmpeg-compatible files" to the top of the importer order, uncheck "Attempt to use... " and OK. There is no way to add the raw importer to the list.

If after double-clicking the file in Finder to open it in Audacity you still see the suggestion to open using Import Raw, that is what you will have to do.

Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

robotman
Posts: 10
Joined: Tue Aug 11, 2015 7:37 pm
Operating System: Please select

Re: Automatically import raw data files?

Post by robotman » Thu Aug 13, 2015 10:05 pm

I already have FFMPEG installed.

I set the OS to open raw files in Audacity and created a new rule for the "*.raw" extension.

Now when I double-click a file in Finder, Audacity opens and thinks for a while. It looks like it tries to open the file with the MP3 or WAV decoder but then gives an error saying it can't recognize the file and try Import Raw Data.

Based on Gale's answer, this means the FFMPEG is not automatically able to open the raw file.

There doesn't appear to be any macro control in Audacity except for Chains, but I don't see an ImportRaw command in Chains which would be the only other way I can think something would work for automating with the built-in features of Audacity.

Can anyone think of a 3rd party utility (or using scripts) that would detect the file extension, open Audacity, and then send keystrokes to go through the Import Raw Data menu? I'm not familiar with what Apple Scripts can do and if they can intercept the system's file association process.

Appreciate everyone's help and any other ideas you may have.

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Automatically import raw data files?

Post by steve » Fri Aug 14, 2015 10:57 am

The main reason that most file types have "headers" is to tell applications about the format so that applications can open the file correctly. For audio files it can be very difficult to work out what the exact format is unless you already know, which is why headers are usually used for public files.

Audacity's "Import Raw" feature attempts to work out what the format is for files that don't have header information - sometimes it gets it right.
Audacity can't pass a file with .RAW extension directly to the "Import Raw Data" dialogue. That would be a feature request.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

cyrano
Posts: 2629
Joined: Fri Apr 17, 2015 11:54 pm
Operating System: macOS 10.13 High Sierra

Re: Automatically import raw data files?

Post by cyrano » Fri Aug 14, 2015 12:43 pm

robotman wrote:Can anyone think of a 3rd party utility (or using scripts) that would detect the file extension, open Audacity, and then send keystrokes to go through the Import Raw Data menu? I'm not familiar with what Apple Scripts can do and if they can intercept the system's file association process.
AppleScript could do it. But Audacity is not scriptable, afaik. Could Automator record it?

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Automatically import raw data files?

Post by Gale Andrews » Fri Aug 14, 2015 1:28 pm

cyrano wrote:AppleScript could do it. But Audacity is not scriptable, afaik.
There is GUI scripting, which has to be enabled in System Preferences.

http://www.macosxautomation.com/applesc ... scripting/
http://www.mactech.com/articles/mactech ... index.html


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Post Reply