Safiy Zaghbane Safiy Zaghbane - 19 days ago 6
C Question

I need help creating my first project

I've been learning C for the past 4 months and I thought of giving my self a little challenge to motivate my self, so now i'm looking forward to do a little project on how to manipulate wave format files, but i have few little problems before i start doing this project.

First the program which i will create is simple application that allows the user to open his wave file, do few tricks that are listed in a menu like cutting, reversing, resizing and save his file at the end.

the menu will be lunched this way :


File


  • Open : asks the user to open a file, if there is one already ope, it suggest to save it.

  • Save as : Saving the file with a name given by the user (if the user doesn't give any name, a default name will be used) and giving
    the user the ability to save his file in one of the formats


    • WAVE 8 bits Mono 11.025 kHz

    • WAVE 16 bits Stereo 44,1 kHz

    • WAVE 24 bits 5.1 192 kHz

    • MIDI .. ect


  • Info : shows the information about the audio file (name of the file, type of the file, length of the file in hh:mm:ss)

  • Exit : exiting the application ; if the file wasn't saved, the application suggest to save it.



Editing


  • Reverse : reversing the audio file.

  • Cut : cutting the audio file at a chosen moment as a start point and an end moment as a end point.

  • Resize : making the audio file play faster or slower (for example, play 2 times faster or slower)

  • … ect




1 - I want to create a library like "menu_f.h" that contain the menus functions, making a new menu, adding a function or a sub-menu and include it later in my program, but i have no idea what should i write inside the code file of menu_f.h so i can be able to include it later on into the main program.

2 - I want learn how to create a make file because i don't want the user to link the libraries or anything complicated, i just want him to make the program and run it, or if its possible, run it directly

3 - If you have in mind any other idea of functions that would do some cool stuffs, I'll be glad to hear them.

Answer

Ask yourself, what do you want more out of this? Practice with C? or a way to modify .wav files? If you want C practice, by all means continue on, but I think if you're really looking for a way to modify a .wav file you'll be able to find plenty of solutions in higher level languages.

1) Its as simple as making your header file ( menu_f.h) and associated c file (menu_f.c). Follow a tutorial to find out what kind of code goes in what file ie: https://www.tutorialspoint.com/cprogramming/c_header_files.htm

2) Google some about make first, then check out the tool "automake". Again, make sure you're honest with yourself about what you're trying to accomplish. (You're getting practice in C, most likely there is better software already out there).

3) It might be interesting to try do perform a FFT (Fast Fourier Transform) of the .wav file. The math is pretty hardcore, but the concept is understandable, and you can borrow code from a library that already implements it (https://sourceforge.net/projects/kissfft/).