• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Playing wave file data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing wave file data


  • Subject: Re: Playing wave file data
  • From: Steve Bird <email@hidden>
  • Date: Wed, 15 Oct 2003 16:07:05 -0400

On Wednesday, October 15, 2003, at 03:44 PM, B&L wrote:

Here is how I interpret the data:

The data is in little endian format, so I read one byte (a) and then the other (b). The b byte is shifted up 8 positions and the a byte is put into the first 8 bytes.

--- You don't mention anything about reading the header. You should read the header to determine whether the WAV file is 8-bit or 16-bit, mono or stereo. That could make a difference in sound quality.


Then I convert it to a signed int with some byte handling remembering that 0x8000 is the same as zero. All below is inverted and then negated. If it is above then it is interpreted as a positive value.
--- Do you know that it's 16 bit sound?
--- I've never seen offset-binary used in a 16-bit WAV file (8-bits sometimes, yes).
--- IIRC, you use 16-bit WAV data as is (without arithmetic)



Since the output should be a float between 1 and -1 I multiply the data with 0.00000000001, anything higher made it sound like my speakers would blow :-)

--- There *-IS-* some math behind this - don't just make up a number. If it's 16-bit sound, it has a range of -32768..+32767. So divide (using floating-point arithmetic) the sound integers by 32767 to get +/- 1.00000.


I can recognize the sound but there is a lot of noise in there also!

--- It's amazing how badly you can mangle the data and still hear what you're expecting (ears and brains are wonderful things - everybody should have some!).

That's symptomatic of high-bit-inversion. In your case, I'd bet on the high-bit being incorrectly inverted.



----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Playing wave file data
      • From: Herbie Robinson <email@hidden>
    • Re: Playing wave file data
      • From: john <email@hidden>
References: 
 >Playing wave file data (From: B&L <email@hidden>)

  • Prev by Date: Re: Signaling the end of audio conversion
  • Next by Date: Re: Signaling the end of audio conversion
  • Previous by thread: Playing wave file data
  • Next by thread: Re: Playing wave file data
  • Index(es):
    • Date
    • Thread