Csound Csound-dev Csound-tekno Search About

[slightly ot] 8-bit processing block?

Date2016-06-12 08:24
FromRory Walsh
Subject[slightly ot] 8-bit processing block?
I'm working on a Csound wrapper for the Unreal game engine. The Unreal documentation is shocking. After days of browsing their source code I think I've finally found out where I should be writing Csound's audio samples. The function prototype has me confused however. It looks like this:

int32 USoundWaveProceduralTest::GeneratePCMData(uint8* PCMData, const int32 SamplesNeeded)

The audio system is 16bit by default. So how can one use an uint8 to represent a range of 0 to 2^16 when it only goes from 0 to 2^8. I'm hoping some of you low-level gurus may have come across something like this before. I've checked SamplesNeeded and this looks like it's the size of the audio buffer to fill. It's coming in at 8192. There is also a NumChannels member that I can use to set the NumChannels. For now I have this set to one. I've tried filling the buffer with various things and I am getting some kind of audio, but even creating a simple sine wave has failed me!
     

The doc page for this method is here:



Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-06-12 12:01
FromRory Walsh
SubjectRe: [slightly ot] 8-bit processing block?
After another bit of searching through source code I came across a lot of this kind of thing:

/** Pointer to 16 bit PCM data */
uint8* PCMData;

So I guess it's a pointer to an array of 8bit samples that are combined to make up 16bit ones. Seems like a curious way of doing things, but they've probably being doing it that way since the very first Unreal Engine which was released almost 20 years ago. 



On 12 June 2016 at 08:24, Rory Walsh <rorywalsh@ear.ie> wrote:
I'm working on a Csound wrapper for the Unreal game engine. The Unreal documentation is shocking. After days of browsing their source code I think I've finally found out where I should be writing Csound's audio samples. The function prototype has me confused however. It looks like this:

int32 USoundWaveProceduralTest::GeneratePCMData(uint8* PCMData, const int32 SamplesNeeded)

The audio system is 16bit by default. So how can one use an uint8 to represent a range of 0 to 2^16 when it only goes from 0 to 2^8. I'm hoping some of you low-level gurus may have come across something like this before. I've checked SamplesNeeded and this looks like it's the size of the audio buffer to fill. It's coming in at 8192. There is also a NumChannels member that I can use to set the NumChannels. For now I have this set to one. I've tried filling the buffer with various things and I am getting some kind of audio, but even creating a simple sine wave has failed me!
     

The doc page for this method is here:




Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-06-12 12:15
FromVictor Lazzarini
SubjectRe: [slightly ot] 8-bit processing block?
Just a pointer. Sometimes char pointers are used instead of void ones to match any multibyte arrays.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 12 Jun 2016, at 12:01, Rory Walsh <rorywalsh@EAR.IE> wrote:

After another bit of searching through source code I came across a lot of this kind of thing:

/** Pointer to 16 bit PCM data */
uint8* PCMData;

So I guess it's a pointer to an array of 8bit samples that are combined to make up 16bit ones. Seems like a curious way of doing things, but they've probably being doing it that way since the very first Unreal Engine which was released almost 20 years ago. 



On 12 June 2016 at 08:24, Rory Walsh <rorywalsh@ear.ie> wrote:
I'm working on a Csound wrapper for the Unreal game engine. The Unreal documentation is shocking. After days of browsing their source code I think I've finally found out where I should be writing Csound's audio samples. The function prototype has me confused however. It looks like this:

int32 USoundWaveProceduralTest::GeneratePCMData(uint8* PCMData, const int32 SamplesNeeded)

The audio system is 16bit by default. So how can one use an uint8 to represent a range of 0 to 2^16 when it only goes from 0 to 2^8. I'm hoping some of you low-level gurus may have come across something like this before. I've checked SamplesNeeded and this looks like it's the size of the audio buffer to fill. It's coming in at 8192. There is also a NumChannels member that I can use to set the NumChannels. For now I have this set to one. I've tried filling the buffer with various things and I am getting some kind of audio, but even creating a simple sine wave has failed me!
     

The doc page for this method is here:




Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here