News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Creating a pure audio thread in x64

Started by Camper, June 02, 2017, 10:10:16 PM

Previous topic - Next topic

Camper

Hi,

So, I have this GUI in .net, and I want to create standalone audio applications using a VB:NET GUI and a p-invoked audio thread.
I was wondering what the scope f such a project wold be, given i'm a half decent audio programmer also somewhat versed in assembler
So I ultimately want to support multiple drivers and have the DAC and the audio thread inside an assembly file.
Is this a hard project to do?

regards,

hutch--

There are two things that come to mind, how do you call either a DLL from .NET or link a modules. The other is you need to know how to write the module or procedure that you want to call from .NET. If you can work those things out writing the assembler should be straight forward enough.

jj2007

Indeed, as Hutch wrote, this doesn't sound overly difficult. Do you have source code in other languages, VB, C, C++? What do you expect from assembler here, a speed gain?

Camper

#3
A speed gain shure, Maybe spend some time with assembler is a fun thing to do. It's a good thing to do with pen and paper.

It was my goal to have the entire thread go in assembler, and have a few outputs in the assembly for listing devices and sample rates in the GUI. But mostly one big thread representing both the DAC and the audio thread. A bit like computer controlled analog. So I need to learn the assembler way of generating sound and listing devices.  But I have no idea really about the task at hand.

Are there any examples that deal with this, i.e. moving some waveform to direct sound? That I can have a look at?
Trying to get a grip on both worlds.

JJ,  I made "this", and want to move on from there.



Camper

I think about P-invoking some C code, and calling the assembly from the C code. It's actually ready made  :greenclp:


Siekmanski

You want to enumerate sound-card devices in assembly?
Creative coders use backward thinking techniques as a strategy.

Camper

Yes, and have a higher end DS, ASIO and WASAPI interface. Or outputs at first.
I'm looking for the quickest way to start writing the functional audio code.
Thinking the problem with .net is that it has the DSP code as managed code.
Having it ready made in C is better.

Siekmanski

Here are 2 examples, ASIO and DirectSound. I'm curious what it is you are going to write.
Why not skip the entire .NET code if your going to write DSP stuff?

Ik ben zeer nieuwsgierig als het om muziek applicaties gaat... :biggrin:
Creative coders use backward thinking techniques as a strategy.

Camper

Nice, Looks complicated, will try to learn a lot from this. The lib I was talking about was libsoundio.
The reason I want want to stick with VB.NET is I have "this" custom GUI made in it. It's very what I want from it, very tactile and accurate.
And almost finished. So maybe I can port it to assembler one day,

Maybe you like this Granular delay I made in 2012. It's a bit washed up in the x64 era. I want to go big this time. And make a standalone daw style synthesizer. To port into a VST if it stays under 10%. http://www.soundsystembrabant.com/

Siekmanski

Kan je webpagina niet lezen, komt heel klein op mijn scherm.
Heb libsoundio even opgezocht maar heeft geen ondersteuning voor ASIO zie ik.
Creative coders use backward thinking techniques as a strategy.

Camper

Ok thx, welke browser? Zoom setting "internet explorer?"
VST Dll only

Ye, youre right need to gather some more data, im really agnostic to this stuff.. Yust mathematician and binary arithmetic nerd, need to learn a lot while trying to make stuff.


Siekmanski

Yeah, you need to be a little bit of a math freak to do this kind of stuff.
Creative coders use backward thinking techniques as a strategy.

Camper

But Thanks for the notification on my site, not going to fix it tho. This stuff breaks all the time with Explorer, it gets harder every time. I have the same issue with i.e 11. Firefox works fine. Going to convert to XHTML soon,

Your ASIO stuff looks great actually. Maybe I can have a couple of extra register violations building a switch. And having the code in another DLL. So you can have the DS and WASAPI or ASIO, getting the bytebuffer. But it's not by far an elegant solution. Or maybe run the same code in different loops? Im pretty hell bent on having DS because of the multiclient drivers, and WASAPI is must have too..

The enumerate app, what does it do?

Siekmanski

You could try checking for ASIO first then WASAPI and at last Directsound. ( if latency is a big deal )
Maybe create seperate libs pointing to the same sample buffer....

QuoteThe enumerate app, what does it do?

It finds all sound-cards connected to your computer.
Some sound-cards have multiple channels.
I've got a "Marian Trace Pro" sound-card with 6 stereo input channels and 8 stereo output channels.
So you can select your in and output channels or choose another sound-card.



here the ASIO output of my  Marian Trace Pro:

Siekmanski ASIO Sound Card Test..........


Number of ASIO drivers found: 1


Return value Asio function init: 1

DriverName          : TRACE PRO
Version             : 2

numInputChannels    : 12
numOutputChannels   : 16

inputLatency        : 800
outputLatency       : 800

BufferminSize       : 32
BuffermaxSize       : 2048
BufferpreferredSize : 800
Buffergranularity   : 16

Enum SampleRates:

8000
9600
11025
12000
16000
22050
24000
32000
44100
48000
88200
96000
152000
176400
192000

total SampleRates   : 15

Actual SampleRate   : 44100

Input Channel Infos:

Channel             : 0
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 1-2

Channel             : 1
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 1-2

Channel             : 2
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 3-4

Channel             : 3
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 3-4

Channel             : 4
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 9-10

Channel             : 5
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 9-10

Channel             : 6
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 11-12

Channel             : 7
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 11-12

Channel             : 8
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 13-14

Channel             : 9
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 13-14

Channel             : 10
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 15-16

Channel             : 11
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 15-16


Output Channel Infos:

Channel             : 0
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 1-2

Channel             : 1
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 1-2

Channel             : 2
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 3-4

Channel             : 3
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 3-4

Channel             : 4
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 5-6

Channel             : 5
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 5-6

Channel             : 6
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 7-8

Channel             : 7
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 7-8

Channel             : 8
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 9-10

Channel             : 9
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 9-10

Channel             : 10
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 11-12

Channel             : 11
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 11-12

Channel             : 12
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 13-14

Channel             : 13
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 13-14

Channel             : 14
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 15-16

Channel             : 15
Channel Group       : 0
Data Type           : 27
Name                : Trace PRO 15-16

NumClockSources     : 4

Index               : 0
AssociatedChannel   : -1
AssociatedGroup     : -1
IsCurrentSource     : 1
Name                : Internal

Index               : 0
AssociatedChannel   : -1
AssociatedGroup     : -1
IsCurrentSource     : 1
Name                : Internal

Index               : 0
AssociatedChannel   : -1
AssociatedGroup     : -1
IsCurrentSource     : 1
Name                : Internal

Index               : 0
AssociatedChannel   : -1
AssociatedGroup     : -1
IsCurrentSource     : 1
Name                : Internal


The driver can not convert the host data directly to the DMA buffer.
No output latency reduction by one block.

Press any key to continue...


Creative coders use backward thinking techniques as a strategy.

mabdelouahab

Quote from: Siekmanski on June 05, 2017, 03:12:53 AM
Why not skip the entire .NET code if your going to write DSP stuff?
Siekmanski  are right and it is also the easiest way
I have no experience in sound but if he needs help in dealing with .net assembly project or assembly in .net project then I'm ready to help.