P
P
PeroPero2017-01-27 20:52:56
Mathematics
PeroPero, 2017-01-27 20:52:56

How to display the sound in the form of a C ++ openGl graph and a question on ifstream?

Well, I'm reading a wav file, drawing a broken line using openGl, it turns out somehow wrong =)
audiocoding.ru/article/2008/05/22/wav-file-structu... in the wav format documentation, reading starts from 44 bytes . And here at once a question I read a file means ifstream.

ifstream in;
in.open("F:\\sounds\\114835.wav", ios::binary); //открываю файл
in.seekg ( 44, ios::beg); //переход на 44 байт 
unsigned short int ss; //переменная размером в 2 байта 
in.read(reinterpret_cast<char *>(&ss), sizeof(ss)) //читаю по 2 байта сразу

So I can't understand for reading I need
in.seekg ( 44, ios::beg);//перейти на 44 байт ?
in.seekg ( 43, ios::beg);//или на 43 байт ?
in.read(reinterpret_cast<char *>(&ss), sizeof(ss))//он читает 44 байт включительно или нет ?

in the case of 16 bit audio digitization,
this output is obtained by switching to 44 bytes.
jdDoWtAsy80.jpg
I draw this output when switching to 43 bytes
oKtu05Ct00M.jpg
using openGl GL_LINE_STRIP. Where Y= what I read from the file, and X = i++ from the loop.
The task is to draw a conclusion as in the picture
VfJ5yoAhPHQ.jpg
Questions that interest me
1) How to read a file from 44 bytes or from 43?
2) How is the conclusion made as in the picture? As I understand it, for this they process the sound with some kind of filter where you can read about it, well, or how to google it? For almost all questions related to sound, Google offers to download the player =(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PeroPero, 2017-01-27
@PeroPero

I will not edit the question, but here is my jamb

unsigned short int //я использовал 
short int //а надо было это

Math part of data typing I should repeat it and memorize it =)
This hour I'll see what happens in the end =) But the question is still open
1) How to read a file from 44 bytes or from 43?
2) I will reformulate. What are the concepts when working with sound. That is, a sample, GC, digitization, this is understandable, but what else is used (I don’t know how to express my idea correctly). In general, where can I read about the mat part of the sound and filters?
He asked himself answered =) I apologize for this question can be deleted!
XQLX0X9nFNw.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question