inimidi
Posts: 6
Joined: Sat Jun 04, 2016 3:05 am

Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 3:33 pm

Hello world,

I recently started on a research project in which we need to make a field recorder with wifi and some other sensors.

For the field recorder I have certain design criteria I would like to meet:

- It needs to be small. I want to build a few and give them away for people to use for several weeks. To make sure they are not a hassle to them I would like it to be relatively small. For this I was thinking on using a pi Zero W
- I want to capture surrounding sounds as well (making dynamic microphones less suitable)
- It needs to be stereo
- It needs to create at least CD quality audio

So far I have come to understanding there are three ways I can achieve audio in on a pi:
- Use a USB sound card or piHat (not preferable due to size. Furthermore, I haven’t found anything that matches the pi Zero W)
- Go the digital tour and use MEMS microphones that interface with I2S. Adafruit sells some ( https://www.adafruit.com/product/3421 ) however, upon looking up a movie with Ladyada she seems to need to shout at it from close range to get somewhat of an audio signal in; which is in conflict with my desire to let people easily record conversations and environmental sounds
- Go the ADC tour, which opens the hunt for a good adc. My latest find is: https://thepihut.com/collections/raspbe ... adc-pizero .

I am relatively new to raspberry pi and completely new to audio recording and was hoping for some pointers. Do you have experiences (and successes) with any methods as I listed above and mind to share some insights?

PiGraham
Posts: 2682
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 4:22 pm

[Edit]
Sorry, I see you want WiFi connection and other sensors so most of this is irrelevant.

You may particularly want to use a Raspberry PI for this and you may prefer a DIY project. Still, you should be aware of alternatives that will do the job and avoid hassles with battery power, long boot times, rugged construction, simple operation etc. There are lot of wheels to reinvent in a DIY device.

Jut about any mobile phone can record audio and almost everyone has one with them at all times. You probably don't get stereo, but most smartphones may support a USB microphone or other audio input device in stereo. Worth a look.

You could go for super cheap £2.50 voice recorder in a USB memory stick.
Image

For £40 (probably close to what a complete Pi Zero solution might cost) you could get something more serious.
Image

And there are any number of others at every price point to £100s

I think audio quality is mainly down to the microphone and a good one will cost significantly more than a Raspberry Pi.

drgeoff
Posts: 7447
Joined: Wed Jan 25, 2012 6:39 pm

Re: Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 6:51 pm

What exactly do you mean by "CD quality"?

Why exactly do you require audio recording and Wi-Fi together?

PiGraham
Posts: 2682
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 7:31 pm

drgeoff wrote:
Mon Sep 18, 2017 6:51 pm
What exactly do you mean by "CD quality"?
Typically that means
two-channel 16-bit PCM encoding at a 44.1 kHz sampling rate per channel.

https://en.wikipedia.org/wiki/Compact_disc

drgeoff
Posts: 7447
Joined: Wed Jan 25, 2012 6:39 pm

Re: Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 9:06 pm

PiGraham wrote:
Mon Sep 18, 2017 7:31 pm
drgeoff wrote:
Mon Sep 18, 2017 6:51 pm
What exactly do you mean by "CD quality"?
Typically that means
two-channel 16-bit PCM encoding at a 44.1 kHz sampling rate per channel.

https://en.wikipedia.org/wiki/Compact_disc
Yes I know that, but is that what the OP really needs or only thinks he needs?

yodakohl
Posts: 16
Joined: Sun Sep 27, 2015 6:43 pm
Location: Austria
Contact: Website

Re: Sound recording on the raspberry pi Zero W

Mon Sep 18, 2017 10:24 pm

You might take a look at my hat which will be coming up in january: https://nyumaya.com
If you are interested I can upload some recording samples including tests with USB-Mic dongles, google-aiy-kit and the Playstation Eye

inimidi
Posts: 6
Joined: Sat Jun 04, 2016 3:05 am

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 7:19 am

Yes I know that, but is that what the OP really needs or only thinks he needs?
The project revolves around making a device that allows people to capture their memories in audio format. I want access to wifi to be able to monitor user interactions as well as acquire the sound files without intervention in the field test. As well as some other electronics to explore new interactions and give the recordings meta-tags accordingly.

piras77
Posts: 148
Joined: Mon Jun 13, 2016 11:39 am

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 7:34 am

inimidi wrote:
Mon Sep 18, 2017 3:33 pm
- Go the ADC tour, which opens the hunt for a good adc. My latest find is: https://thepihut.com/collections/raspbe ... adc-pizero .
The MCP3424 they use does only permit up to 240 samples per second.

You might try an AD7705 breakout board. These are quite cheap, though the AD7705 has only 15 bits + sign.

PiGraham
Posts: 2682
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 7:49 am

inimidi wrote:
Tue Sep 19, 2017 7:19 am
Yes I know that, but is that what the OP really needs or only thinks he needs?
The project revolves around making a device that allows people to capture their memories in audio format. I want access to wifi to be able to monitor user interactions as well as acquire the sound files without intervention in the field test. As well as some other electronics to explore new interactions and give the recordings meta-tags accordingly.
Do you need battery power?

Have you considered making the sensor package with BLE microcontroller? That could be very low power (no need to recharge or change batteries) and provide data to a smartphone App for the meta tags, in addition so several useful sensors on the phone.

Another thought on the off the shelf audio recorders. You could convert sensor / tag data into audio and integrated it with the audio recording, either as bleeps or inaudible coding.

Long life on battery plus WiFi is something ESP8266 is very good for, either as a WiFi interface or as a microcontroller in it's own right.

Pi Zero is the lowest power Pi, but it lacks a real micro-power deep sleep mode so it doesn't last long on battery. That might be an issue for you. Do you need instant-on usability? Users could just turn it on from cold when needed but then you may have missed some sensor data and it may take too long to boot. You could look at Buildroot or Baremetal for fast booting.

inimidi
Posts: 6
Joined: Sat Jun 04, 2016 3:05 am

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 11:00 am

piras77 wrote:
Tue Sep 19, 2017 7:34 am
You might try an AD7705 breakout board. These are quite cheap, though the AD7705 has only 15 bits + sign.
I am more concerned about its sample rate rather than bit size; as it's only .5kHz, which will make the highest possible frequency I can record 250Hz if I am not mistaken? Which will make it unusable to capture speech.

sources behind my reasoning:
http://wiki.audacityteam.org/wiki/Sample_Rates
https://www.presonus.com/learn/technica ... -Bit-Depth

inimidi
Posts: 6
Joined: Sat Jun 04, 2016 3:05 am

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 12:56 pm

PiGraham wrote:
Tue Sep 19, 2017 7:49 am
Pi Zero is the lowest power Pi, but it lacks a real micro-power deep sleep mode so it doesn't last long on battery. That might be an issue for you. Do you need instant-on usability? Users could just turn it on from cold when needed but then you may have missed some sensor data and it may take too long to boot. You could look at Buildroot or Baremetal for fast booting.
About boot time

I found this:
http://www.samplerbox.org/article/fastbootrpi

Which seems to reduce time the pi needs to boot below 4s (if idle).
The only problem is wifi; some people state it takes roughly 7s to "boot" (is this the right term?).

My idea is to add a ATTINY85/84 with a watchdog timer, every time it wakes up it checks whether it is 4:00-4:30, if yes it provides power to the pi and sets one GPIO pin to high. The PI checks during boot whether this pin is high and only then boots everything required to use wifi to transfer data (I am not sure if a GPIO pin can be checked during boot).

I am also looking into the possibility on building my own Linux using Buildroot ( https://en.m.wikipedia.org/wiki/Buildroot ).

About battery life

Previous studies have shown that audio recordings people make to capture memory are seldom longer than a minute. So I am not to worried about power. What I was thinking to do is to have the pi wake up, for as long as the recording needs to be done and then stay on for about 5min's after it is done recording. In case someone quickly wants to snap something else, then that would be possible.


Other sources:
viewtopic.php?f=63&t=56413
viewtopic.php?f=63&t=178962
https://raspberrypi.stackexchange.com/q ... -boot-time

drgeoff
Posts: 7447
Joined: Wed Jan 25, 2012 6:39 pm

Re: Sound recording on the raspberry pi Zero W

Tue Sep 19, 2017 3:03 pm

inimidi wrote:
Tue Sep 19, 2017 11:00 am
to capture speech.
If capturing speech, the initial statement of requiring "stereo" and "at least CD quality audio" appears to be unnecessarily demanding, not just in terms of the digitising and storage but also of the microphone and its preamp.

inimidi
Posts: 6
Joined: Sat Jun 04, 2016 3:05 am

Re: Sound recording on the raspberry pi Zero W

Thu Sep 21, 2017 11:02 am

drgeoff wrote:
Tue Sep 19, 2017 3:03 pm
If capturing speech, the initial statement of requiring "stereo" and "at least CD quality audio" appears to be unnecessarily demanding, not just in terms of the digitising and storage but also of the microphone and its preamp.
The goal is to make a quality field recorder that can capture speech and ambient sound at high qualities. It is essential that the quality is as high as possible.

The engineer/design challenge I aim to address using this thread is not whether or not we should go for high quality audio recording. Rather I want to use our shared intellect to create a high quality and compact audio recording device that can interact with additional sensors and hardware.

piras77
Posts: 148
Joined: Mon Jun 13, 2016 11:39 am

Re: Sound recording on the raspberry pi Zero W

Thu Sep 21, 2017 11:30 am

inimidi wrote:
Tue Sep 19, 2017 11:00 am
I am more concerned about its sample rate rather than bit size; as it's only .5kHz, which will make the highest possible frequency I can record 250Hz if I am not mistaken?
How do you figure 0.5 kHz?

As far as I see it, the data sheet (Table 23. Input Sampling Frequency vs. Gain) tells that the sample rate is between 38.4 and 307.2 kHz depending on the gain (@ CLKIN = 2.4576 MHz).

On the other hand there seems to be only 240 samples per second on the MCP3424; which is on the device that you suggested.

PiGraham
Posts: 2682
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Sound recording on the raspberry pi Zero W

Thu Sep 21, 2017 11:35 am

inimidi wrote:
Tue Sep 19, 2017 12:56 pm
PiGraham wrote:
Tue Sep 19, 2017 7:49 am
Pi Zero is the lowest power Pi, but it lacks a real micro-power deep sleep mode so it doesn't last long on battery. That might be an issue for you. Do you need instant-on usability? Users could just turn it on from cold when needed but then you may have missed some sensor data and it may take too long to boot. You could look at Buildroot or Baremetal for fast booting.
About boot time

I found this:
http://www.samplerbox.org/article/fastbootrpi

Which seems to reduce time the pi needs to boot below 4s (if idle).
The only problem is wifi; some people state it takes roughly 7s to "boot" (is this the right term?).

My idea is to add a ATTINY85/84 with a watchdog timer, every time it wakes up it checks whether it is 4:00-4:30, if yes it provides power to the pi and sets one GPIO pin to high. The PI checks during boot whether this pin is high and only then boots everything required to use wifi to transfer data (I am not sure if a GPIO pin can be checked during boot).
OK, I guess 4-5 seconds is not bad, so long as you don't need to catch fast changing situations.

BTW you could use an audio shield or module on a low-power Arduino to record audio and there are various ways for Arduino to talk to WiFi. They start instantly in most applications. As far as I can see you don't need Linux or a Pi for this.

As for your gpio question, just read the gpio once the system is up and enable the wlan0 interface. It doesn't seem it would matter if it took 10 seconds or much longer for that to come up if It's just to upload the data once a day.

The Pi can know the real time from the network once it connects and can tell the watchdog to schedule a wakeup in 24 hours less current minutes past 4pm.

What sensor data will you be logging?

Have you worked out a battery charging scheme?

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 10 guests