Category Archives: audio

Olympus LS-10 remote control success

I’d experimented with the wired remote for the Olympus LS- series recorders before. I have an Olympus LS-10 and an LS-14, and previous experiments showed I could make this work in principle. There’s a big gap between making it work on the bench and getting it to work in the field, however. This is the next step of boxing it up and making it stand alone.

16F628 PIC is fitted into the space of two batteries in a 4-way battery box, giving me a small box with battery holder and on/off switch. A 32kHz watch crystal gives an easy integer divide down to seconds and then hours, and reduces the power drawn by the PIC and lets me drop down to 2V Vcc and stay in spec over the industrial temperature range.

Either my LS10 is knackered or it never was compatible with Olympus’s wireless remote, it doesn’t provide 3.3V power on the plug tip, so I have to power the PIC 16F628 from two NiMH cells, which means I am short of headroom for 3.3V because there’s a 0.9V difference. I’d expect the PIC to drag the remote control line, which rests at 3.3V down to ~ 3V (2.4V VCC + 0.6V input protection diode drop)

I used a diode for the stop command pulling to ground, which still works with that diode drop, so the drive circuit is

Driving the 3V3 LS10 from a 2.4V PIC

RA4 is an open-drain connection, I figured I would chance the forward-biasing of the input protection diodes via the 100k. It works fine, at least at room temp – a 100ms pull to gnd via RA4 starts the recording, and then a 100ms pull to ground of RA2 stops the recording. Pins are switched to hi-Z inputs when not active. I guess the 3V3 from the LS10 has to go through two diode drops now to get to the 2.4V rail (diode shown and the input protection diode), and this is enough to let it float OK.

I got it to start the recorder at 4am, which is too early, but recording for two hours got me this recording at about 5:30 am of the local birds. I hear Great tit, Robin, Blackbird, some sort of gull, Wren, Woodpigeon, Crow, in that lot.

Using a 3.5mm socket as a workaround for the fiddly 4-pole 2.5mm jack plug – it’s a lot easier to wire a socket than a 4-pole plug, and I got a 4-pole 3.5mm jack to 4-pole 2.5mm jack cable from Ebay. Wiring the 4-way socket is dead easy now, and saves having a flying lead from the box.

In search of microphone weatherproofing ideas

I need to now find a way to get a reasonably weatherproof microphone. Looking at how B&K do this in the manual for the UA1404 the way to go is to use a small raincover just over the mic capsule

B&K’s solution to weatherproofing

Their mention of birds makes me thing this is very close to a mesh nut feeder – I could put horticultural fleece around the mesh and use the top cap as a rain guard. Another option is to go minimalist, recess an omni electret capsule in something like a plastic bottle cap. I’d have thought that the cavity of the raincover would cause dreadful resonances, but if it is say 2cm diameter that would be a wavelength of 330/.02 ~ 16kHz – perhaps theirs is 0.5cm keeping this down to ¼ wavelength. Where this would score is it’s small, and electret mic capsules are cheap so I could afford to lose some. I can take the line that I’ll omit the big foam guard and use a piece of horticultural fleece across the cap, this makes a reasonable wind baffle, and I’m not going to get a good recording if the wind is over 5 mph anyway because of the hiss of the wind in the trees even if I were to keep wind blast out of the mics.

I am thinking of using a small Dribox to rig the recorder and timer, and sample some birdsong from other places. A pair of AAs run the timer for at least three days and the power drain of the LS10 on standby is also low, probably good for a couple of days, but I don’t have more than four hours of recording time on the LS10, it is 2Gb. So I can live with that – the Dribox has enough room for a bigger battery if that starts to look necessary.

Skytec PRO 600 PA Amplifier repaired but bad design can’t be fixed

tl;dr – to fix the problem throw the Skytec Pro 600 away and buy something better before the Skytec blows your speakers again. Don’t buy Skytec, and if you have it throw it away before it fails on you.

Skytec is cheap rubbish made in China for kids who are wannabe DJs but have little money. This is not quality – I had to repair this amplifier because of a fundamental defect in the engineering design. These are fine for background music, say in a pub. They’ll go reasonably loud in a modest party setting ,say 30 people, but it’s rough, and it’s nasty. You’ll save on the amp and pay in bass drive units if you DJ with this at any scale 😉 And get a limiter if you can, but if you can afford that you won’t be down at the Skytec end of the market.

I made the dumb mistake of buying one of these used from Cash Converters for £30 a while back. I bought it purely on price, I wanted something basic for parties of about 30-50 people. I knew nothing about PA, but I figured a hifi amp wouldn’t cut it for that sort of usage. What I hadn’t anticipated was people shift junk onto the PA market with design defects that were solved in the 1970s. They don’t even need any new parts, just put the Vbe multiplier on the heatsink rather than on the circuit board.

Skytec 600s are sold as 600W and the manual claims 600W output. They are absolutely away with the fairies on that, to the extent they should be done under the Trade Descriptions Act. I guess they hide behind the fact they don’t say RMS power, so they probably mean peak power, though that’s still only 280W. I measured 80V p-p, which is about 28Vrms. Run that into 4Ω and you’ll get V²/R≈200W. Do that for any length of time and it will blow because of the inadequate heatsinking and bad thermal design.

about 80Vp-p (I am using 10x probes) into 6ohms, 130W per channel. Don’t do it for too long, though

HiFi tower talk glowingly about the MOSFETs

Skytec’s PA-600 gives you the extra power you need with exceptional bass. All sound components are co-ordinated carefully and captivate their longevity. The modern MOSFET transistors and extra large power transformers give great sound and dynamics. The high build quality makes it the ideal amplifier for tours and gigging. For use on stages, for DJs, monitoring, parties and conferences.

but there ain’t no MOSFETs in this, simply a pair of paralleled bipolar junction transistors in the complementary pair output stage, 2SA1941 and 2SC5198. Toshiba described the transistors as suitable for 75W amps, you have two in parallel so 150W tops, okay times two for stereo = 300W. The toroidal transformer isn’t over 600W, I’d guess 200W from the size.

It worked OK for me for a couple of years, but then I let someone use it unsupervised for live music. Which brings me to the first warning

Do NOT use the Skytec 600 for live music unless you are aware of the risks you are taking!

I wasn’t, there, and the result was a blown output stage and blown woofer. It only cost me £11 to service the amp and £50 to change out the woofer, so I am now down £91, and I still have a junk amplifier, though it works now. Now that I know the ghastly horror of the circuit design I am not sure I have the balls to use it again, but at least it works as it was meant to originally 😉

Why not for live music then?

After all, the promotional blurb says this:

The high build quality makes it the ideal amplifier for tours and gigging. For use on stages, for DJs, monitoring, parties and conferences.

so what’s the problems then? Dynamic range – live music has a higher peak to mean ratio than recorded music. You end up pushing the bugger harder, so unless you limit the live source in the mix you’ll clip the output. At least that’s what I assume happened, I wasn’t there when It failed 😉 The Skytec is fine for prerecorded music, but the basic problem is that this amp has zero protection for the speakers or the output stage. Worse still, the VBE multiplier that biases the output stage isn’t thermally coupled to the heatsink on the output stage. Let’s hear it from Rod Elliott why this sucks

Thermal Stability

It can be seen that in the Darlington configuration, there are two emitter-base junctions for each output device. Since each has its own thermal characteristic (a fall of about 2mV per degree C), the combination can be difficult to make thermally stable. In addition, the gain of transistors often increases as they get hotter, thus compounding the problem. The bias ‘servo’, typically a transistor Vbe multiplier, must be mounted on the heatsink to ensure good thermal equilibrium with the output devices, and in some cases can still barely manage to maintain thermal stability.

If stability is not maintained, the amplifier may be subject to thermal runaway, where after a certain output device temperature is reached, the continued fall of Vbe causes even more quiescent current to flow, causing the temperature to rise further, and so on. A point is reached where the power dissipated is so high that the output transistors fail – often with catastrophic results to the remainder of the circuit and/or the attached loudspeakers.

I got to find that out the hard way. I’ve actually managed to do a fair number of parties with this fine, but I was always careful to keep the bouncing LEDs of the output display under control by controlling the master gain.

How does the Skytec PRO600 do thermal stability?

On a wing and a prayer.

PC case fan blowing on the internal heatsink

They run a PC case fan 100% of the time  onto the main heatsink, sucking air out of the case, inflow is through the front. There’s no margin for error – although I didn’t trace the circuit it’s a complementary pair of paralleled output transistors driven by a driver (effectively making a Darlington output)  so you got four VBE drops reducing with temperature at 2mV/deg C, asking for thermal runaway. There’s no fight against that with the VBE multiplier because it’s not thermally coupled. Get the die temp of those output devices hot enough, say 40C above ambient and you have 40*2*2 = 160mV less bias than you started with (the drivers are conveniently mounted on the heatsink to make sure their VBE drops too).  This is designed for thermal runaway and the only thing standing between you and a blown output stage is the hope the heatsink and the fan keep the temperature rise down. You can get a little bit of an idea of the architecture from this thread and this PDF of a similar noname PA amp which gives a rough idea of the architecture on the output

Schematic someone has traced out of a similar piece of junk. In my case the four o/p transistors are 2x 2SA1941 (BG7,8) and 2x 2SC5198 (BG 9,10). BG4 is the offending Vbe multiplier that isn’t on the heatsink.

How to fix a Skytec 600 blown output stage

Change the 2SA1941 and 2SC5198 transistors 😉 I buzzed these through with a DVM on diode setting and found them all short, traced back to the drivers expecting them to have gone but they were OK, traced back a further stage of BJTs but they were OK too. The 5A fuse saved the other passive components.

It’s quite repair-friendly – unscrew the three screws on the base holding the heatsink, unplug all the connectors after taking a photo to remember where they go back. Lift the PA module out, snip the duff transistor legs to save the PCB while desoldering the pins one at a time.

snipping the duff transistor legs lets you unsolder the legs one at a time, saving the PCB from overheating.

I powered up the repaired stage on a 30-0-30V bench power supply set to limit at 100mA, I know it’s meant to work off 60-0-60V but I got a signal through and confirmed it wasn’t still duff, before getting it onto the main supply. I also compared the quiescent current (10mA at 30-0-30V)  with the good side, which was the same, so I figured the VBE multiplier was still set about right. Easy win for about £11 in parts. In fact one of the old output transistors was still okay, presumably saved by it’s parallel buddy shorting across it, but I’m not chancing it.

I also went round and tightened the output transistors a tad. It’s easy to overdo this, but the still- working side was about finger-tight like the failed side. I wonder if this also led to the early demise. You just can’t risk the transistor die heating up to any great amount with this design.

Having fixed it I started to test it looking for why it blew. I got a couple of 50W 6Ω wirewound resistors. These are sold on Ebay to people doing LED upgrades to their lights, to put in parallel with the LEDs and draw 24W so the automotive CAN bus filament blown detector doesn’t keep going off. I figured 6Ω is a nice compromise between typical 8Ω and 4Ω speaker loads; real speakers present complex loads anyway. It was the cheapest way of getting a power resistor up to the job. I then dunk the resistors in a pan of water.

Low cost high power load

since I don’t have a heatsink/fan combo up to dissipating 300W. I know electricity and water don’t really mix, but I figure the water isn’t going to shunt my 6 ohms too much. Worth heatshrinking the ends of the resistors though 😉 The reason I used a pan is because the failure mode of these type of power resistors is to violently eject the ceramic slug out the end. So a Pyrex dish or a jam jar isn’t really desirable.

Running both channels full tilt at 130Wpc for two minutes the transistors get up to about 50C at the hottest part of the plastic case. If fairness to the amp I’ve been able to fill a rented Scout hall with music without ever taking it up that high even on peaks, so I ran it for five minutes at 33 watts per channel (~40V p-p). And got the transistor cases up to 110C. The manufacturer’s spec for the junction temperature is 150C peak. If you thrash this like that for a long time I guess  the heatsink/case fan combo is hopelessly inadequate, and it blows.

Sadly I battle tested the inadequacy of the design a second time. Five minutes after running the second test, after I had brought the signal down to 0, I was greeted with this, telling me the right hand channel has gone DC, presumably thermal runaway again.

failed again

While I know how to repair this, I don’t know how to fix it to make it fit for purpose because of the fact the Vbe multiplier isn’t on the heatsink. It’s probably true that my needs don’t push it that hard, but an amplifier that blows after running a steady 33W for five minutes isn’t something I’m going to risk ever using, so it’s time to scrap it.

Skytec Pro600 – Avoid. Just say no.

Olympus LS10 and LS14 DIY wired remote control

tl;dr – the schematic

Olympus LS10 (and LS14) wired remote schematic

Olympus LS10 (and LS14) wired remote schematic

A new approach to a timed recorder

For the last year or so I’ve been trying to make an timed start recorder using a Raspberry Pi and the Wolfson/Cirrus audio card. I was able to make it work, but never eliminate some rattiness in terms of overruns on record – I confess I couldn’t hear them, but it didn’t give me a good feeling. Then I added up the costs –

£25 – Cirrus Audio card
£27 – Raspberry Pi B+£10 – case and odds and sods to make it work
£20 – PCB, time and bits to make a preamp to get from mic to line level

so I’m looking at £80 to get off the ground, and that gives me a seriously power-hungry SD audio recorder, although I can use a timer to save the power drain for active service.

Alternatively, if I could crack the remote control for them I could go on ebay and get a secondhand Olympus LS10, or one of the similar models (LS-5, LS-11, LS-12, LS-14) and use my own LS10 to start with. I can feed a mic straight into the LS10, no extra preamp required and the audio spec is good.

Reverse engineering the Olympus remote control protocol

This cost me £90 on ebay, and it turned out I didn’t need it. You get the info for free, but then I got a natty nearly new LS-14 with an RS30 remote control, so I’m not too unhappy. Unfortunately the RS30 doesn’t work with my Olympus LS10, don’t know why. I’d have been hacked off if I’d just got the RS30 1. Works a treat with the LS14 it came with, on their own  a RS30 seems to go for £50, so I got an okay deal.

my Olympus recorders

my Olympus recorders

Google first – I owe dashanna of the naturerecordists’ list for inspiration, I vaguely recall seeing that post go through on the list. Their solution is this

1610_dashanna

The connector is an evil little 2.5mm four-pole jack, and these are a bear to solder

nasty connectors to solder, though easier when you realise you only need t wire to two parts. You can pick up 3.3V on the tip, which may be of use...

nasty connectors to solder, though easier when you realise you only need to wire two parts. You can pick up 3.3V on the tip, which may be of use…

I can’t help wondering if life would be easier using a three-pole jack, since only sleeve and ring are needed. Now I didn’t like that battery in dashanna’s version – I mean who the heck would make a wired remote for a machine offering you a 3.3V supply on the tip of the plug and demand you go fit a battery in your remote? It’s just not a clean engineering solution at all. But apparently it works.

So I rigged the cable in series with the RS30 and sniffed the signals. Of the TRRS the tip had 3.3V, the second ring seemed open circuit, the first ring had the wanted signal and the sleeve was ground. Presumably the IR receiver and LED driver are powered off the 3.3V on tip. The signal on the first ring rests high at 3.3V.

Record is this funny little signal

Record is this funny little signal, 100ms at about 1.5V followed by a low

Stop is this signal, pull to ground for 100ms

Stop is this signal, pull to ground for 100ms

In practice you can ignore the second pulse. For all I know it could be an ack back to the receiver to light the LED. I tried using a couple of diodes to pull the signal down to 1.2V but that didn’t initialise record. I then figured this is one of those analogue resistor chain remotes, so I look for what resistor would give me ~1.5V. Turns out if you replace the 1.5V battery in dashanna’s schematic with 100k you get about 1.5V and the recorder starts recording. You don’t need the second pulse at all, and the debouncing seems to be done in the recorder, it takes a little while, up to about half a second to start recording. I guess that means inside the recorder there’s a 100k resistor to the 3.3V rail in series with the first ring.

That works with both the LS 10 and the new LS14, although the RS30 only works with the LS14. So now all I need do is mod the timer to pull down a couple of pins, one through 100k. If I make the stop command the open-drain pin to ring and the rec command a normal pin resting High via 100k to ring, and pull the relevant pin down for 100ms I should be good to go.

 

 

Notes:

  1. I’ve just got onto the Olympus RS30 website and if you scroll through the models that is compatible with it includes the LS-3, LS-5, LS-11, LS-12, LS14, LS-20M, LS100 so perhaps my LS10 was never compatible with it and Olympus have changed their mind since writing the LS10 manual which says on p65 “Exclusive remote control RS30W (scheduled for Spring 2008)”

Timed Audio Field Recorder with a Raspberry Pi Cirrus Logic Audio Card

The problem is still the same as it was this time last year – the birds get up before I do in the Spring and I can only be one place at a time. Automatic recording devices let me scout locations in parallel.

A timed field recorder needs to be cheap, because somebody might nick it, it needs to be weather-resistant because it’ll be stuck outside, and it needs to be low-power, because 13A mains sockets are rare outside. Oh and it needs to be standalone, and not part of some cloud, because mobile Internet is ratty and expensive.

tl;dr the hardware performance is good but software support is dire. You can make this work but it isn’t fun at all. If you can use something like a USB stereo audio in board then do it rather than use this Cirrus Logic Audio Card, particularly if you have mains power available. I like the Behringer UCA202 and it works with the Pi

A Raspberry Pi and A Wolfson audio card sort of fitted the bill, but the Wolfson Audio card is no more. I say sort of, because I’m still looking at about £70 for a Pi 1, the audio card and enough odds and sods to power it. You can buy a Zoom H1 for about £80, although there’s still a bit more cost in powering it for long times, keeping the water out and making up some gizmo to pretend to be you pressing the big rec record button early in the morning.

But with the Pi I get to drive the recorder via cron and ssh, and transfer the files via the internet or mobile data in some places. Even if I don’t get a case, though they are to be had for the Pi/CL Audio card combination…

Continue reading

Notes:

  1. HiFi world clock it in at £220!

Audio Measurements and beyond rightMark

The goto program for audio measurement in the Internet age is RightMark Audio Analyzer (RMAA). It’s not an easy program to use in isolation, and is used best with some old-skool analogue technology. In particular, it doesn’t really do absolute level in any way – everything is referenced to 0dBFS.

RMAA testing is deconstructed by NwAvGuy here. His thesis is that it is impossible to use RMAA right. particularly if you have no experience of analogue electronics and no other test gear. And I’m guilty as charged of publishing RMAA test results on the internet 🙂

It saddens me a little bit that measurement has now become go out and buy £x,000 worth of test gear, plug it it, attach to D.U.T. press the button and report the result. And if you can’t do that, well, no Audio Precision test kit, no comment. I’m not dissing NwAvGuy’s observation – it’s the loss of other ways of testing audio gear I regret. I don’t test for distortion – I scan for it. That’s because I’m testing finished gear usually for how noisy it is with mics at low levels. If distortion/frequency response looks okay/reasonable with RMAA that’s great, if it doesn’t I look for what I have done wrong in setup. Most manufacturers get the distortion and frequency response basics right, but mic preamp noise does vary because most audio recording is music and therefore has plenty of signal, so preamp noise is not usually a key parameter in a field recorder.

BBC Designs EP14/1 audio test set - a tone source and a meter

BBC Designs EP14/1 audio test set – a tone source and a meter

Way back when I was working at BBC Designs, using their EP14/1 test set things were a little more from first principles than ‘press the button of this expensive gear and report back’. The EP14/1 was basically a tone source and a meter with a precision attenuator in front of it.The meter was used comparatively – you would adjust the attenuators to make it read the same as a reference reading, and the wanted information was in the different setting of the attenuators. This way any nonlinearity of the meter scale was greatly minimised. Continue reading

Testing the Wolfson Audio Board and Raspberry Pi

The trouble with birds is they get up earlier than I do, so a time-delay start recorder lets me scout locations without loads of early starts.Autonomous recorders are sometimes known as frogloggers in the nature recording community. Commercial variants and great, reliable, but dear. I want something I’m prepared to take the risk of losing to some inquisitive dog-walker, and preferably something I can make enough of to scout several locations.

A Raspberry Pi via Wifi is also a good remote startable recorder over WiFi . A bit like the Tascam DR-44WL but without the nice display. the trouble is the Raspberry Pi has no record facilty. If it had, you can start recording by logging in via SSH and issuing the arecord function. The audio can even be transferred off the Pi remotely via SFTP over WiFi. Enter the Wolfson Audio board – a piggyback audio card for the Pi, which takes over all the IO so you aren’t going to be running any other custom hardware on that Pi.

Installing the Wolfson

Physical installation is easy enough, the Wolfson board uses the bizarre approach of connecting to the GPIO using a standard header and the P5 header using a set of pogo pins. 1 I’d have been easy with soldering an extra set of pins or a header myself and this is probably a reliability hazard, but I’ll run with it for now. Just as well I’m not going to use the badly aligned yellow and white SPDIF sockets, eh?

I started with a Model A running a stock Raspbian image, 2014-06-20-wheezy-raspbian.zip and ignored Wolfson’s recommendation to avoid a USB hub, because I needed that to see what I was doing to set up WiFi.

bizarre use of pogo pins, it's a wonder these make enough contact for the board to work at all!

bizarre use of pogo pins, it’s a wonder these make enough contact for the board to work at all!

No standard Raspberry Pi Drivers for the Wolfson

Unlike other bits of hardware, to run up the Wolfson card you can’t use the stock Raspbian and do an apt-get install some-sort-of-wolfson-driver. You’re in for a world of hurt here.

You either download the SD card image which is recommended by Wolfson. It’s 8Gb and it means 8Gb, and wouldn’t fit on my 8Gb card, because it requires a card with no dead sectors presumably.

Maybe time to compile the drivers myself following this? Nope – life is too short and I do not have the skillz to firefight what goes wrong. And what with the takeover of Wolfson by Cirrus it looks like the drivers are delayed still more. I like the Torygraph’s opener

Wolfson Microelectronics, the struggling Scottish microchip company, has been acquired by its American rival Cirrus Logic for £278m.[…]
Wolfson has become increasingly reliant on a few big customers including BlackBerry, which as seen sales of its smartphones collapse.
The company reported flat revenues of $179m and mounting losses of $13m last year.
Wolfson admitted it had been blindsided by the rate at which consumers were adopting 4G smartphones, which gave Qualcomm an advantage because it had developed an all-in-one 4G microchip that included an audio processor.

Damn. Those drivers aren’t going to happen any time soon, or maybe ever… I then used Ragnar Jensen’s zip described in this post, and the usage instructions here to install it. Which worked for me. I have no real idea how.

Don’t get the Wolfson card if you want playback until there are normal drivers available

My only interest in the card is to record – everyone else seems to want to take advantage of the whizzy playback options. To be honest there are alternatives if you want playback only, and it looks like the product is at risk of getting orphaned, since it is Pi Model A or B Rev 2 only, not B+, and is still driverless. You run the risk of getting stuck on an old version of Raspbian. That doesn’t bother me, as I will only use this for recording and not run anything else exotic on the Pi. If you want to run a media centre then you could start to hate being stuck on older versions of Raspbian.

How does it record, then?

I made the mistake of firing up ALSAmixer after installing, it certainly showed a lot of options and stuff going on which gave me a good feeling that the Wolfson card was present. But it is easier to adopt their installed ‘use cases’ that are installed in /home/pi

./Record_from_lineIn.sh

then issue

arecord -c 2 -f S16_LE -d 10 -r 44100 record_from_line_in.wav

to record a 10 second stereo track from Line in (that’s the -d 10 seconds, -d3600 would do you an hour, etc)

I experienced random buffer errors every 30s or so. Mindful of Wolfson’s warning about USB hubs I removed the keyboard (which has a hub) though I still used a hub to power the device, and because this was a Model A I had the wifi on the hub, and still took overruns

arecord -c 2 -f S16_LE -d 130 -r 44100 record_from_line_in1.wav
Recording WAVE 'record_from_line_in1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
overrun!!! (at least 90.703 ms long)
overrun!!! (at least 50.601 ms long)
overrun!!! (at least 15.111 ms long)

Although it looks ghastly here is an MP3 of the original file that I played into the Pi –

and here is the file recorded with the overruns above, converted to MP3

Which doesn’t sound so terrible to me at all. I should still not be such a cheapskate and buy SD cards from ebay, if a Class 6 card is what’s needed for audio 😉

I still got overruns with FLAC but they were shorter, which points towards disk IO as being the problem, since FLAC ups CPU load a lot but reduces disk writing, because that’s its job

arecord -c 2 -f S16_LE -d 130 -r 44100 | flac -o test1.flac - --channels=2 --sample-rate=44100 -f

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
-: 23% complete, ratio=0.468overrun!!! (at least 20.023 ms long)
-: 69% complete, ratio=0.513overrun!!! (at least 0.553 ms long)
-: wrote 11620131 bytes, ratio=0.507

Using FLAC (free lossless audio compression)

you must apt-get install flac

to get the codec first

Pipe the output of the record chain into FLAC to reduce file sizes by about 40% on field recordings

 arecord -c 2 -f S16_LE -d 130 -r 44100 | flac -o test.flac - --channels=2 --sample-rate=44100 -f

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
-: wrote 11692886 bytes, ratio=0.510

with the flac command the single – means  process stdin and -f means overwrite existing file

FLAC used to be a resource hog so I thought I’d look at the CPU usage, which seems to run about 12-15% on a stock Raspbian (no overclocking etc)

top - 18:07:28 up  1:54,  2 users,  load average: 0.05, 0.04, 0.05
Tasks:  74 total,   1 running,  73 sleeping,   0 stopped,   0 zombie
%Cpu(s): 12.4 us,  2.3 sy,  0.0 ni, 84.9 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem:    187592 total,   145604 used,    41988 free,    14664 buffers
KiB Swap:   102396 total,        0 used,   102396 free,    98588 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
 2713 pi        20   0  7488 1380  940 S  12.1  0.7   0:03.71 flac
 2710 pi        20   0  4672 1372 1036 R   1.0  0.7   0:00.50 top
 2676 root      20   0     0    0    0 S   0.7  0.0   0:03.14 kworker/u2:3
   13 root      20   0     0    0    0 S   0.3  0.0   0:00.96 kworker/0:1
 2683 root      20   0     0    0    0 S   0.3  0.0   0:01.61 kworker/u2:0
 2695 pi        20   0  9260 1584 1000 S   0.3  0.8   0:00.12 sshd
 2711 root      20   0     0    0    0 S   0.3  0.0   0:00.18 kworker/u2:1
 2712 pi        20   0  4944 1336 1128 S   0.3  0.7   0:00.19 arecord
    1 root      20   0  2148  720  616 S   0.0  0.4   0:04.29 init
    2 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kthreadd
    3 root      20   0     0    0    0 S   0.0  0.0   0:00.46 ksoftirqd/0
    5 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kworker/0:0H
    7 root      20   0     0    0    0 S   0.0  0.0   0:00.75 rcu_preempt
    8 root      20   0     0    0    0 S   0.0  0.0   0:00.00 rcu_bh
    9 root      20   0     0    0    0 S   0.0  0.0   0:00.00 rcu_sched
   10 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 khelper
   11 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kdevtmpfs

Wolfson Card Analogue Line-up

So it’s time to line the card up and find out what analogue levels it takes. I’m going to need outboard audio processing anyway to bring mic level up to line level, and to be honest that’s probably better done off the board anyway away from all the digital power-supply sizzle. I can control levels in the analogue domain, so no need ot run alsamixer unless I want to do remote live recording.

I injected 1kHz tone from a Farnell Wien bridge oscillator ad found that the default gain setting is exactly right for a 1V rms input

1V rms exactly...

1V rms exactly…

on a scope, not the readout is 10x too low because I used a 10x probe

on a scope, not the readout is 10x too low because I used a 10x probe, so that’s 2.8V p-p or 1.4V peak

When I ftp the file to my PC and look at it with a WAV player I see it is as close to 0dBFS as you can get

You aren't going to get closer to 0dBFS than this without clipping

You aren’t going to get closer to 0dBFS than this without clipping

The audio doesn’t start recording instantly, there is an elegant fade in combined with an inelegant DC shift

Audio fades in softly over a short period

Audio fades in softly over a short period

It isn’t a big deal, but you probably want to start it .1s before the desired sound. That’s neither here nor there with a manual start but if auto-started from a sensor trigger that would be a bear.

Audio performance

I terminated both inputs with 150 ohms and used Audition to gather the stats on silence, starting 3s in, a reasonable way past the initial DC bump.

internal noise stats. I'm not going to complain about this

internal noise stats. I’m not going to complain about this

I then scanned the spectrum of the quiet recording to look for any frequency spurs etc, on a fairly narrow IF bandwidth (wide scanning window). I’m not going to argue with the results –

Can't really argue with that

Can’t really argue with that

For reference here is the 1kHz tone (if you analyse it all the distortion comes from my 1970s era Wien Bridge oscillator)

and here is the quiet recording

I didn’t run rightmark on it since I don’t have anything good enough to generate the test signal and don’t know how to play and record at the same time on the Pi.

Since I want this for recording I didn’t bother to test playback – here’s a description of replay.

Time delay recording

The way to use this as a time delay recorder is to set cron to start on boot:

shutdown -h -t 3700

and

arecord -c 2 -f S16_LE -d 3600 -r 44100 record_from_line_in.wav

Then power on the Pi and the microphone preamplifier about half an hour before dawn and pull the power after about an hour and a quarter – the Pi should have halted by then. I will use a PIC microcontroller for that job, because it draws a very low power in the rest state, but an Arduino would work too, though it’s typically 7mA drain is higher than it has to be.

Conclusion

The Wolfson audio card records well, with low noise. You need to use a fast SD card otherwise you will get overruns. But it is poorly supported and the devil’s own job to get going. However, it seems the only game in town for high-quality recording.

Since that’s what I want to go I have to put up with the poor support and idiosyncrasies, it works well enough.

 

Notes:

  1. I did have trouble with these once – what happens is you issue the record for x seconds command and in simply sits there and never times out. Then you press the GPIO down again and it comes good… P5 carries the i2c bus  SCL0 and SDA0 pins which control the Wolfson, lose contact on one of those and you aren’t talking to it any more.

Raspberry Pi Soundcard From Logitech Headset

The Raspberry Pi has no audio input, and I had a pair of Logitech USB headphones that had gone faulty – the earth on the headset was a dis. The USB part seemed to work, but headphones live on borrowed time, connectors and wiring tend to go, and everything is sealed, So I wondered if I could reuse the circuit board as a Pi soundcard. Stereo output but mono on record, of course, but still useful. It’s all part of experimenting to make a low-cost audio field recorder that can start by itself. Nothing is designed to be repairable here, so the plastic USB module case was pinged apart with a flat-bladed screwdriver. Initially I wondered if the black stuff was a blown capacitor, but it was on both sides of the board so I figured it was probably glue from the connector, which was confirmed when I unsoldered the connectors, it came off like a gluey film.

Logitech A-0365A USB headphones control board

Logitech A-0365A USB headphones control board

Headphone cable uses fine strands of individually enamel insulated wires wrapped around a synthetic fibre core. The good thing about this is your headphone cable breaks later than if you used normal multi-strand audio cable, given all the flexing it has to take. The bad thing about it is it’s the devil’s own job to solder, because as you heat the strand the synthetic coating melts, robbing you of heat and re-insulating the enamel you’ve burned off. So I unsoldered the existing cable and threw it out, and soldered a stereo jack plug for the headphones and a phono line socket for the microphone. I then extracted the original microphone capsule from the headset and soldered it to a phono socket just to test this out in the original circuit conditions. Continue reading