Work easily on a sound file [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'd like to do some tests in C++ with some sound file (16 bit, mono, 44khz)
for (int i = 0; i++, i < lengthofthesoundfile)
{
mysound[i] ...
}
How to convert a WAV file to RAW data only (get rid of the metadatas, etc.) so that I can easily open it in C++ ?
Would someone have a minimal working example of how to load such a file, and then doing a loop on the soundfile's raw data like above?
Thanks in advance!

A .wav file is simply a RIFF file of type WAVE, with (at least) the fmt and data chunks. The fmt chunk contains information about the format of the data chunk, which contains the raw data.
So if you want, you can extract just the data chunk for your usage. The RIFF format is really simple (read the Wikipedia page I linked). You should not have any trouble extracting the data chunk.

Related

How To Read data from Microsoft Excel File by C++ Program [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
now i have some massive data on Excel Sheet, and i need by c++ program to transform this data into text file, to use it later in another thing.
how can i accesses this Excel file, to get data from first attribute and put delimiter and so on??
I have personally used Microsoft Excel Automation to read from Excel in the applications I develop. Please check the link http://www.codeproject.com/Articles/15837/Accessing-Excel-Spreadsheets-via-C for more information on Excel Automation.
But it seems there are other options as discussed in the following links
http://www.codeproject.com/Articles/42504/ExcelFormat-Library
Read cells from Excel in C++?

How can I save a file with many histograms using opencv? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I`m using the OpenCV framework and I need save many histograms in a file to recover it later. Together with the histogram I need save a Id to each one.
What is the best way to do this using the OpenCv with C++?
Thanks,
You can create a format of your own.
Just write functions to read from that format and write to that format.
For example: You have a text file, you saved all the data of histogram in that text file along with ID.
So, you just need a way to read that data from the text file.

Interpret single line basic scripting code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I've a very big file containing the following data structure, it's a very basic scripting language and I can't get to find a way to interpret or get complete structures for it.
Here's what the structure looks like:
# GAME MAP
00-01: Content={3555}
00-00: Content={1000, 1001, 1002 String="Some text.", 1003, 1004}
01-00: Content={1006, 1005 Amount=5}
02-00: Refresh, Content={1001, 1555 Content={1200, 1001 String="Text"}}
The structure is as follows:
BYTE-BYTE: Data, Content={OBJECT DATA}
OBJECT DATA Can contain other OBJECT DATA which is defined with "Content={}" as seen above, any ideas what can I do to interpret this? Doesn't matter the language I just need to see a way for it. (C# or C++ preferably).
Parenthesized (nested) structure need a grammar to be parsed, a regular expression is not sufficient. (Theorically if you know in advance the max depth you could solve your problem with a regex but it would be quite complicated). Antlr or javaCC (Java) allow you to write parser that can do it.

Effective method for reading large CSV files? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I currently have 5 CSV files with about 45,000 records per each file. Whats the best method to go about this? Ive done I/O before, but never on this scale. Parse into a vector string?
Yes, read them into a vector would be reasonable.
The choice of storage does depend a little on what you are planning to do, and what the data is. If you know what the format of the data is, you may want to create a struct, and read the data into a more organised form. E.g. if the file is like this:
name, score, err
Mats, 89, 2.1%
Steve, 79, 8%
then you could have a structure like this:
struct Row
{
string name;
int score;
float err;
}
As comments say, 45K lines is not very much, and it shouldn't cause any major problems unless you are running it on something with the computing capacity of a wrist-watch.
Just keep doing what you are doing: read all lines into a Vector of strings, a Vector of a Vector of strings, or a Vector of objects. We are talking 200 to 500 MB RAM, and nowadays most computers have much more than that available. From a processing time point of view, that's going to be 5 to 10 minutes in an average computer (depending on the amount of processing, of course).
If you run into any problem, ask a new question with more information.

How to read files from a torrent file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to extract information about torrent file like: files names inside it, their sizes ..., is there a C++ library for Linux that help me achieve this easily? or what is the structure of a torrent file and how do I find these information?
You can use the libtorrent library—a feature complete C++ BitTorrent implementation focusing on efficiency and scalability.
If you want to write your own library, there is the official BitTorrent Protocol Specification but it is very poorly written and lacks a lot of details. There is also a much better specification available.