Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6848219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:50:28+00:00 2026-05-27T00:50:28+00:00

I am having an awful time trying to come up with a good solution

  • 0

I am having an awful time trying to come up with a good solution to this problem of mine.

I have 3 sound effects that are marked as content on the phone, all the same bitrate.

  • sound1.wav
  • sound2.wav
  • sound3.wav

I want the user to be able to be able to select in any order, or however many times they like, the play order of the wav files, and then generate a new wav file based on their choices which can be stored and brought back from isolated storage.

So Thank You Walt Ritscher with the help so far, but as you will eventually see my coding skills are fragmented at best. What I’m trying to convey in the following code is that a user will be prompted to select any/all of the sounds with a tap event, and his selections will determine what the new soundeffect will sound like (it’s order, etc) However there is still a lot I don’t know about and here is the code I came up with (while not on my coding computer);

//SO I have this master list of sounds to use, indicated in this block of code:
//sound1.wav, sound2.wav, sound3.wav
// my wav files are marked as resources
// get the wav file from the DLL
var streamInfo1 = Application.GetResourceStream(
    new Uri(sound1.wav, UriKind.Relative));
var streamInfo2 = Application.GetResourceStream(
    new Uri(sound2.wav, UriKind.Relative));
var streamInfo3 = Application.GetResourceStream(
    new Uri(sound3.wav, UriKind.Relative));

//With the above declarations made, I run each one as a stream as a variable.
var stream1 = streamInfo1.Stream as UnmanagedMemoryStream;
var stream2 = streamInfo2.Stream as UnmanagedMemoryStream;
var stream3 = streamInfo3.Stream as UnmanagedMemoryStream;



//The user can choose the sounds in any order, and repeat if desired.
//Let us assume the user chose in this order:
//sound1.wav + sound1.wav + sound2.wav +sound3.wav


for (int i = 0; i < 10; i++)
{
  var bytesA = new byte[stream1.Length];
  var bytesB = new byte[stream1.Length];
  var bytesC = new byte[stream2.Length];
}

// read the bytes from the stream into the array
stream1.Read(bytesA, 0, (int)stream1.Length);
stream2.Read(bytesB, 0, (int)stream1.Length);
stream3.Read(bytesC, 0, (int)stream2.Length);

var combined = new byte[bytesA.Length + bytesA.Length + bytesB.Length] + bytesC.Length]];

// copy the bytes into the combined array
System.Buffer.BlockCopy(bytesA, 0, combined, 0, bytesA.Length);
System.Buffer.BlockCopy(bytesB, 0, combined, bytesA.Length, bytesB.Length);

var outputStream = new MemoryStream();
outputStream.Write(combined, 0, combined.Length);

// substitute your own sample rate
var effect = new SoundEffect(
      buffer: outputStream.ToArray(),
      sampleRate: 48000,
      channels: AudioChannels.Mono);
var instance = effect.CreateInstance();
instance.Play();

// save stream to IsolatedStorage
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:50:29+00:00Added an answer on May 27, 2026 at 12:50 am

    Basically you have to get the bytes from the stream and combine into a new byte array. Then store that array into an UnmanagedMemoryStream.

       // my wav files are marked as resources
       // get the wav file from the DLL
       var streamInfo1 = Application.GetResourceStream(
            new Uri(loopWav, UriKind.Relative));
       var streamInfo2 = Application.GetResourceStream(
            new Uri(beatWav, UriKind.Relative));
    
        var stream1 = streamInfo1.Stream as UnmanagedMemoryStream;
        var stream2 = streamInfo2.Stream as UnmanagedMemoryStream;
    
        var bytesA = new byte[stream1.Length];
        var bytesB = new byte[stream2.Length];
    
        // read the bytes from the stream into the array
        stream1.Read(bytesA, 0, (int)stream1.Length);
        stream2.Read(bytesB, 0, (int)stream2.Length);
    
        var combined = new byte[bytesA.Length + bytesB.Length];
    
        // copy the bytes into the combined array
        System.Buffer.BlockCopy(bytesA, 0, combined, 0, bytesA.Length);
        System.Buffer.BlockCopy(bytesB, 0, combined, bytesA.Length, bytesB.Length);
    
        var outputStream = new MemoryStream();
        outputStream.Write(combined, 0, combined.Length);
    
        // substitute your own sample rate
        var effect = new SoundEffect(
              buffer: outputStream.ToArray(),
              sampleRate: 48000,
              channels: AudioChannels.Mono);
    
    
        var instance = effect.CreateInstance();
        instance.Play();
    
        // save stream to IsolatedStorage
    

    I’ve written more about WP7 audio for CoDe Magazine.

    http://www.code-magazine.com/Article.aspx?quickid=1109071

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having awful problems with this. I have a MapView, in my activity I
Having an awful time trying to get the accurate time for a set of
I'm having an awful time trying to get these triangle strips to show up.
I'm having an awful time trying to understand what my validation method is having
Having a heckuva time with this one, though I feel I'm missing something obvious.
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
I have this C# class structure that I would like to refactor to use
Rewriting this question to be a little more succient. My problem is that I
Having spent some time working on data warehousing, I have created both ETL (extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.