open audio files

This is a discussion on open audio files within the C Programming forums, part of the General Programming Boards category; Q. How can I open audio files from the program?...

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    1

    Unhappy open audio files

    Q. How can I open audio files from the program?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    The fopen() command does that, e.g.:

    Code:
    FILE *fp;
    
    fp = fopen("myFilename", "rb");
    
    //opens the file myFilename, for reading, in binary mode (instead of text), returning the file's address to the FILE pointer, fp.
    
    if(fp == NULL) { //there was an error, the file didn't open
      printf("\n File open error (myFilename)\n");
       exit(1);      // quit the program
    }
    
    //rest of your code.

  3. #3
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    951
    Check out Wotsit.org for some file format specifications, and say hello to endianness...for instance, .au file data is stored as big-endian, whereas .wav file data is little-endian.

    If you're wanting to play the file, you should search for FMOD, BASS, audiere, OpenAL, some library that plays and manipulates sound files.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  2. Open GL header files
    By Rune Hunter in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2005, 01:10 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. open directory and copy files
    By 5n4k3 in forum C++ Programming
    Replies: 3
    Last Post: 08-06-2003, 09:49 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21