GithubHelp home page GithubHelp logo

audiosense-pi's Introduction

AudioSense-Pi

AudioSense-Pi is a RPi HAT based on a TI's stereo codec.
It is Open Source Harwdare Association (OSHWA) certified with UID - IN000007

This hardware provides audio input capabilities to the RPi.
The codec connects to the RPi's SoC through the I2S Bus.

The codec chosen, allows interfacing multiple audio I/O to the RPi.

Multiple I/O? Yes!
The following devices can be connected through a 3.5mm jack

  1. Line-In: Plain old audio in from mobile phones, PCs, etc.,
  2. Mic-In: Connect a microphone
  3. Line-Out: Connect the output to a speaker
  4. Headphones: Connect a Headphone w or w/o microphones

Simultaneous Inputs? Yes!
It supports the following combinations

  1. Two stereo Line-Inputs and a microphone
  2. One stereo Line-Input and two microphones
  3. Two stereo Line-Inputs, a microphone and one mono line-input (with h/w hack)
  4. One stereo Line-Input, two microphones and one mono line-input (with h/w hack)

Simultaneous Outputs? Yes!
Audio output can be routed to the headphones or speakers (with additional hardware)

Hardware overview

Software overview

Using the ALSA System on Chip (ASoC) layer we write a machine driver for the HAT.
With the following changes a new sound card by the name audiosense-pi will appear

  1. A device tree overlay is added for hardware configuration.
  2. Changes to the configuration file (config.txt).
  3. ASoC machine driver, makefile and kconfig changes
  4. Minimal changes to the ASoC codec driver to handle deprecated APIs

Getting started with AudioSense-Pi

Fab

  1. Order the BOM
  2. Send the gerber files to your nearest fab house
  3. Assemble the board, it should look something like this..

Assembled Board

Preparing the SD card

We have three ways to setup audiosense

  1. Get the prebuilt images, flash it into a SD card, fly away!
  2. Stay with the existing image you have, build the kernel yourself and flash only the kernel image
    • Pull the raspberry pi kernel source
    • Use this script to build and flash the kernel image to the SD card
    • Edit/add the following lines to the config.txt in the boot partiton of the SD card
        # Uncomment some or all of these to enable the optional hardware interfaces
        dtparam=i2c_arm=on
        dtparam=i2s=on
        dtparam=spi=on
        
        # Uncomment this to enable the lirc-rpi module
        #dtoverlay=lirc-rpi
        
        # Additional overlays and parameters are documented /boot/overlays/README
        dtoverlay=audiosense-pi
    
        # Enable audio (loads snd_bcm2835)
        dtparam=audio=on
    
    • Boot the pi, run the command aplay -l you should see a new soundcard audiosense-pi
  3. Get a kernel image that you want, merge the patches manually, build and flash the kernel image (for advanced kernel developers)
    • Clone the kernel sources you want
    • Apply the patches in the software directory (git am might not work owing to the large number of changes among the trees)
    • Use the script in step 2, apply the config.txt changes and boot the pi

Configuring the soundcard

  1. Open terminal, type in alsamixer. Hit F6 and select audiosense-pi from the list of soundcards Soundcard selection
  2. Soundcard widgets and control settings
  3. Plug in an audio-input to the board, a headphones and run arecord -D hw:1 -c 2 -r 48000 -f S16_LE | aplay -D hw:1
  4. If you did everything right, you will be listening to your favourite song ;)

License Information

Hardware licensed under the CERN Open Hardware License version 1.2
Software licensed under the GNU GPLv2
Documentation licensed under CC0 1.0 Universal

audiosense-pi's People

Contributors

b-ak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

duslabo danriches

audiosense-pi's Issues

Playback not working, getting input/output error

I have acquired a Raspberry Pi 3 Model B+ in order to test. Unfortunately, I am still having no success getting audiosense-pi to work. :-(

I am trying to use Linux raspberrypi 4.19.118-v7+ #1311

If I have headphones plugged in when I power it up, I hear a pop, and power light is on, so it is at least getting power.

Following settings are in config.txt:

dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

# Additional overlays and parameters are documented /boot/overlays/README
dtoverlay=audiosense-pi
# Enable audio (loads snd_bcm2835)
dtparam=audio=on

I see devices like so:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: audiosensepi [audiosense-pi], device 0: TLV320AIC3204 Hifi Audio tlv320aic32x4-hifi-0 [TLV320AIC3204 Hifi Audio tlv320aic32x4-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

When attempting to play audio file, I hear nothing in headphones and get error eventually:

$ aplay -D hw:1 archer-theme-song-16bit-pcm.wav
Playing WAVE 'archer-theme-song-16bit-pcm.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: pcm_write:2053: write error: Input/output error

Any suggestions what issue could be or how to troubleshoot?

RPi4 GPIO 26 - Reset

I have followed the instructions but GPIO pin 26 is set to an INPUT rather than a HIGH OUTPUT to bring the codec chip out of reset.

This means that nothing works!

Any ideas?

No audio on PH and Line output

Hi.
My hardware: RaspberryPi 4/4GB with latest Raspbian kernel 4.19.

DSC_5867

I have two AudioSense-Pi that I have assembled myself.

2019-09-26-214824_1920x1080_scrot

I added all necessary entries to /boot/config.txt:
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtoverlay=lirc-rpi
dtoverlay=audiosense-pi

My problem is that there is no audio signal on both headphone and line outputs.

Test i did:

2019-09-26-225442_1920x1080_scrot

1: ffmpeg -i Downloads/1kHz_44100Hz_16bit_30sec.wav -af "pan=stereo|c0=c0|c1=c0" -ar 48000 -f alsa hw:1,0

2019-09-26-225550_1920x1080_scrot

No audio output! I noticed that "time" increases every two to three seconds and "speed" drops from 0.99 downwards v. fast...
It's the same for both PCBs
Perhaps something is wrong on the PCB, but all the elements were new and I tried to assemble them very carefully!
I'm sure raspbian os recognizes AudioSense-Pi correctly. I carried out the test by giving an audio signal to the LineIn input and switched "Bypass" - HPL / R Output Mixer IN1L / R
2019-09-26-230947_1920x1080_scrot
2019-09-26-230953_1920x1080_scrot
I heard on the headphones what was on the line input... I2C is working...
OK.
For today I have to finish ...

Maybe someone has an idea where is the problem ....?
Or maybe someone already had such a problem ...?

By

RPI4, latest kernel, i2c10

Hi

I have a custom board using i2c10 as I need to use the serial port using i2c1 pins.

So I will have to recompile the overlay file but cannot find the original dtb file.

Can you help?

Thanks

Andy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.