[wdmaudiodev] Re: Building an USB audio interface with a PIC18F4550

  • From: "Elios Elios Elios" <eelioss@xxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 29 Mar 2007 12:20:22 +0000

Thanks very much!

I´ve attached an image of my application...

My software should be able to play several audio tracks simultaneously and to record different inputs at time, like Adobe Audition or Cubase does, but simplified. I have tried to understand the source code of Audacity, but it's too long and hard for me (for the present).

I won't apply FX in realtime... The FX isn't a problem, because I'll make it with MATLAB (I can use MATLAB in C# with the .NET componentes). It will be like an external application.

I would like to record, for example, 3 audio tracks from different inputs while I'm listening the other tracks (even playing each track in a different device)... So, each track will have a control to choose the INPUT and another control to choose the OUTPUT (like Adobe Audition). 

With this functions (waveoutXXX, waveinXXX, mixerXXX) I can play an array of bytes (with a buffer system to prevent cuts in the audio). In my program, I have a routine that reads from the WAV file and sends the arrays of bytes (with the buffer lenght) to the buffering system. So my idea was, in this routine, to mix all the tracks and send them to the buffering system the average of each sample multiplied by the volume (a float)...

For recording, I´ve thought to make a lot of objects WaveRecord (one for each track), with some kind of synchronization (the same pointer of data for all). This object could record from my USB interface, or my soundcard.

Is winmm.dll the API I needed?

Thanks in advance.


Pete Gontier wrote:

The API you?re suggesting may or may not suffice. You need to describe the application you?re trying to write. Post your description to the list, because I?m a driver developer and app developers will probably have better insights into choosing an API for your app. I?m just trying to make the thread go faster.

Tim Roberts wrote:
You can use the waveOut APIs to control any audio device.  That's the
whole purpose for the routines in winmm.dll; they let you write
applications that use audio without having to know the gritty details of
the device.  The operating system provides an "adapter" to talk to
whatever kind of audio driver you actually have.

From: DJ Sisolak <dsisolak@xxxxxxxxxxxxxxxxxxxxxx>
Reply-To: wdmaudiodev@xxxxxxxxxxxxx
To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Building an USB audio interface with a PIC18F4550
Date: Wed, 28 Mar 2007 13:52:57 -0700

Hi Elios Elios Elios,


The USB Audio driver is just like any other audio driver in the system. You may access it through the usual audio APIs as you would any other audio device such as the wave APIs you mention below.



DJ Sisolak

Microsoft Corp.


From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Elios Elios Elios
Sent: Wednesday, March 28, 2007 9:57 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Building an USB audio interface with a PIC18F4550


Hello, thanks very much!

At the end we are making our USB Device an USB Audio Class Compliant ... but now we have some questions...

- Can I use my USB Device (USB Audio Class Compliant) with winmm.dll? If not... Which DLL should I use for that porpouse?

I've controlled my soundcard with this DLL, but I don't know if I could access to the driver USBAudio.sys... In fact, I only know "winmm.dll", but I expect that WDM Audio Drivers are a lot of things...

this is my example (partial):

private const string mmdll = "winmm.dll";
// native calls
public static extern int waveOutWrite(IntPtr hWaveOut, ref WaveHdr lpWaveOutHdr, int uSize);
static extern int waveOutOpen(out IntPtr hWaveOut, int uDeviceID, 
WaveFormat lpFormat, WaveDelegate dwCallback, int dwInstance, int dwFlags);
public static 
extern int waveOutReset(IntPtr hWaveOut);

And my program use these functions.

Can I use this functions to control my USB Audio Device?

Could anyone send me an example of USB Audio programming with C# (ó C++)?

Thanks in advance!

From:  DJ Sisolak <dsisolak@xxxxxxxxxxxxxxxxxxxxxx>
Reply-To:  wdmaudiodev@xxxxxxxxxxxxx
To:  "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
Subject:  [wdmaudiodev] Re: Building an USB audio interface with a PIC18F4550
Date:  Tue, 27 Mar 2007 16:53:59 -0700
>Hi All,
>Answers dispersed below...
>DJ Sisolak
>Microsoft Corp
>-----Original Message-----
>From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Tim Roberts
>Sent: Monday, March 26, 2007 10:56 AM
>To: wdmaudiodev@xxxxxxxxxxxxx
>Subject: [wdmaudiodev] Re: Building an USB audio interface with a PIC18F4550
>Elios Elios Elios wrote:
> >
> > I'm making my end of career project (telecomunications engineering),
> > that consist in a USB interface for capturing audio by 4 channels. We
> > are using as IC the PIC18F4550 of Microchip. We have made the PCB, and
> > we have comunicated the PIC and the PC with an C# example that we have
> > found in the WEB. This example is for low speed, and for audio isn't
> > very good...
>To do 44.1kHz audio at 16 bits per sample with 4 channels takes 353
>kB/sec.  That's double what a low-speed device can do.  You'll need full
>[DJ Sisolak] Correct, all spec compliant USB Audio devices MUST be full speed.
> > So, what is the better way to make an USB Audio Interface?
> >
> > I read the "USB Device Class Definition for Audio Devices 1.0" and the
> > 2.0... I think that if we follow the specification, we could to
> > control the interface with the driver Usbaudio.sys and programme it
> > with an Native API like WDMAudio Driver (winmm.dll, isn't?), or Core
> > Audio ...
>Yes, the best way to build an audio device is to meet the USB Audio
>Class Spec, as you describe above.  The trickiest part is creating the
>descriptors to describe your architecture, and even that's not too hard;
>there are samples in the documents on the USB web site.  You will want
>to do your streaming with an isochronous pipe.
>[DJ Sisolak] Again, correct. Streaming for USB Audio per the spec (MIDI being the exception) is done via Isochronous pipes. Descriptor generation for USB Audio 1.0 device is pretty straight forward from the spec. You may want to look at the guidelines as posted on http://www.microsoft.com/whdc/device/audio/UAA_HWdesign.mspx for some other information on this.
> > I read that there is a problem with USB 2.0 (the PIC18F4550 works in
> > USB 2.0, full speed) and Usbaudio.sys... Somebody knows it?
>Not that I know of.  There are a few discussions of this on the
>Microchip web site, but nothing negative.
>[DJ Sisolak] Full speed USB Audio devices should work just fine with USB 2.0 bus. There are some issues for getting a High Speed USB Audio 1.0 devices to work though.
> > Maybe the other solution can be to make a driver with Windriver... I
> > have listened that is very easy to do. But in this way only we could
> > to control our interface with our own driver... isn't?
>Making a simple driver with WinDriver might be easy, but making an audio
>driver of any kind is not easy.  Unless you run into some very serious
>problem, you should strive to make your device USB Audio Class compliant.
>[DJ Sisolak] I heartily agree. If for some reason you feel that the usbaudio.sys class driver does not fit your needs feel free to let me know why.
>Tim Roberts, timr@xxxxxxxxx
>Providenza & Boekelheide, Inc.
>WDMAUDIODEV addresses:
>Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
>Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
>Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
>Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
>WDMAUDIODEV addresses:
>Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
>Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
>Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
>Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

Acepta el reto MSN Premium: incluye Antivirus y Firewall de McAffee. Descárgalo y pruébalo 2 meses gratis.

****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/

Ofertas y reservas para viajar por todo el mundo. Organiza y contrata tus viajes aquí.

Attachment: captura de proyecto.JPG
Description: JPEG image

Other related posts: