How to create a wave bank file

Donald Smithson 1 Reputation point
2020-12-17T03:20:18.7+00:00

Hello,

I'm working on a project to create a wave bank file.

I have been using a hex editor to create them ,

but it's very time consuming.

I have tried using StreamWriter, but to no avail.

I think I can use BinaryWriter, but I need to

have it search for the word Riff cause it's the

word at the beginning of every pcm .wav file.

Here is a sample binary of a 3 wav bank file:

RIFF,...WAVEfmt { binary

code }

RIFF,...WAVEfmt { binary

code }

RIFF,...WAVEfmt { binary

code }

Any help would be great

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,901 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Donald Smithson 1 Reputation point
    2020-12-17T03:46:34.477+00:00

    I open a wave bank file, reading the xml file connected with the bank file

    Sample XML
    <?xml version="1.0" encoding="iso-8859-1"?>
    <wavebank name="menu_music_wave" dir="data/sound/music/menu_music/" size_before="18639744" size="27268046" compression="28 %" xmlns:xi="x">
    <wave name="menu_music01" file="menu_music01.wav" stream="true" file_priority="low" quality="44100 adpcm" size_before="36286068" size="10205544" compression="28 %" bank="menu_music_wave.bank" offset="0"/>
    <wave name="outro_music01" file="outro_music01.wav" stream="true" file_priority="low" quality="44100 adpcm" size_before="29990778" size="8434200" compression="28 %" bank="menu_music_wave.bank" offset="10205544"/>
    <wave name="menu_music02" file="menu_music02.wav" stream="true" file_priority="low" quality="44100 adpcm" size_before="36286068" size="10205544" compression="28 %" bank="menu_music_wave.bank" offset="18639744"/>
    </wavebank>

    Here is the code I use to read the xml

    if (this.openFileDialog1.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                string fileName = this.openFileDialog1.FileName;
                this.listView1.Items.Clear();
                Directory.SetCurrentDirectory(Path.GetDirectoryName(fileName));
                FileStream fileStream = null;
                try
                {
                    fileStream = File.Open(fileName, FileMode.Open);
                    XmlTextReader xmlTextReader = new XmlTextReader(fileStream);
                    while (xmlTextReader.Read())
                    {
                        if (xmlTextReader.Name == "wave" && xmlTextReader.NodeType == XmlNodeType.Element)
                        {
                            Hashtable hashtable = new Hashtable();
                            _ = xmlTextReader.Name;
                            if (xmlTextReader.HasAttributes)
                            {
                                for (int i = 0; i < xmlTextReader.AttributeCount; ++i)
                                {
                                    xmlTextReader.MoveToAttribute(i);
                                    hashtable.Add(xmlTextReader.Name, xmlTextReader.Value);
                                }
                            }
                            this.listView1.Items.Add(new ListViewItem()
                            {
                                Text = hashtable["file"].ToString(),
                                SubItems = { hashtable["size"].ToString(), hashtable["bank"].ToString(), hashtable["offset"].ToString() },
                                Tag = hashtable
                            });
                        }
                    }
                }
                finally
                {
                    fileStream?.Close();
                }
    

    Now I want to save the *,bank file

    0 comments No comments

  2. Anna Xiu-MSFT 29,516 Reputation points Microsoft Vendor
    2020-12-17T07:44:42.583+00:00

    Hi @Donald Smithson ,

    As issues with tag “vs-general” focus on general questions of Visual Studio, your issue is out of our support scope, I would remove this tag.
    You could report this issue here: Community Forums. Thanks for your understanding.

    Sincerely,
    Anna

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.