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 - Dread_Boy

Pages: [1]
1
If you want to extract one channel, you need to go over the sample data and only pick every other sample.

Great, so if I for example want to create stereo sound where only left speaker is loud and right is quiet my Samples array would be

{1879, 0, 3751, 0, 5608, 0, 7444, 0, 9250, 0} //only a lot longer ofc

and when I want to play the same thing on both speakers, I would create

{1879, 1879, 3751, 3751, 5608, 5608, 7444, 7444, 9250, 9250}

Thank you for help!

2
Audio / How are Samples, ChannelCount and SampleRate connected?
« on: April 05, 2015, 09:45:25 am »
I'm having a problem and I can't find a solution. Long story short, I have 9 seconds long .wav sound with 2 channels and 48000 SampleRate. Then I try to do convolution (which is correct from tests I did) and save these new Samples in new SoundBuffer and later in Sound and play again. Firstly I was using these code:

song = new Sound(new SoundBuffer(y, song.SoundBuffer.ChannelCount, song.SoundBuffer.SampleRate));

and as you can see, I just copied old ChannelCount and SampleRate. It didn't work, SampleRate of new SoundBuffer was 0. Then I found out that if I do this:

song = new Sound(new SoundBuffer(y, 1, song.SoundBuffer.SampleRate));

I can play that new Sound but speed is half of that of original. Lastly, I changed the code to this:

song = new Sound(new SoundBuffer(y, 1, song.SoundBuffer.SampleRate * 2));

and now everything's fine, the Sound can be played and length is as it should be. But I still don't know the actual solution to my problem. What if I want to do different convolutions for different channels, how can I recognise those channels in Samples array? And how do I need to save these modified Samples in new array in order to play them as SoundBuffer with 2 channels?

Pages: [1]