IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
.pcm file to .wav format
Cincodekyle
post Mar 5 2010, 06:30
Post #1





Group: Members
Posts: 3
Joined: 4-March 10
Member No.: 78727



I'm working on converting a .pcm file to a .wav file with GoldWave. I'm not sure if any other programs out there support headerless raw file types, but anyway I'm not able to hear a clean version of the file. I tried opening the file as raw, 16-bit sound with a 44.1 kHz sampling rate. All I hear is a high-pitched squeal, similar to the way rewinding an old video tape sounds, so I'm assuming the sampling rate is too high.

Any tips for playing PCM files?

Here's a screenshot:


This post has been edited by Cincodekyle: Mar 5 2010, 06:32
Go to the top of the page
+Quote Post
saratoga
post Mar 5 2010, 07:12
Post #2





Group: Members
Posts: 4967
Joined: 2-September 02
Member No.: 3264



You probably have either the bit depth, sampling rate, stereo or endianness wrong. Try a few other combinations until you get one that sounds like audio.

FWIW I've done this lots of times using SoX to put raw PCM back into a .WAV file.
Go to the top of the page
+Quote Post
.halverhahn
post Mar 5 2010, 10:12
Post #3





Group: Members
Posts: 258
Joined: 4-August 03
Member No.: 8168



Create a frequency spectrogram of your PCM files. If the max. shown frequency is e.g. 11025Hz, load your PCM file with a samplerate of 22050Hz, etc.



--------------------
.halverhahn
Go to the top of the page
+Quote Post
pdq
post Mar 5 2010, 12:32
Post #4





Group: Members
Posts: 3407
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



QUOTE (.halverhahn @ Mar 5 2010, 05:12) *
Create a frequency spectrogram of your PCM files. If the max. shown frequency is e.g. 11025Hz, load your PCM file with a samplerate of 22050Hz, etc.

In order to create a frequency spectrogram of a headerless file, wouldn't you need to know e.g. the sample rate in order to tell that to the software making the spectrogram? Otherwise it will simply have content up to 1/2 the sample rate that you tell it.
Go to the top of the page
+Quote Post
.halverhahn
post Mar 5 2010, 14:24
Post #5





Group: Members
Posts: 258
Joined: 4-August 03
Member No.: 8168



I assumed that 44.1kHz is allready a to high samplerate because it play to fast (mickeymouse style). If you load it at 44.1kHz and you look at the spectrogram you will see no frequencies above a certain point - that's the max. bandwith of the original samplingrate.

If you see no signal above 8kHz, the original samplingrate should be 16kHz. Exept the original has been brickwall filtered, but i don't assume this has been done.
To be sure load the rawPCM with the guessed samplerate and listen to it. If the sound is OK -> be happy.

And to be honest: There are just a few standard samplingrates - one will fit: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 Hz



--------------------
.halverhahn
Go to the top of the page
+Quote Post
[JAZ]
post Mar 5 2010, 21:31
Post #6





Group: Members
Posts: 1783
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



@halverhahn: Sorry, but your logic is erroneous.

Like pdq said, loading in a different sampling rate won't magically maintain the frequency band, but change it aswell. A 440Hz tone sampled at 22Khz is a 880Hz tone if loaded at 44Khz.


@Cincodekyle: Looks like you have the correct endianess, but like Mike said, you should try loading it in mono instead of stereo and/or loading it in 8bits instead of 16bits. If bitdepth is really 16bits, it will sound very distorted in 8bits, so if it sounds okish with 8bits it surely is 8bits.

About stereo or mono, there's no easy way to tell without knowing it, but if it is stereo, it may sound more distorted in mono. (that depends if it is a two channel mono, or stereo with different enough content)

At last, as you should know, reducing the samplerate will help you reduce the speed, but first check if you have the proper bitdepth and channel numbers
Go to the top of the page
+Quote Post
Cincodekyle
post Mar 7 2010, 08:20
Post #7





Group: Members
Posts: 3
Joined: 4-March 10
Member No.: 78727



Thanks for the helpful insight Mike, .halverhahn, pdq and JAZ. I'm experimenting with some of those ideas right now to see if I can get a clearer view of the audio. An 8-bit, unsigned, mono signals sounds the cleared right now I just need to find the right frequency to playback with.
Go to the top of the page
+Quote Post
Cincodekyle
post Mar 11 2010, 08:45
Post #8





Group: Members
Posts: 3
Joined: 4-March 10
Member No.: 78727



To put some finality on this thread, I got the file to play perfectly. As it turns out the parameters for the file in Goldwave were:

File type: Raw (snd, raw)
Signed 16-bit depth
Little endian codec
Stereo reverb

Sampling rate: 4000 Hz

Thank you again for all the helpful tips.
Go to the top of the page
+Quote Post
[JAZ]
post Mar 11 2010, 22:15
Post #9





Group: Members
Posts: 1783
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



4000Hz sounds too low for all known uses. That's a bandwidth of 2Khz. Even voice may sound worse than with a phone.

8000Hz seems more valid.

Try either of these and see which sounds better to you:

mono, 8bit, 16Khz
mono, 16bit, 8Khz
stereo, 8bit, 8Khz
plus your current one.
Go to the top of the page
+Quote Post
db1989
post Mar 11 2010, 23:20
Post #10





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



[JAZ], you yourself pointed out that would only double the audio's speed. The OP says it now sounds perfect, so why would they wish to do that? Unless using mono or 8-bit (but not both) will maintain the speed, but I'd think (admittedly I'm not great at conceptualising) that'd result in noise.
Go to the top of the page
+Quote Post
[JAZ]
post Mar 12 2010, 20:52
Post #11





Group: Members
Posts: 1783
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



I thought the best way to explain it would be with an example:

I've posted in this thread four samples which demonstrate what i mean.
http://www.hydrogenaudio.org/forums/index....showtopic=79384

I started with an original which is 8bit, mono, 16Khz. (What i believe the OP's file is).

I've imported the file with the three alternative settings that we've talked in this thread (the one the OP has found to fit his options, and two more of mine).

All four files seem to play well (at least at the appropiate speed). But it is obvious that the lower the sampling rate, the worse it sounds.


Edit: Now that i have corrected the 8bit file, there is one suggestion about the file being 16bits and not 8 bits. In DOS/Windows at least, 8bit samples were unsigned (i.e. from 0 to 255), while 16bit samples are signed (from -32768 to 32767).

Since the op says that the file he has is signed (as i have assumed in my example), chances are the file is 16bits. So, in conclusion, my second option.

This post has been edited by greynol: Mar 12 2010, 21:38
Reason for edit: Fixed broken link.
Go to the top of the page
+Quote Post
saratoga
post Mar 12 2010, 21:24
Post #12





Group: Members
Posts: 4967
Joined: 2-September 02
Member No.: 3264



QUOTE ([JAZ] @ Mar 12 2010, 14:52) *

I started with an original which is 8bit, mono, 16Khz. (What i believe the OP's file is).

I've imported the file with the three alternative settings that we've talked in this thread (the one the OP has found to fit his options, and two more of mine).

All four files seem to play well (at least at the appropiate speed). But it is obvious that the lower the sampling rate, the worse it sounds.


If you changed the sampling rate and the speed of the file didn't change you probably did something wrong. Perhaps you accidentally resampled?
Go to the top of the page
+Quote Post
[JAZ]
post Mar 12 2010, 21:48
Post #13





Group: Members
Posts: 1783
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



I added the .wav files in the upload forums to clear any confusion. No, i did not resample. The size of each file should be enough to understand that the only difference is the header ( except for the 8bit unsigned file, in which case the bytes are changed from signed to unsigned).

This post has been edited by [JAZ]: Mar 12 2010, 21:49
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th September 2014 - 21:36