Author Topic: CM2606 based DAC - on linux  (Read 65991 times)

0 Members and 5 Guests are viewing this topic.

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
CM2606 based DAC - on linux
« on: August 28, 2009, 05:35:24 pm »
Hi all - been following and reading forum for a while and have struggled to find the help I need so far:

I'm trying to build a soundcard based DAC for a laser projector. My house mate has a laser projector but hasn't got round to making a soundcard DAC yet and we're keen to get one up and running.

We are running the USB card on linux 9.04 and struggling to find appropriate drivers to control each of the souncard's outputs.

Also generally using linux without access to windows seems to be less well documented - as a relatively-n00b linux user this has proved quite hard too - but we're keen to learn.

any pointers? :)
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #1 on: August 28, 2009, 05:47:59 pm »
Hello sc_r!

Welcome to the LaserBoy forum.  ;D

What have you been able to acheive so far?

Have you built the LaserBoy code in Linux yet?

Are you aware of the various audio applications that allow you to play waves from the commond prompt and set the various parameters of your sound card mixer?

Have you ever built the Linux kernel?

What sort of help do you need with building the sound card DAC?

Quote
Also generally using linux without access to windows seems to be less well documented

If you mean running Linux from a command prompt only, without Xfree86, then you are soooo gonna' love LaserBoy! It will run from the console! But, you need a frame buffer enabled kernel. You may have one! Do you see the little penguin when you boot?  ;D

I'm really glad to see that someone here wants to do it in 100% Linux!  ;D

See, Gary!  :P %)

James.  :)
« Last Edit: August 28, 2009, 06:22:45 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #2 on: August 29, 2009, 03:57:50 pm »
Hi James

- thanks for such a warm welcome! Your attitude is what really pushed me into posting up for help - not so common across interweb forums!

OK so the story so far:

>> Have you built the LaserBoy code in Linux yet?

- yes, got it all working in as far as the program loads and I can flick through menus etc. - it is running on ubuntu jaunty 9.04


>> What sort of help do you need with building the sound card DAC?

- I have got hold of a card with a 6206 chip in it and was originally hoping to build one of the laserboy corretion amps completely DIY - so would really like a circuit diagram or something similar. Since reading your forum though I am tempted to get one of your boards or even full kits as it looks like it would take a lot of legwork out of the building. Fairly used to using a soldering iron and would say just above basic electronic understanding / skills.

As far as linux help goes - ubuntu is GUI and n00b friendly but I am used to command prompt - from the good old dos days! So have been using the terminal to run commands / install drivers and codecs within linux so far.

Not sure if I see a penguin when I load - is there a more terminal-based way I can check if I have a frame buffer enabled kernel?

Also very keen to find out about command-prompt ways of testing the sound card / playing back multi-channel wavs. I have been having toruble finding drivers and am assuming that there aren't any official drivers or equivalents to the windows sound manager app to set the levels on the sound card - terminal commands seem so much more elegant, I just need to know what to type and store it in my memory!

Keen to post pictures and share my experience to help others with a 6206 card too.

Linux FTW! ;)
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #3 on: August 29, 2009, 04:13:56 pm »
AWESOME!!!  ;D ;D ;D

To be honest, I will have to figure out a lot of this stuff too!

Since I converted LaserBoy to run with SDL, I have not been using Linux.

(Shut up Gary!)  %)

Anyway...

If you have Xfree86 and all the GUI stuff, then you don't really need a frame buffer enabled kernel. But let me tell you about it anyway.

If you see a little penguin when you boot up, then you have it. "It" is a kernel that was built such that a fake file in the /dev/ system area is created and linked to the display RAM on each video card in your computer, /dev/fb0 /dev/fb1, etc.... Any application can open this for binary IO and directly render to the screen. In the good-old-days, LaserBoy sat on top of EZFB, which is a super cool Linux frame buffer API that is fully OOP written in C, also by me. As it turns out, the people who wrote the SDL also saw the benefits of such direct access to the screen and included code in their library to do the same.

Quite honestly, I hate to give this up! But, if I want to use FLTK I will lose this!

The way to see if you have it or not is simple.

# fbset

The fbset command lets you see and set the parameters of the display.

Yes, there is a schematic of the correction amp, more or less. The chip you have has a lower DC offset voltage than most other sound cards, so it will take some tweaks to the resister values.

What have you been able to do with the C-Media chip in Linux? I didn't think there was any driver for it. You might only be getting the most generic functionallity. Perhaps you can only play stereo.

Sound card drivers work in a very similar way as the frame buffer idea. That is to say, the sound device appears in the /dev/ directory as well. usually /dev/dsp. You can read and write directly to and from this "file" and you will be recording or playing sound.

All devices are abstracted as files in UNIX. That is one of the most powerful features of the architecture. A file is simply something that either produces or consumes a stream of data or both. In the C programming language there is a function for communicating with the device behind the "file" called ioctl(). This is how applications see or change the settings of the sound card.

Quote
Your attitude is what really pushed me into posting up for help.

WHAT?  ??? %)

I'm such a great guy!  :P

That must be why I am loved by millions!  ;)

James.  :)
« Last Edit: August 29, 2009, 04:33:14 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #4 on: August 29, 2009, 04:32:15 pm »
Thanks for advice etc. - take that as granted now or I'll just sound like a major fanboi! ;)

tried the "# fbset" command and nothing displayed in terminal. Any further ideas..?

With the c-media USB thing - seemed to work fairly well out of the box - went into the sound drivers section of ubuntu [System->Preferences->Sound]

I selected the option 'USB sound device USB Audio (OSS)' option and when testing can get sound out of the main (green) jack and the 'headphone monitor' jack.

also the usb card has onboard buttons to control volume / muting and they do work - causing a soft volume display to appear on screen - displaying changes made by buttons.

so - the card seems to be fairly well recognised. I now want to try and get more outputs working and perhaps create some sort of batch or onfig file that I can run to set all of the outputs and volumes correctly.

Does the board ' remember' settings - ie. if configured by a windows PC would it remain the same on next boot by default or does it require setup each time before use?

I understand that resistor values will need to be tweaked - all part of the fun right? but I have access to oscilloscopes etc ;)

I have looked in my /dev/ folder and there is no /dsp folder - there are dsp and dsp1 files but I can't open them with text editor.

Looking forward to getting back into linux again then?!

+ yeah the attitude thing - it was about the post you made encouraging lurkers to get in touch. plus enthusiasm for the laserboy software is cool!
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #5 on: August 29, 2009, 04:43:33 pm »
The file is /dev/dsp.

It's not a folder.

That is your sound card!

You might have two, /dev/dsp and /dev/dsp1. That would indicate that your computer has a built in sound device.

It is not a regular file, so you can't open it in a text editor.

# alsamixer

is probably what you are looking for!

Have you made any multichannel wave in LaserBoy?

Make one and see what happens when you play it.

# aplay ./wav/LaserBoy.wav

James.  :)
« Last Edit: August 29, 2009, 04:49:40 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #6 on: August 29, 2009, 04:56:55 pm »
Makes sense - motherboard had onboard audio and I guess when I plugged in USB card it created /dev/dsp1

I am a little confused as to where I shouold be typing these # alsamixer commands - terminal, laserboy or otherwise!?

consider my linux knowledge to be minimal at the moment!

Just trying to make a multichannel wav file in laserboy now...
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #7 on: August 29, 2009, 05:24:25 pm »
In Xfree, If you open a terminal, cd to the LaserBoy directory and type

# ./LaserBoy [width height] &

You'll be running LaserBoy.

The & means that it's a new process running in the background, so you get your command prompt back!

At the prompt, you can type

# aplay wav/LaserBoy.wav

And that should send the wav to the sound card.

Do a man on aplay.

# man aplay

to see how to select the right sound device.

The letter 'q' gets you out of man, man!  ;) ;D

James.  :)

PS. LaserBoy takes only single keystrokes, except when it is asking for the name of a file to open or save, the name of an effect to apply to a frame or set of frames, multi-digit numeric values, or for a string of characters to render as art.

Also note. LaserBoy completely ignores the mouse! The X in the corner of the window to close the application does not work! You must [Esc] follow the instruction in the LaserBoy display!

On a Linux machine, LaserBoy doesn't look so weird. Does it?  ;D
« Last Edit: August 29, 2009, 05:43:30 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #8 on: August 29, 2009, 05:38:28 pm »
-->

The letter 'q' gets you out of man, man!  Wink Grin

--> well, phew! I was quitting and restarting terminal before then..!

adjusting well to laserboy - happy without a mouse - it's refreshing

managed to aplay -l and found both audio devices - the dev1 - USB device is listed as default.

so, now need to wait for oscilloscope - tomorrow - and have a look at the circuit diagram and see what other components I need. Do you have a link to it?

-EDIT-

just got fbset to work and trying to install it - on flaky wifi! progress comes to those who wait..
« Last Edit: August 29, 2009, 05:41:09 pm by sc_r »
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #9 on: August 29, 2009, 05:48:33 pm »
There's bunch of really old and crusty photos from 2005, here:

http://akrobiz.com/laserboy

If you look through them, you will find the first published version of the LaserBoy Correction Amp.

http://akrobiz.com/laserboy/p_laserboy_95.html

This is pretty much the idea.

The only changes are

1. The use of a DC/DC converter that takes GND and +5VDC and makes GND +9VDC and -9VDC to power the op-amps.

2. The use of an adjustable negative voltage regulator with a pot to create the reference voltage that gets summed with the DC offset signals.

3. Resister values are slightly different for better resolution of the offset voltage and more gain.

James.  :)

PS. I never thought to ask you.... Are you using a laptop or a desktop? If you can use a PCI sound card, then all of this is a WAY DONE deal!  ;D
« Last Edit: August 29, 2009, 05:52:15 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #10 on: August 29, 2009, 06:01:08 pm »
Have seen those photos and diagram before -

however not sure on how to add the extra sections - with electronics I can follow instructions but building skills are limited theory-wise.

Am thinking buying one of your PCBs would save us a lot of time - despite being keen to make a fully homebrew solution! How much would postage to UK cost?

one thing - when bypassing the output caps on the USB sound card are you soldering to the negative terminal of each cap? I am keen to crack on with the project and soldering relevant connections onto the card seems like a good thing to be doing. I am trying to compare other pictures of modified sound cards based on different chips on these forums and have an idea of what to do..

--EDIT--

I am using a desktop with plenty of spare PCI cards but using a USB card because thats what I have
« Last Edit: August 29, 2009, 06:05:33 pm by sc_r »
--
stuart

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2132
  • Milliwatts: 47
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: CM2606 based DAC - on linux
« Reply #11 on: August 29, 2009, 06:05:57 pm »
Yes. The idea is to just tap the signal on the cap lead that is on the output side of the DAC. The other lead of the cap will be on its way to the output jack. If you leave the cap in place, then the jack still works as expected.

I don't have any naked pc boards. DrLava, also on this forum, might still have some. If he does, I'll make sure you get one with the DC/DC converter included. All the rest of the parts are totally common.

I had great success with both C-Media and VIA chips on PCI cards in Linux!

C-Media 8738 --> 6 channels
C-Media 8768 --> 8 channels
VIA VT1721  --> 8 channel

300EVIL,

who should post here more often,  :-[

made a really nice LaserBoy Correction Amp pc board. He might still have some too.

James.  :)

PS. PCI boards have less latency. Plus you have the added advantage of being able to tap the GND, +12VDC and -12VDC to power the op-amps. No DC/DC converted needed! And no USB current limitations!
« Last Edit: August 29, 2009, 06:17:14 pm by James »
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
Re: CM2606 based DAC - on linux
« Reply #12 on: August 29, 2009, 06:11:43 pm »
Grand!

Let me know, what's up DrLava? :)

Pictures to come tomorrow of what's happening over here
--
stuart

Offline sc_r

  • Newbie
  • *
  • Posts: 12
  • Milliwatts: 3
  • Gender: Male
  • open source is nice
    • View Profile
    • some information
--
stuart

Offline drlava

  • Sr. Member
  • ****
  • Posts: 314
  • Milliwatts: 18
    • View Profile
Re: CM2606 based DAC - on linux
« Reply #14 on: August 29, 2009, 09:27:58 pm »
Hey, nice to see someone trying to crack into the linux sound card DAC stuff.  I'm curious to see how linux handles multi-channel audio in and out of that mysterious 'file'. 

There are still tons of PCBs and a few full kits as well here:
http://hacylon.case.edu/ebay/laser_diode/LaserBoy_Correction_Amp.php


Good luck!

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.7 © 2008-2024, SimplePortal