-1

I want to be able to make my own type of sound file. Actually play a certain strand of sound for a few seconds then continue to the next part ext...

Like..for example, images (if you think of a bitmap) has pixels. Each pixel has a certain color variation identified by a hexadecimal.

If I wanted to draw an image, I would read the image file, find the appropriate id, and display that specific color in that position.

How...how does sound work? Its hz and streaming like a video so would it...would it be identified by playing that specific HZ at a certain degree at that 'moment' and then move to the next one?

I will probably be using C++ or Java to make/play it so any help would be appreciated.

sfxworks
  • 5
  • 2

2 Answers2

2

Uncompressed sound files are typically stored with information which includes sample rate, channel count, and bits per sample (among other things).

Beyond that, they also define a collection of samples. These samples occur at a constant interval (the sampling rate) and represent amplitude in the sample format specified by the file.

You can think of it as being like images of a motion picture with fewer domains and a much higher sampling frequency (equivalent to fps). Each frame represents an amplitude rather than an image.

lisndfile may be a good starting point for understanding how audio files are structured - it supports many formats.

justin
  • 104,054
  • 14
  • 179
  • 226
1

Your question is a bit vague, but I'll explain the basic idea of a format like .wav:

Capture the sound wave at intervals:

enter image description here

Hz is used to determine the size of the interval. If plotted on a graph, it would resemble the sound wave it's producing.

Pubby
  • 51,882
  • 13
  • 139
  • 180
  • Sorry let me make it a bit clearer. What are the methods to talk to the sound card in C or Java and actually PLAY sound? For example...for an image (not literally) it would be display(pixelID:Hexa,x,y,z) and loop through that until all was complete. For sound it would be.....play(....HZid?)... – sfxworks Nov 30 '11 at 22:27
  • @sfxworks OS should provide a function, or you can use a library like OpenAL. – Pubby Nov 30 '11 at 22:29