Shop OBEX P1 Docs P2 Docs Learn Events
propeller as eq for pocket amp? — Parallax Forums

propeller as eq for pocket amp?

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2012-06-14 03:37 in Propeller 1
ive recently been side tracked building a headphone amp, basically becuase i needed one and wanted to learn more about analog stuff..

i started thinking i could use the propeller to control some digital pots for gain and volume control, and build a decent little prop sound card using my amp design. then i started wondering what would it take to use the prop as a digital eg for my pocket amp..

i have some pricey 24bit adcs and a 12 bit dac if needed. im not sure if using the props dacs and adcs would be good enough. how posible would it be to use the prop as an eq? ive never written sound code so im not sure what it entails. is this whole idea a huge undertacking or is it as simple as a few passives with an obex object? id really like to make a kill headphone amp but have 0 intrest ib learning to much about coding an eq or any sound processing.

Comments

  • LeonLeon Posts: 7,620
    edited 2012-05-23 02:38
    There are much better devices for that sort of thing, such as the Microchip dsPICs. Microchip even has an equaliser software library:

    http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537918
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-23 03:50
    You need a lot of oomph for digitally filtering hifi audio - the basic operation of a digital filter is the multiply-and-add/sub instruction, either on fixed or floating point. A reasonable multiple-pole digital filter might involve a dozen multiple-and-adds per sample per channel, an equalisation filter might be a lot more (100's?) So given a sampling rate of 96kHz on two channels that's something like 2 to 50 million/second. There is scope for lots of pipelining with digital filters so DSP architectures are optimised to do this.

    On the prop you would have to go with somewhat lower performance I think, reduce bandwidth and resolution, and hand-code the multiplies (which are by the filter constants). Of course if you calculate the filter coefficients on the fly then the multiplies cannot be optimized. Splitting the work between many cogs will likely be needed (you'll need at least one to drive the I2S bus to talk to external ADC/DAC.

    DSPs usually use limiting (rather than overflowing) arithmetic to clip an overly strong signal rather than produce even worse distortion.

    I'm intrigued why you have expensive ADCs, they are commodity chips for audio now, for instance the WM8783 24bit stereo ADC, less than $1.

    You might want to look at what a $5 chip can do in the way of audio signal processing and class-D amplification: STA339BWS http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00220929.pdf
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2012-05-23 03:59
    Hi,
    I have done a guitar sound project with the propeller "propersound" and have had a lot of fun with it. I think, that the propeller is berhaps not the optimum but still very well suited. I find sound processing very interesting. Some (personal) remarks:

    * If you want to use just any processor, you might want to consider "spinsemi FV-1" (google), because this chip is designed for stereo sound processing and has got high quality adc and dac onboard. They have good descriptions of effects and their programming.
    * If you want to give propeller a try, then:
    * Use external adc and dac, on chip sigma delta is not good enough.>=16bit codec.
    * Spin is far too slow, you need a compiler, that can produce cog code. PropBasic worked for me very well.
    * The bottleneck for the propeller might be the number of multiplications between two sample steps. The propeller-I does not have hardware multiply, so each multiplication takes its time. You have 20e6 Instructions per cog and second and you have 44e3 samples per second, thats about 450 instructions per cog and sample. I don't know by heart now, but a multiply will need about up to somewhat like 50...100 instructions. So I would try to find an algorythm and count the multiplies in it and then check, if this can fit into the cogs. The maths will have to be split to do it in parallel with multiple cogs.

    Reverb or echo is rather easy, you could add such a feature into your project.

    Have fun, Christof
  • pgbpsupgbpsu Posts: 460
    edited 2012-05-23 06:22
    Have a look at Phil's work with signal processing and FIR filters:
    http://forums.parallax.com/showthread.php?133173-FIR2PASM-Automatic-FIR-Filter-Code-Generator

    The prop may not be the optimal choice, but you'd be surprised what it can handle. Best of luck.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-05-23 11:16
    as far as a dsp type of thing goes im very much not tied to the propeller. Id like to sell my amp and just want to add some eq abilitys. for a pocket amp or a prop sound card i was hoping to use something alot smaller smaller with alot less supporting circuitry. i would like to stay through hole and the prop is just to big.

    i figured id ask though becuase the prop would be the fatest way for me to implement a dsp if there were librarys already and it was a capable solution.
    ive looked at just implementing a 3band rc eq, but i have a feeling a chip will be alot smaller and sound alot better. going digital makes it easy to use a touch screen too instead of trimmers/pots.

    @mark i ordered my dacs and adcs when i didnt know what i was doing. i didnt even want audio stuff i wanted adcs for measurement tools 24bit res sounded nice had no idea they wouldnt make good chips for scopes etc till later..

    anyways thanks guys i will just look into more specialized cheaper chips for this. i just figured if the prop could play mp3s it would be able to do audio processing on them too
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-05-24 07:33
    Lots of folks do experiments on their favorite hardware, since its already on the desk, and determine whats going on and where bottle necks are, etc. Then, when they know exactly what they are looking for, find the exact hardware that fits that specific need. Using this strategy, you do most of your "research" work with existing equipment, and save the expense of buying the wrong hardware. Until you determine exactly what you want through your experimentation, you are pretty much guaranteed to purchase something that is not an ideal match for your as yet unspecified needs. Premature purchase tends to get one "stuck" dealing with what ever you bought, and you spend your effort forcing the wrong hardware to do other than its optimal application. The prop is ideal for this, since you already have it there is no additional expense or learning curve, and determining the props short comings will give a good perspective on what optimal hardware would look like.

    Unless you have unlimited time and money, use what you got, don't buy nothin' till you know what to buy.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-05-24 23:21
    Ok let me start by saying, Right now I have no job, hopefully that will change tomorrow, this means time isnt usually an issue. And as far as money ya that department sucks, but usually I just sample my chips and buy bulk passives when I can afford them. I really want to get into the commercial kit buisness and eventually when Im making some cash get into the 100% open source educational side of this, and start teaching people what I have learned. My main goal down the line is a full prop micro with an OS as computers and programming are my first love, to me electronics is just a way to make tangible creations with my code and learn more about whats happening under the hood, so I can become a better programmer.

    Right now my main projects are a hi end prop dev board with superior OC capability and Bus speed. Ive been working on it like mad and am pleased with my protoboard version which is very rough, but close to meating some goals. Im really only being held back from finishing by lack of passive funds and really needing to learn a cad program, so I can try to etch a test board to show off for funding. Ive also decided to change alot of the orginal connector designs and shoot to release it with a 100% proto/quick start/hydra compatible fully loaded standard accessory board.

    Ok Im sorry im getting wayyy off topic let me get to the point. A while ago I stumbled on the cmoy headphone amp, because I needed an amp and refuse to pay the prices the audio industry sets, plus I obviously have better ways to spend the little money I have. So I ordered a few samples and bread boarded the thing out. I wasnt to happy with its performance driving ear buds off my phone, so I did alot of research and have come up with a superior amp design of my own that has alot more current. Iooking at the audio industry I figured hey I could sell this thing for alot more than prop gear its easy to make and if its well received should give me enough cash to start boot strapping my prop projects.. It also gives me a basis to start working on maybe a more hi end desktop amp with LCD driven by a prop, and it is also a good start to a higher end audio interface for my prop board.

    I would really like to do an EQ and use the prop the more I think about it. If it worked well in the high end desktop amp it could give the prop exposure to the blegh "audiophile" community and just be one more solid prop based project, maybe pave the way for someone to do a hi end mp3 player.. idk. Anyways like I said Im happy with my acuall amp sound and I think it will measure well when I get to the point of having someone test it. I think for the pocket amp I will just add some RC filters for low/mid/hi to keep size and mostly price down. This is entry level and adding a prop with adc and dac and going surface mount to make it pocket will definately require me to sell it for more than 50 bucks.

    As far using the prop to drive an LCD and digital button interface along with audio processing in a higher end amp wether it be pocket or full desktop, Im in love with the idea very much, I want one!! so im gonna design it ;). Anyways heres where the trouble rolls in. Like I said I dont know anything about audio processing code. I do know a prop can play wav's and mp3's though so I would think a simple DSP should be possible. I understand EQs are basically just boosting the gain of certain frequencys and thats how the RC EQs work so Ill have to figure out how to code this and will probably mainly use C since its what Im skilled with runs quickly and allows for more memmory. If anyone knows where I could start and just genrally learn how to code an interface to DAC/ADC's it would be appreciated. The second rode block is in the audio market alot of people sell dedicated usb DACs... so this would be competing with that crowd which kind of sucks but o well... Anyways Im no audiophile I like good quality loud clear music and belive in measurements and practical designs not esoteric crazy 3 channel grounding systems, or black beauty caps, tube amps. None of that Im out to design something thats practical with hi quality audio not something that is badly overdesigned with rediclous audiophool parts. This is where im hoping someone could help me pick an ADC/DAC that is practical with hi quality sound. I have these ADS1210 ADC's I sampled thinking I could use for a scope making a mistake braino pointed out. Im not sure if there practical or good.... Id like dip ICs, but i might live with SMT stuff for this, I have a feeling im going to need a well thought out pcb anyways and protoboard wont cut it here. They are a bit pricey... with screen and all id like to sell for 100 but would settle for 200... Basically I wanna know solid audio chips that work well with the prop that have low distortion and can accurately represnt lossless audio from 10hz-22,000khz at the cheapest price possible, preferably that have a through hole and smt design.

    Like I said im working away at my dev board and I really wanna earn a living off this stuff Im busting my a** to learn as much as I can. Right now the dev board is being held back becuase I need to get a real PCB and get some passive money togather to tweak it a little, Its almost there just need an interface polish some tweaks and maybe a switching 5vt regulator. If I can get some of these audio projects out there somehow I think they will be just the boost in income I need to start really getting my other stuff done. The audio community is just a much more massive market and amps are alot simpler and especially cheaper than micro computers with a full os, or even decently designed hi speed prop dev boards. Plus I love audio :)

    I have one more question acually if I were to set my prop up with one of the many scope projects out there, like TV scope or the one in duanes dougans index, would it be enough to make my own hi quality measuremants, along with a propely set up sound card audio analyser?
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-05-25 01:58
    ear buds off my phone

    One thing about audio to remember: The transducers are the weakest link. In this case the speakers, carefully check the earbuds. The audio can only sound as good as the speakers you are using.

    You can run a not so good amp into excellent speakers, and they will sound pretty excellent.
    You can run an excellent amp into not so good speakers and it will pretty much sound like Smile. Even after lots of fancy EQ and other compensation.

    Always use the best possible speakers (and mics). My $100 Sennheiser over the ear headphones sound noticeably better than my $700 5.1 surround system. There is a huge cost benefit to spending more on better speakers or in this case headphones. There may be earbuds suitable for playing guitar through, but I have not heard of any.

    Ear buds usually deliver the same performance as AM radio. They may claim 10hz-22khz, but that may be ... other than accurate.
  • Heater.Heater. Posts: 21,230
    edited 2012-05-25 02:13
    I concure. Anyone using ear buds is not paying attention to sound quality. Didn't we use to call them hearing aids when I was a kid?

    Where does this idea that a Prop can play mp3s come from?
    I'm pretty sure it's performance falls far short of that.
    I guess it has been done with the aid of an mp3 chip.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-05-25 03:24
    ok i dont wanna get to off topic here or start any audio quality fights.

    first things first, this whole project is for use with mp3 player computers etc, not guitars or other instraments.


    pive never heard seinheisers and dont have any headphones over 30 bucks. my buds are 10 dollar 108db 10-20000hz 16ohm sonys which i chose over way more exspensive ones after tryimg a few sets. i use to have a 2500 dollar car stereo with infinity amps and speakes it sounded incredible definately audiophile grade. my buds sound damn close to that except the bass obviously... but for buds they have good lows im pretty sure 10hz spec is right or there at least well bellow all the 20hz buds. i basically built this thing becuase i like to listen at concert volumes all the time (i know ima go deaf).

    as far as a good amp can sound like this and a bad amp with good phones can sound like that is a bit of a loaded statement. no amp is a good amp unless it sounds exactly like it source except louder. a good amp should never make a sound quality difference only a volume difference. now its true ur sienhiesers and my sonys are different set ups. but with a good transparent amp both should sound like they did when driven from the sourcr the only thing a good amp should need to adjust is the voltage gain. driving buds clearly is no easy task at 16ohm vs 300 ohm seinheisers. so if my design has enough current to drive buds massively loud with very low voltage than when the gain is adjusted to higher voltages it should be spot on. but maybe its not... idk this is why id like to do solid measurements or have someone like nwavguy(google him very intresing practical blog) do them with his hi end equitment and blind listening tests. the audio world is just to full of Smile and mystasism to not do measurements.

    in case neone reading is wondering my amp theoreticaly should be a very accurate low impedance amp. there are no resistors in the audio lines and one set of .22uf ac coupling caps. thats it. its a two stage design with the gain stage/input being two opamps in parallel to get alot of current rolling then an output stage with 250ma unity gain buffers..

    this was no argument and no hostility twords u braino, ur a good guy and i like u. this is just me ranting and stating the facts about amps after a month of wading through audiophile bs written by people who belive in voodoo like virtual 3rd channel grounds, its very frustratimg to be new to audio and wonder what caps are best.. it doesnt matter to much lol.
  • Heater.Heater. Posts: 21,230
    edited 2012-05-25 04:07
    rwgast_logicdesign,

    How right you are. Any discussion with "audiophiles" can easily tip over into a dog fight.

    Years ago I decided this is all psychological, some of my most wonderful musical experience have been produced via very poor equipment. It sounds very good and you have a lot of fun at the time and then you spend the rest of your life trying to reproduce that experience. Failing miserably as you forget it was the whole environment, physically, socially, mentally that produced that emotion not just the sound system.

    So yes, lets go with measurements as best we can. As long as you are using tube amps and klipschorns that is:)
  • RaymanRayman Posts: 14,827
    edited 2012-05-25 05:54
    Don't know if it helps or not, but we have a new, low cost VS1003 based sound card for Propeller...
    In addition to playing MP3 and WAV, I believe you can display and control equalizer functions...
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-05-25 06:50
    @ziicogi cant really tell if your pullin my leg or not with that last statement. tube amps (not in the instrument world) are awfull and holding back technology, which is shown by any realistic measurements. tubes are noisy impractical audiophile magic. im sorry if i was misinformed about the prop being able to decode mp3s. but if it can play wavs im sure it can serve as a simple dsp. i mean u can build an eq from a few simple rc circuits.

    @rayman i acually havent seen this do u have a link to the acual soundcard for the prop is it on ur site?
  • RaymanRayman Posts: 14,827
    edited 2012-05-25 06:57
    Hope to get it on the website this weekend... But, you can see the datasheet and other VS1003 boards at Sparkfun.com (where I bought the chips).

    (Actually, I suppose I have to make sure the boards work before I put them up for sale on the website.)
  • Heater.Heater. Posts: 21,230
    edited 2012-05-25 07:06
    rwgast_logicdesign,

    Don't worry, there was a smiley at the end of my last statement. I'm all for getting things to measure correctly.

    However I don't see how tube amps are holding back technology. So a few die hards insist on paying for hugely expensive, heavy, power guzzling amplifiers for whatever reasons they have. 99.999% of the world is getting on with it's solid state iPods etc and seems to be quite happy with it.

    Then again a half decent tube amp has noise and distortion levels low enough as not to be noticeable. Certainly less annoying than the obvious fizzing sounds introduced by low bit rate mp3s which a lot of people are happy with.
    ...but if it can play wavs im sure it can serve as a simple dsp. i mean u can build an eq from a few simple rc circuits.

    Not so. Playing a wav just requires fetching the samples from somewhere and writing them out to an ADC.

    Perhaps simple DSP. Thing is when you get into DSP you soon find you need a lot of multiplying. The Prop has no multiply instruction so soon you run out of processing power. Don't forget that a few simple rc circuits can actually being doing quite complicated stuff.
  • LeonLeon Posts: 7,620
    edited 2012-05-25 07:39
    The fundamental operation in most DSP applications is multiply-accumulate (MAC) which takes values from two buffers, multiplies them, adds them to a running total, and increments two pointers. The dsPIC I mentioned performs a MAC operation in one clock cycle. It has a 40-bit accumulator, so that precision is maintained. Other DSPs are similar.
  • RaymanRayman Posts: 14,827
    edited 2012-05-25 08:18
    The VS1003 has a DSP core... You can even program it to do custom things yourself...
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-05-25 08:55
    Le @leon, can u link to a model i searched the mc site and chose dspic by application, dsp. all the chips i saw werent released yet one model saod there was samples but no price. do i need anything over 16 bit? iv also been lurking xmos for a while and noticed u were a member maybe an xmos would be suitable for this? or is that overkill.

    what if i were to use the math chip in conjunction with a prop that parallax sells would the bus speed be to slow
  • Heater.Heater. Posts: 21,230
    edited 2012-05-25 09:15
    No to the external math chip. Getting data in and out is too slow.
    You mentioned the chip whos name shall not be mentioned here. Probably a good choice. Now we are all in deep trouble.
  • LeonLeon Posts: 7,620
    edited 2012-05-25 09:40
    An ideal dsPIC for audio applications is the dsPIC33FJ128GP802:

    http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en532298

    I've designed a little home-made PCB for it, see photo. Codecs and amplifiers can be interfaced on a suitable daughter-board.

    XMOS chips are overkill for this sort of application. They are ideal for high-end audio.
    1024 x 805 - 58K
    AP.jpg 57.7K
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-05-25 09:46
    No worries, I am of similar opinion on many points. After wading through the audio stuff for year, the bottom line is the speakers have the biggest impact on quality, every dollar spent on better speakers buys you more than every dollar spent on amps. I'm just saying the your $10 earbuds are going to be your limiting factor.
    as far as a good amp can sound like this and a bad amp with good phones can sound like that is a bit of a loaded statement.

    Actually, its an observation. Good speakers set the amp limit at "good", bad speakers set the amp limit at "bad", given the same amp. Speakers are the biggest bang for the buck, and easy to get right; but compensating for bad speakers with a more expensive amp is VERY difficult, that's all I'm saying.

    If I were to spend money on earbuds, these (or similar) would be on my list http://www.newegg.com/Product/Product.aspx?Item=N82E16826106241

    These headphones can probably make anything sound as good as it can http://www.newegg.com/Product/Product.aspx?Item=N82E16826106328 . These are best I need, as I cannot hear the difference between these and the $469 ones.
  • Mark_TMark_T Posts: 1,981
    edited 2012-06-14 03:37
    I've been recently revisiting the idea of using a Prop as a digital audio processor. I have to take back some of my scepticism that the Prop is underpowered for doing equalization of high quality digital audio, I made an assumption that multipole digital filters are intrinsic to the task.

    The classic analog "state variable" filter can be implemented digitally very efficiently(*) indeed (about 10 PASM instructions) and gives highpass, lowpass and bandpass outputs. By mixing these three outputs (two multiply-and-add operations) you get a pretty reasonable bass/treble circuit... So two multiplies per sample is all that's needed, ballpark of 100 instructions or 5us. 48000 sample rate stereo is about 20.8us, so one cog can easily do volume and tone controls I think.

    So I've now started to look at what it takes to implement an all-digital mixing desk with the Prop ;)

    (*) if you choose the parameter f to be 2^-n and Q=1.0. Basically the code is
         lowpass += bandpass ~> n
         bandpass += highpass ~> n
         highpass := input - lowpass - bandpass
    
         output := bandpass + treble*highpass + bass*lowpass   ' fixed point arithmetic
    
    Note that the unweighted sum of the three outputs equals the input, so you can get a totally flat response if treble and bass == 1.0
Sign In or Register to comment.