Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - trajan

Pages: [1]
1
DotNet / Re: How to combine multiple sound buffer in real-time with C#?
« on: October 02, 2012, 02:59:27 pm »
Thank you everyone, following code nicely working -need little corrections-.
string soundLocation = AppDomain.CurrentDomain.BaseDirectory + "notes\\";

int totalAddedLen = 0;
Int16[] newBigMusic = new Int16[10000000];

public Form1()
{
      InitializeComponent();
      LoadAndPlay();
}

private void tryProductBuffer(Int16[] Buff)
{
      Array.Copy(Buff, 0, newBigMusic, totalAddedLen, Buff.Length);
      totalAddedLen = totalAddedLen + Buff.Length;
}

public void LoadAndPlay()
{
      SoundBuffer do_a = new SoundBuffer(soundLocation + "do_a.wav");
      SoundBuffer re = new SoundBuffer(soundLocation + "re.wav");
      SoundBuffer mi = new SoundBuffer(soundLocation + "mi.wav");
      SoundBuffer fa = new SoundBuffer(soundLocation + "fa.wav");
      SoundBuffer sol = new SoundBuffer(soundLocation + "sol.wav");
      SoundBuffer la = new SoundBuffer(soundLocation + "la.wav");
      SoundBuffer si = new SoundBuffer(soundLocation + "si.wav");
      SoundBuffer do_b = new SoundBuffer(soundLocation + "do_b.wav");
           
      /*
            User enter textbox -> do do re re do re mi
            string[0]->
            if(do_a)
            {
                  tryProductBuffer(do_a.Samples);
            }
            if(re)
            {
                  tryProductBuffer(re.Samples);
            }
             ...
      */

     
      Array.Resize(ref newBigMusic, totalAddedLen);
      SoundBuffer AllBuf = new SoundBuffer(newBigMusic, 2, 44100);
      AllBuf.SaveToFile("newBigMusic.wav");
      Sound Q = new Sound(AllBuf);
      // Q.Pitch = 3;
      Q.Play();
}
 

2
DotNet / How to combine multiple sound buffer in real-time with C#?
« on: October 01, 2012, 11:11:23 pm »
Sample project:
User write to music note in textbox and push "Play"...

Process begin:
Parse music note (it does not matter)
e.g.
 re re mi mi do re mi (textbox)

SFML.Audio.SoundBuffer SndBf_re = new SoundBuffer(soundLocation + "re.wav");
SFML.Audio.SoundBuffer SndBf_mi = new SoundBuffer(soundLocation + "mi.wav");
SFML.Audio.SoundBuffer SndBf_do = new SoundBuffer(soundLocation + "do.wav");
 

How to:

SFML.Audio.Sound UserNote = new Sound(SndBf_re+SndBf_re+SndBf_mi+SndBf_mi+SndBf_do+SndBf_re+SndBf_mi);
UserNote.Play();
 

Process ended

sorry my bad English.

Pages: [1]
anything