Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
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.
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/).
Related
VERY new to Python. I was programming in RPG and COBOL professionally decades ago so I have a programming background but haven't for years and now learning Python ......
I have two simple CSV files I open and work in. Then I want to combine the results and do more but it doesn't seem to let me.
(1) Currently I have defined a function (PROFDATA) to open first file (simple file of students marks from a professor). I access data and do some calculations and manipulations. Works great!
(2) I next define another function (TADATA) open the second file which has more marks for the students. I access do stuff and when I print, it gives me what I want from that file.
I want to combine my results from both files and then do more things but I don't seem to know best method. I know keeping them as FUNCTIONS means that the variables aren't available elsewhere.
Should I be writing data that I need from each file to a 3rd file?
Not sure of the best approach. Sorry up front as I know this must be a big time beginner question.
Tami
I know few about this and i'm trying to keep building upon it. My goal is to do image stacking with some criteria using C language, as i came upon some cool ideas i think i should be capable of doing with my photos. My C background should be enough to understand what i may need. That being said...
So far i've learned how to read an existing .TIFF file and save it into a char array. The problem is i don't know in which way its data is contained so that i can then be able to analize individual pixels and modify them, or build another .TIFF file from data i previously read.
I've read some things about (a so called) libtiff.h which may be usefull but i can't find where to get it, neither how to install it.
Does anyone know how a .TIFF file data is stored so that i can read it and apply changes to it?
Also,
Does anyone have any experience with handling image files and editing in C? Where did you learn it from?
Do you know of any place i could search for information/tutorials?
Any help will be very usefull,
Thanks in advance.
You can do an enormous amount of very sophisticated processing on TIFFs, or any one of 190+ other formats with ImageMagick without any need to understand TIFF format or write any C. Try searching on Stack Overflow for [imagemagick]
If you want to do processing yourself, consider https://cimg.eu
Another option might be to convert your TIFFs to NetPBM which is much, much simpler to read and write in C. That would be as follows with ImageMagick:
magick INPUT.TIFF -compress none OUTPUT.PPM
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Suppose I'm designing a file manager and want to implement searching of a file by its type hypothetically then which one of these methods will be more efficient -
use the name of the file and trim the extension of each file.
use of specific bytes for the type of file we are searching for example in the case of jpeg images.
bytes 0xFF, 0xD8 indicate start of image
bytes 0xFF, 0xD9 indicate end of image
Since you have to know it's filename before open it, the name trim option will be probably faster. However, you could have false results with that method if an extension does not match with actual file type.
Doing that way will save you some system calls (open, read, maybe fseek, close).
Assuming your goal being: "search a file by its type" without further limitations you have to do it by checking the actual data.
But you might be OK with some false positives and false negatives. If you are searching for image files by looking for extensions only, you can get "image.jpg?width=1024&height=800" instead of "image.jpg" for an image file, a false negative, or "image.jpg" instead of "image.exe", a false positive.
You can, on the other side, check for the first couple of bytes in the file--most schemes for image data have an individual header. This method has much less points of failure. You can get a false positive if you got a chunk of random data with the first bytes resembling the header of an image file. Possible, but highly unlikely. You can get a false negative if the header got stripped (e.g.: on the transport, somehow, or a bad script that produced the file). Also possible and also unlikely, even more so, if not much more.
The small Unix tool file does that and once had an easy to parse text-file you could use for you own project. It's nowadays a large folder with several single files that doesn't even gets installed, only in a precompiled form. You can find the folder with the text-files online, at e.g.: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/file/saucy/files/head:/magic/Magdir/ The format is described in the manpage magic(5) which is also online at e.g.: https://linux.die.net/man/5/magic
This is really an intellectual exercise, since C is my favourite language, and I need more experience hacking things.
I have a program that gets MP3 files as frames. I want to write a single C file with a header file that has functions that I can simply "plug in" at various points in the overall program. A single function call, because the program itself tends to be updated, and I want to be able to take my program from one version of the code to the next, with the minimal amount of hacking time each time.
So, how do I turn MP3 frames into an MP3 file? I am a complete newbie at this.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm looking for recommendations for a good program for 32-bit Windows Vista that will load any arbitrary binary file and display textual information or graphical visualization relevant to identifying what actual data the bits are supposed to represent. Is ther anything better than a hex editor for this kind of thing?
One thing I'd like to do is say, look at the non-visible data in a Spore PNG file to get a clue as to what's actually being stored in there. Right now I'm using WordPad and all I get is something that looks like this:
‰PNG
IHDR ¢
/Qã!$D4"Ž‚îvÚ°‰ÅØà ïjÃÞÉ_{!…‡ú 9¥Ý´îÁ6 ‰ms ^
I guess what I'm looking for is a souped up hex editor that acts more like an Excel for bits so I can slice and dice statistical patterns to get a better idea of what the bits might be doing.
Try HxD:
HxD is a carefully designed and fast
hex editor which, additionally to raw
disk editing and modifying of main
memory (RAM), handles files of any
size.
The easy to use interface offers
features such as searching and
replacing, exporting,
checksums/digests, insertion of byte
patterns, a file shredder,
concatenation or splitting of files,
statistics and much more.
I like xvi32, although it seems similar to the above - I've found it to be fairly fast even for big files.
What you probably want is a hex editor. The PSPad text editor has a pretty good hex-editing mode.
I use HHD's free HexEditor, it's Free!
I use frhed and vim (with its convert to hex mode but that can be slow for big files).
Do you mean something that detects a set of known fileformats and knows how to display them? Otherwise, hex editor (for example PSPad contains one) is the best thing that you can wish for. It's just bits which can mean anything.
I use Total Commander's built-in Lister (file viewer). It can show data as text, hex, it can show images. Then there are many plugins that range from code editors / viewers, image viewers etc.
Plugins I use are
imagine for viewing images
fileinfo for displaying info of executables
HTML viewer
Syn2 - code viewer / editor with syntax highlighting
There are a lot of plugins listed on author's web page, another good source is www.totalcmd.net
I've used Hex Workshop before, it has a "Find Strings" option in the Tools menu. Not free but works great.