8 channel LPCM over HDMI, It's Multi Amp for Everyone

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hi fb Thanks! please fiddle around. Code is short enough to take on a walk. I think what I did is just a connection between CUDA and PortAudio?

Now I installed clean XP / and found console mode CUDA app requires only 2 dll. I did not install any CUDA toolkit / SDK.

cudart.dll, cutil32.dll.

These 2 are re-distributable.

I'm writing how to memo for install / set up for user / set up as programmer ....
 
fb said:
:)

To clear things up (though correct me if I'm wrong)-

HDMI is an interconnect system. It is not directly related to GPUs or FIR filtering. It is useful in that it allows a computer soundcard to send 8 channels of lossless audio to an integrated amplifier (home theatre reciever) over 1 cable. This is much cheaper and easier than existing solutions involving multichannel soundcards and several discrete amplifiers.

Koon's FIR engine utilises Portaudio, a library which can access practically any soundcard's drivers. This is not in any way limited to HDMI, though in many situations this is an optimal solution.

Xonar HDAV1.3 Soundcard. This is useful for those who do not wish to purchase a compatible motherboard. It does not replace the home theatre reciever, it connects to it via HDMI. Portaudio will be able to access this cards drivers. The HDMI input on this card is used to recieve video from your video card. Many other soundcard options exist for those who don't require HDMI.

/B]


AFAIK HDMI is non simply an interconnect system, like USB. To receive am HDMI signal (that is encrypted) it needs an HDMI decoder, that's why Koon uses an HT receaver and cannot send HDMI 8-ch PCM directly to his wonderful 8 ch digital amplifier.

Xonar has HDMI 1.3 in and out, so it is a receaver (HDMI 1.3 supports DSD). What's new is that it can output 8 uncompressed pcm channels through its daughter card (in the picture above).

So if PortAudio->CUDA->Xonar works, we can use our own DAC or digital amplifier. No need of HDMI motherboards nor Nvidia chips with HDMI output.

Bad news is that Xonar HDAV 1.3 is not yet on the market :mad:
 
thomaseliot said:

What's new is that it can output 8 uncompressed pcm channels through its daughter card (in the picture above).

That sounds interesting, We don't need Lynx anymore?
If Mod Xonar can output 8 channel I2S, Or 6 channel I2S is on the main-daughter cable, any DAC DIYer can enjoy.

Not PortAudio->CUDA->Xonar
some APP -> PortAudio -> Xonar :)

Using PortAudio is very easy and platform (almost) free,
I recommend any Sunday DIYAudio programmer to learn PortAudio.
 
"Easy I2S output 192/24" is interesting for any DAC/Digital Amp diyers?

Sure it is! However the main problem from my point of view is having a proper way of streaming audio to the fpga. That is, slaving the pc to a clock that is in the DAC. And having control and being able to mod the clock, the dac's (if any), the psu, and so on. I guess only firewire, ethernet and wifi are promising in this regard. The firewire seems to be the best option, however is somewhat limited in availability. And it's hard to code. Wi-fi, the same.

The easiest to code probably would be ethernet, but now ethernet was never meant for audio. However it just might work. Cobra net uses a giga link and it has a special protocol

I find HDMI more complicated because with all that encrypting and blah-blah, you never know what is happening with the signal. It;s not that open as the other options.

Developing an aplication around netburner or any other ethernet device would be great. By the way KOON, using a FPGA with a 100Mb ethernet gives you the possibility to use Microblaze as soft CPU. That's 32bit bus also if I remember right.

edit: Take a look at this experiment here. Streaming over ethernet with a suzaku board. There is another DIY board that is now working with a Spartan FPGA, MAC and memory, but you'll have to contact Peufeu (here on this forum) to gain access on that forum.
 
thomaseliot said:


AFAIK HDMI is non simply an interconnect system, like USB. To receive am HDMI signal (that is encrypted) it needs an HDMI decoder, that's why Koon uses an HT receaver and cannot send HDMI 8-ch PCM directly to his wonderful 8 ch digital amplifier.

Xonar has HDMI 1.3 in and out, so it is a receaver (HDMI 1.3 supports DSD). What's new is that it can output 8 uncompressed pcm channels through its daughter card (in the picture above).


I understand what you mean, but this aspect of the Xonar is surely not new (though maybe at a good price?), and not actually related to HDMI... there are other soundcards with daughterboards and then also many-channelled AES soundcards from Lynx, RME etc.
eg. RME HDSPe AES

:)
 
I understand what you mean, but this aspect of the Xonar is surely not new (though maybe at a good price?), and not actually related to HDMI... there are other soundcards with daughterboards and then also many-channelled AES soundcards from Lynx, RME etc. eg. RME HDSPe AES

Well yes but you can't find a RME board for about 200 usd. Furthermore, RME actually uses a codec from AKM. It's not even near the -120db specs Asus is promising.
 
Hi, I posted "How To Run GPU FIR" and binary package.

http://koonlab.com/MultiAmpForEveryone/FIR_HDMI_AVAMP.html

I tested with clean installed Xp32.
Something special is VC++ redistributable only, this is required for PortAudio and FIR parameter generator.

If you are not a Programmer, you don't need CUDA toolkit etc.

Next I will write "How to Build GPU FIR" for programmers :)
 
Attached is WaveX05 modified to use ASIO.... currently driver is selected in code, just replace "ASIO4ALL v2" with whatever ASIO driver you use (as portaudio lists it).... can someone test this? Particularly channel assignments? I have to compile in CUDA emulation mode as I have no compatible GPU.

It should be simple to add code to handle different driver types, and select driver from config file.

Note: I've hacked + slashed at code and I'm definitely not a skilled programmer. :)




Koon, how fast will this run in emulation mode? (Intel Core2quad) Will it run at all?
 
Can't attach for some reason, here's int main


int main( int argc, char** argv)
{
//Check Arguments Count
if (argc != 2)
{
printf("requires 1 arguments.\n");
printf("WaveX05 ConfigFile\n");
printf("WaveX05 \"C:\\Temp\\WaveX.cfg\" \n");
return -1;
}

strncpy_s(ConfigFile,256, argv[1],strlen(argv[1]));

ReadConfig(ConfigFile);

ReadFIRCoeff();

PaStreamParameters inputParameters, outputParameters;
PaStream *stream = NULL;
PaError err;
paTestData data;
int StreamStatus = 1;

err = Pa_Initialize();
if( err != paNoError ) goto error;

int devIndex;
for( devIndex=0; devIndex<Pa_GetDeviceCount(); devIndex++ )
{
printf( "found id %d (%s)\n", devIndex, Pa_GetDeviceInfo(devIndex)->name );
if (strcmp("ASIO4ALL v2", Pa_GetDeviceInfo(devIndex)->name) == 0)
goto devFound;
}
printf("Selected driver not found\n");
return -1;

devFound:

printf( "using device id %d (%s)\n", devIndex, Pa_GetDeviceInfo(devIndex)->name );

inputParameters.device = devIndex; /* selected input device */

printf( "input device # %d.\n", inputParameters.device );
printf( "input LL: %g s\n", Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency );
printf( "input HL: %g s\n", Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency );
inputParameters.channelCount = NUM_IN_CHANNELS;
inputParameters.sampleFormat = PA_INPUT_SAMPLE_TYPE;
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency;
inputParameters.hostApiSpecificStreamInfo = NULL;

printf( "using device id %d (%s)\n", devIndex, Pa_GetDeviceInfo(devIndex)->name );

outputParameters.device = devIndex; /* selected output device */

printf( "Output device # %d.\n", outputParameters.device );
printf( "Output LL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency );
printf( "Output HL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency );
outputParameters.channelCount = NUM_OUT_CHANNELS;
outputParameters.sampleFormat = PA_OUTPUT_SAMPLE_TYPE;
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;


int outputChannelSelectors[NUM_OUT_CHANNELS];
PaAsioStreamInfo ASIOInfo;
ASIOInfo.size = sizeof(PaAsioStreamInfo);
ASIOInfo.hostApiType = paASIO;
ASIOInfo.version = 1;

int i;
for (i = 0; i < NUM_OUT_CHANNELS; i++) //Assigns stream channels to hardware outputs
outputChannelSelectors = i;

ASIOInfo.channelSelectors = outputChannelSelectors;
ASIOInfo.flags = paAsioUseChannelSelectors;

outputParameters.hostApiSpecificStreamInfo = &ASIOInfo;


// format check
if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported )
{
printf( "Pa_IsFormatSupported reports device will support %d channels.\n", NUM_OUT_CHANNELS );
}
else
{
printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", NUM_OUT_CHANNELS );
goto error;
}

//Block size for output buffer.
data.numOutBytes = FRAMES_PER_BUFFER * NUM_OUT_CHANNELS * OUTPUT_SAMPLE_SIZE;
data.numInBytes = FRAMES_PER_BUFFER * NUM_IN_CHANNELS * INPUT_SAMPLE_SIZE;

InitRingBuffer(&data);

err = Pa_OpenStream(
&stream,
&inputParameters,
&outputParameters,
SAMPLE_RATE,
FRAMES_PER_BUFFER,
paNoFlag,
patestCallback,
&data ); /* userData */

if( err != paNoError ) goto error;

//start stream before process, let stream wait.
err = Pa_StartStream( stream );
if( err != paNoError ) goto error;

printf("stream started.\n");

//Process
ProcessGPU(&data);

data.PlayFinished = 1;

//wait loop until stream completed.
while (StreamStatus > 0)
{
Pa_Sleep( 1000 );
StreamStatus = Pa_IsStreamActive(stream);
printf("waiting, stream. counter : %d \r", data.PAOutCursor);
}
printf("\n");
printf("loopend, stream ending status: %d .\n", StreamStatus);
Pa_Sleep(50);

free(data.pOutRing[0]);
free(data.pOutRing[1]);
free(data.pOutRing[2]);
free(data.pOutRing[3]);
free(data.pInRing[0]);
free(data.pInRing[1]);
free(data.pInRing[2]);
free(data.pInRing[3]);

printf("%s\n",Pa_GetErrorText(err));

err = Pa_StopStream( stream );
if( err != paNoError ) goto error;

Pa_Sleep(50);

Pa_CloseStream( stream );

Pa_Sleep(50);

Pa_Terminate();
return 0;

error:
if( stream ) {
Pa_AbortStream( stream );
Pa_CloseStream( stream );
}
Pa_Terminate();
fprintf( stderr, "An error occured while using the portaudio stream\n" );
fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
return -1;

}
 
Hi fb thanks for hack,

So differences are just two,
deviceIndex
hostApiSpecificStreamInfo
20 lines modification enables ASIO. great.
maybe int InitializeStreamParams(&inParam, &outParam) can organize device selection.

in emulation mode, it will be x64 times slower, compared to GeForce9500.
I recommend GeForce8400 or 9500. cheap and cool, enough power for audio.
I have MSI 9500 Fanless, and 8400 + Accelero S2.
Both can work for GPU FIR without fan.
 
I posted current source code and "How to buid and run" from installing VS2005 to new XP32.
please see 08/23/2008
http://koonlab.com/MultiAmpForEveryone/FIR_HDMI_AVAMP.html

I noticed there are sudden stop of stream, after some thousands seconds of running. Code was modded for multithreading and time out detection.

main() was reduced to 110 lines so should be more easyer to see how it works.
 
Much nicer.
Btw one note for those with the .obj compile error. NVCC does not support Visual Studio 2008, this is CUDA limitation for now.

Koon, is it possible to do a 2 channel output (I see it can be changed in the code from 8) and use Stereo Mix (available in Recording options in Windows) as an input?
This way I can play directly from the laptop and test it on the HDMI TV.
Will try that tomorrow, too late here now, unless you tell me that it will not work.

If I'm not mistaken no one yet confirmed that it actually sings?
 
Koon:

9500GT: do these support 24bit audio or is floating point processor like GTX280 needed?

We are using CUDA 2 now is that correct?

Shinobiwan here: post wonders why only 8192 taps?


nuhi:

VS2008 can be used in conjunction with VS2005, instructions in this post: link

I'm not sure what windows recording options do.... you may need to try Virtual Audio cable, which provides a direct sound driver you can select for Windows default audio output device. Portaudio will then need to select this Virtual Cable 1 (eg) as its input and your hardware soundcard as its output.



Thanks all
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.