Opening and Saving files
Prev
Next

Opening and Saving files

Opening files with Kwave works like in most other applications, you can

Supported File formats

Kwave supports the following file formats:

  • The favourite file format of Kwave is (like you can guess from the name) .wav. This format is very common to other "operating systems" and also is commonly used within the KDE environment.

  • The second format that Kwave supports is "ASCII". You can export to ASCII, but currently not import from it (this is currently not implemented). Please be aware that storing in this format might produce very large files! The file format will be described below.

  • .mp3 and .mp2 import is available through libmad for the MP3 decoding in combination with id3lib for decoding ID3 tags.

  • Ogg/Vorbis (*.ogg) import and export. See http://www.xiph.org for details.

  • Additionally Kwave supports many other common formats through the audiofile plugin. You can import files like *.au and *.snd (NeXT,Sun Audio), *.aiff (Audio Interchange Format) and *.sf (Berkeley,IRCAM,Carl Sound Format).

Converting to and from .wav

The best way to work with formats other than those supported by Kwave is to use an external converter program. A good set of tools for this is in the SoX package, they have also some nice documentation! (The original homepage is located at http://www.spies.com/Sox/.)

The plans for future include support for import and also export filters for more formats and maybe some filter that uses a user-defineable script with a call to an external filter, so that even formats not supported by SoX (like MP3) can be read and/or written.

Format of ASCII files

The ASCII format is quite useful for scientific and educational purposes. Due to it's simple format, you can either write simple files on your own with a text editor or you can use the output of an other application and convert it into ASCII. As the format is really simple, you should not have big problems in writing a converter and most scientific applications use to have some kind of their own ASCII format for export.

The format of an ASCII file is quite simple and has the following rules:

  1. At the start of the file comes a block of properties, with one property per line.

  2. Each property line starts with ##.

  3. After the properties comes a list of samples, with one sample per line. When using multiple channels, the samples are separated by commas.

  4. Lines might end with a carriage return and/or a line feed character (so DOS files are supported too). But when saving, files will always be saved with line feed character as the end of the line.

  5. Empty lines and characters after a # are treated as comments and are ignored.

  6. Values can be are given in any format that the C library of your system is able to read and interprete as a floating point or integer number. But when saving, Kwave will save as in signed integer format with a 24 bit range.

  7. All values are expected to be in signed format. So if you import a file with only positive values, you will only see samples that are above the zero line.

  8. When importing, values can be specified in any range, Kwave always does a first pass over the file to get the highest absolute value and defines that value as "100%" before really reading in the file and scaling it.

  9. Internally all values are stored with 24 bit precision (signed).

Here is an example of a simple ASCII file that represents a sine wave with eleven samples:

Example 4.1. content of an ASCII file with a single sine wave

## 'rate'=44100
## 'tracks'=2
## 'bits'=16
## 'length'=11
## 'Date'='2007-04-22'
## 'Software'='Kwave-0.7.9 for KDE 3.5.5'
  5930496,   5930496 #            0
        0,   8388352 #            1
 -5930752,   5930496 #            2
 -8388608,         0 #            3
 -5930752,  -5930752 #            4
        0,  -8388608 #            5
  5930496,  -5930752 #            6
  8388352,         0 #            7
  5930496,   5930496 #            8
        0,   8388352 #            9
 -5930752,   5930496 #           10
# EOF
		

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team