import .wav file as raw

Help for Audacity on GNU/Linux.
Forum rules
ImageThis forum is for Audacity on GNU/Linux.
Please state:
  • which version of Linux you are using,
  • the exact three-section version number of Audacity from Help menu > About Audacity,
  • whether you installed your distribution's release, PPA version, or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade (see 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.
Post Reply
Dan_Cox
Posts: 4
Joined: Wed May 30, 2018 7:58 pm
Operating System: OS X 10.9 Mavericks

import .wav file as raw

Post by Dan_Cox » Wed May 30, 2018 8:46 pm

I use ubuntu 16.04 and Audacity 2.1.2 I try to import a .wav file from a professional audio recorder because it is damaged. However, I cannot import even an undamaged file. There is only noise. Mediainfo says it has 2.304kbps, 48kHz, 24bits, 2channels, PCM(little/signed). So I set 24bit signed, little endian, Stereo and so on. I only hear noise. What is wrong?

kozikowski
Forum Staff
Posts: 68938
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: import .wav file as raw

Post by kozikowski » Wed May 30, 2018 9:09 pm

What was the recording and how was it damaged?

Koz

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

Re: import .wav file as raw

Post by steve » Wed May 30, 2018 10:20 pm

Dan_Cox wrote:What is wrong?
Import RAW does not work for 24-bit files (it's a bug).
I'll log it on the bug tracker.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: import .wav file as raw

Post by steve » Wed May 30, 2018 11:34 pm

steve wrote:Import RAW does not work for 24-bit files (it's a bug).
Cancel that. Looking closer, it's not a bug.

The problem is that the file you are working with is not a true RAW file.

A standard Microsoft PCM WAV files has 44 bytes "header" before the start of the data.
Each sample of a 24-bit PCM file is 3 bytes.
If you don't discard the header, then it is read as 14 samples + 2 bytes, and those 2 bytes push the rest of the data out of order. Where Audacity is expecting to get a 3 byte number for each sample, it is getting 2 bytes that belong to one sample, and one byte that belongs to the next sample.

To read 24-bit PCM correctly, it is essential that a correct offset is given (or at least, an offset that puts the first byte of each sample as the first in each group of 3 bytes).

Try importing with an offset of 44 bytes.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: import .wav file as raw

Post by steve » Wed May 30, 2018 11:41 pm

steve wrote:A standard Microsoft PCM WAV files has 44 bytes "header" before the start of the data.
Note that not all WAV files have standard Microsoft PCM WAV headers. It's not uncommon for valid WAV files to have headers larger than 44 bytes, so you may need to experiment, (or use a Hex Editor to examine how big the header actually is).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: import .wav file as raw

Post by steve » Wed May 30, 2018 11:44 pm

steve wrote:(or use a Hex Editor to examine how big the header actually is).
Some information about that: https://stackoverflow.com/questions/199 ... yte-header
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: import .wav file as raw

Post by steve » Wed May 30, 2018 11:47 pm

and the Microsoft RIFF format specification here: http://soundfile.sapp.org/doc/WaveFormat/
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Dan_Cox
Posts: 4
Joined: Wed May 30, 2018 7:58 pm
Operating System: OS X 10.9 Mavericks

Re: import .wav file as raw

Post by Dan_Cox » Thu May 31, 2018 7:25 pm

Thank you all. It works with an offset of 4 or 10 or 16 and so on. The other row with 1 or 7 or 13 and so on channels are changed.

Post Reply