Page 2 of 2

Re: Importing non audio files as raw data

Posted: Thu Oct 25, 2012 2:11 am
by rlaliberty
Wouldn't that mean the each channel was playing something different?

Re: Importing non audio files as raw data

Posted: Thu Oct 25, 2012 2:21 am
by rlaliberty
Right. That was a stupid question. So is this more correct?
So, when we import NTOSKRNL.exe as a sound file into Audacity, we are interpreting the binary code that it contains as if we were interpreting any other audio file. For example, say we cull these two arbitrary bytes/16 bits from the file: 0101 0100 and 1101 1000 (Hex: 54 E8). The order of which these bytes are read depends on the endianness. If we chose “little endian” then the least-significant byte is read first. Thus, we would have “54E8,” or in decimal, 21,736. If our bit depth is 16, we have 65,536 possible amplitude levels of the sound. However, since we imported the file as 2 channel stereo, this number is halved: thus, we have 32,768. Based on the 16 bit PCM encoding, the amplitude of the given sample is then approximately 65,536/32,768 or + .66333. This process repeats based on the sample rate, in our case, 44,100 times a second, until the file is totally read and rendered as an analog wave. Since we imported the file as 2 channel stereo, PCM encoding dictates that the channels are interleaved, meaning that sample 1 goes to the left channel, sample 2 to the right, sample 3 to the left, and so on. Frequency/pitch is a product of wavelength/time, and if we know the amplitude at any given time, we also know the distance from one crest to another and thus the frequency of a given sample.

Re: Importing non audio files as raw data

Posted: Thu Oct 25, 2012 2:56 am
by steve
rlaliberty wrote: If our bit depth is 16, we have 65,536 possible amplitude levels of the sound. However, since we imported the file as 2 channel stereo, this number is halved:
No it is not halved. If the bit depth is 16 then there are 65,536 possible amplitude levels for each and every sample.
16 bit audio usually uses signed notation so there are 32,768 values below zero and 32,767 values above zero. (see: http://en.wikipedia.org/wiki/Two%27s_complement)
rlaliberty wrote:Wouldn't that mean the each channel was playing something different?
Yes. That's the whole point of stereo. http://en.wikipedia.org/wiki/Stereo

This article provides a lot of information: http://en.wikipedia.org/wiki/Audio_bit_depth

Re: Importing non audio files as raw data

Posted: Fri Oct 26, 2012 12:37 am
by rlaliberty
You're a saint, Steve. I'd buy you a beer if I could. Thanks!

Re: Importing non audio files as raw data

Posted: Fri Oct 26, 2012 1:49 am
by steve
rlaliberty wrote: I'd buy you a beer if I could.
We're probably several time zones apart, but next time you're having a beer, raise your glass... cheers ;)

Re: Importing non audio files as raw data

Posted: Sat Feb 15, 2014 7:01 pm
by cloud_canvas
One more quick question about this to amend something to the current definition.

Is the header included in the rendering process as well? As in, the header is rendered as 16-bit samples at the beginning of the audio file as well?

Re: Importing non audio files as raw data

Posted: Sun Feb 16, 2014 3:20 pm
by Gale Andrews
cloud_canvas wrote:Is the header included in the rendering process as well? As in, the header is rendered as 16-bit samples at the beginning of the audio file as well?
Any header in an audio file is rendered and will be heard as an audible click.


Gale

Re: Importing non audio files as raw data

Posted: Fri Mar 07, 2014 2:06 am
by ggreene
So I just posted my first post and thought "Hey I'll read through the forum a little" and saw this one.

Then it dawned on me to have Audacity import the Audacity executable.

Its mostly noise as you'd expect, but there are some sections that work out to be "tonal"(?) I guess for lack of a better word.

I did...
File->Import->Raw Data
[select Audacity executable]
Select
"Signed 16 bit PCM"
"Little endian"
[leave others default]
Click "Import"

You can see some of the stuff I'm talking about starting around the 41 second mark.

Anyway... that was fun.