MIDI file writer or wav or ogg?

Just starting out? Need help? Post your questions and find answers here.
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

MIDI file writer or wav or ogg?

Post by bloiiing »

Hello, is there a library to create midi files, or wav files or ogg files in PB?

Thanks
infratec
Always Here
Always Here
Posts: 7772
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MIDI file writer or wav or ogg?

Post by infratec »

Hi,

To save data as wav file, you have to use an own procedure.
But there are examples available. For example:

viewtopic.php?p=412988#p412988

MIDI Reader:
viewtopic.php?p=408596#p408596
viewtopic.php?p=71613#p71613

Also the file format of MIDI is not very complicated:
https://www.csie.ntu.edu.tw/~r92092/ref/midi/

Btw. you can load midi files directly via LoadMovie() ...
viewtopic.php?p=457492#p457492
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: MIDI file writer or wav or ogg?

Post by bloiiing »

Thank you for the link. I have this error: Structure not found: WAVEFORMATEX while trying to run the program. Perhaps you could say me why this error?

Thank you.
infratec
Always Here
Always Here
Posts: 7772
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MIDI file writer or wav or ogg?

Post by infratec »

About which source code you are writing?
There are so many codes insided the links, it cost me simply to much time to check all of them. :wink:
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: MIDI file writer or wav or ogg?

Post by bloiiing »

infratec wrote:About which source code you are writing?
There are so many codes insided the links, it cost me simply to much time to check all of them. :wink:
I am sorry very much. The source code is the first you have given to me. viewtopic.php?p=412988#p412988

I don't know understand why the structure is not defined in this source... But I have seen the link to the midi file specifications and I think I will use this way.

Thank you very much.
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: MIDI file writer or wav or ogg?

Post by Mijikai »

bloiiing wrote:
infratec wrote:About which source code you are writing?
There are so many codes insided the links, it cost me simply to much time to check all of them. :wink:
I am sorry very much. The source code is the first you have given to me. viewtopic.php?p=412988#p412988

I don't know understand why the structure is not defined in this source... But I have seen the link to the midi file specifications and I think I will use this way.

Thank you very much.
I guess u are using a older version or the demo.

Add this and it should work:

Code: Select all

Structure WAVEFORMATEX
  wFormatTag.u
  nChannels.u
  nSamplesPerSec.l
  nAvgBytesPerSec.l
  nBlockAlign.u
  wBitsPerSample.u
  cbSize.u
EndStructure
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: MIDI file writer or wav or ogg?

Post by bloiiing »

I guess u are using a older version or the demo.

Add this and it should work:

Code: Select all

Structure WAVEFORMATEX
  wFormatTag.u
  nChannels.u
  nSamplesPerSec.l
  nAvgBytesPerSec.l
  nBlockAlign.u
  wBitsPerSample.u
  cbSize.u
EndStructure
[/quote]

Thank you for the structure. But where can I find the new version of this demo? I am asking that because I have a new error: Constant not found: #WAVE_FORMAT_PCM. I am afraid to boring you with my questions...

Thank you.
User avatar
NicTheQuick
Addict
Addict
Posts: 1549
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: MIDI file writer or wav or ogg?

Post by NicTheQuick »

He guesses you are using the demo version of Purebasic. The demo version does not include any structures or constants from the Windows API. That the reason why the structur and constant can not be found.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: MIDI file writer or wav or ogg?

Post by bloiiing »

NicTheQuick wrote:He guesses you are using the demo version of Purebasic. The demo version does not include any structures or constants from the Windows API. That the reason why the structur and constant can not be found.
Are you sure? Because I use the version that I have downloaded from my user account. I registered PB few years ago. And It works with others programs. But I have forgotten to say you that I am under Linux. I am going to try under windows and I will come back to let you know if it works.

Thank you.
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: MIDI file writer or wav or ogg?

Post by bloiiing »

bloiiing wrote:
NicTheQuick wrote:He guesses you are using the demo version of Purebasic. The demo version does not include any structures or constants from the Windows API. That the reason why the structur and constant can not be found.
Are you sure? Because I use the version that I have downloaded from my user account. I registered PB few years ago. And It works with others programs. But I have forgotten to say you that I am under Linux. I am going to try under windows and I will come back to let you know if it works.

Thank you.
I have just verified and it is the reason. It works fine on windows without changes. I had not seem there where windows constants.

Sorry an thanks you for your help.
Post Reply