Showing posts with label Raspberry Pi 3. Show all posts
Showing posts with label Raspberry Pi 3. Show all posts

Using a USB Audio Device With a Raspberry Pi

Using a USB Audio Device With a Raspberry Pi

My previous tutorial on the Raspberry Pi, Using a Raspberry Pi as an AirPlay Receiver, made use of the device’s built-in 3.5mm jack for audio output. This, however, produces sound that is mediocre at best and if you’re wanting to use the Raspberry Pi for any amount of audio listening, it’s going to have to produce a better quality of audio. We’re not going to squeeze much more out of the built-in components so, in this tutorial, I’ll explain how to set up and configure a cheap USB sound card as the Raspberry Pi’s default audio output device, providing a better quality, and volume, audio.
This tutorial will follow on from my previous tutorial, Using a Raspberry Pi as an AirPlay Receiver. It will be expected that you have completed this tutorial and your Raspberry Pi is currently able to act as an AirPlay receiver, albeit with its built-in audio output.
Back in the good old days, most audio devices needed their own set of drivers and software to work. This often proved very frustrating for end-users and developers alike.
The reason for this is that many devices from different manufacturers actually use the same chipset, the physical components that make up the device. This is what the drivers and software are for and you’ll often find that a number of different audio devices from many manufacturers will use the exact same chipset, the only difference between them will usually just be the branding.
Nowadays, most modern operating systems and audio devices have no such requirements as most chipsets work to an accepted standard, and since most manufacturers will make use of the same small number of chipsets, providing widespread support is far easier. There are certainly a small number of more specialised audio devices that require additional software but any generic audio output device is usually just plug-and-play

Live mp3 streaming from audio-in with DarkIce and Icecast2 on Raspberry Pi

Live mp3 streaming from audio-in with DarkIce and Icecast2 on Raspberry Pi

As a response to my lastest article about Streaming audio with MPD and Icecast2 on Raspberry Pi, I was asked for some ideas about live streaming. I took the chance to plug in an usb audio device with microphone to RasPi and tried to get it working.

Update (2012/08/11): Added a step to update package version number and added "devscripts" to the list of suggested packages .
What you need to have
  • Raspberry Pi with Raspbian installed,
  • USB sound stick with an input device,
  • DarkIce to capture audio from the audio input and send it to Icecast2,
  • Icecast2 to distribute the audio stream. 

Darkice ogg buffer file darkice.cfg:commented out

Darkice ogg buffer file darkice.cfg:commented out in the config

Basically if you run Darkice for 3 hours you'll have a 3 hour ogg buffer file eating up your disk space even though pre-buffering only really requires 10 - 15 seconds of audio per client.

localDumpFile for some reason it's enabled in my configuration file.
I had assumed it was required for pre-buffering but looking at this again perhaps it wasn't needed.

commented out in my config

Darkice Starting automatically on boot

Darkice Starting automatically on boot

Recently I had to install darkice on Ubuntu 12.04 (and 13.10) and faced a problem many other users has: Darkice won't start on boot, Darkice won't start using "service darkice start/stop" method.

There was a few suggestions using cron and custom scripts.

I figured out how to do it natively, in Ubuntu-way and want to share my experience with community.

-------------------------------

So. There are few problems with Darkice startup script (/init.d/darkice) provided by package system.

1) It does not create Darkice PID-file on start.
2) It Does not delete Darkice PID-file on stop.
3) It fail to check whether process is running or not.
4) Darkice can not start on boot properly (even if startup script was properly modified).

-------------------------------

Simple To-Do list:

(changed files published at the end of this post)

Streaming to a SHOUTcast server with Pi

I've had a search around in the forums, there are people doing similar projects to what I am hoping to acheive, but in reverse and using the Pi as a server as opposed to an encoder.

What I'm looking to do, is using my Model B Pi (512MB Edition), capture audio from my USB sound card device, and stream it to a Shoutcast server to broadcast.

I've heard of "MuSE" however from what i've looked at, it appears more of a multi-track sound editor rather than stream encoder.

I could just be looking in the wrong place within the software, but I thought it's definately worth asking here, there's bound to be somebody who knows what to do.

How to Set Up WiFi on the Raspberry Pi 3

How to Set Up WiFi on the Raspberry Pi 3

The Raspberry Pi 3 comes with an on-board 802.11n Wireless LAN adapter, which means that it’s no longer necessary to purchase a separate WiFi dongle. It’s also quite a bit easier to set up. In this tutorial, I’ll show you how to set up WiFi from the command line or from the Raspbian desktop.


Starting Darkice automatically Raspberry Pi to stream

Starting Darkice automatically Raspberry Pi to stream

I have installed and configured darkice in Raspbian and it works fine if I run it with "sudo darkice". I want to run darkice automatically so I tried to run it via daemontools with the following steps but it is not working. please help.

 Starting Darkice automatically on boot
Starting Darkice automatically Raspberry Pi to stream

setup a Raspberry Pi to stream to Broadcastify using Darkice

setup a Raspberry Pi to stream to Broadcastify using Darkice

I am trying to setup a Raspberry Pi to stream to Broadcastify using Darkice.
I have followed the setup process outlined on this website:
The issue I'm currently facing is that I cannot get the service to work.
In /etc/init.d/darkice1 I have:

HOWTO - Ubuntu Darkice Configuration for Live Audio Feeds

HOWTO - Ubuntu Darkice Configuration for Live Audio Feeds

This HOWTO makes an assumption that you already have your input device, either mic or line-in configured as a capture device in the mixer and that your capture levels are high enough to get audio feeding into /dev/dsp (the OSS sound device).
In linux, your capture level is the level that will feed into the stream, this is where you wind up with either excessive hiss from too low an output from the scanner and too high a capture input boost or you can get distortion on the feed from too high a drive from the scanner ouput and/or too high a capture level drive.
I recommend a healthy level of output from the scanner/radio device and backing down the capture level to about 1/2 or until the feed is not distorted from the loudest level from the scanner/radio input device.

Raspberry Pi Broadcastify Script to alert feed owner to high number of listeners

Raspberry Pi Broadcastify Script to alert feed owner to high number of listeners

I've been running a feed for about a year. Most of the time, I'm under 20 listeners at a time. I had some event the other day where my listeners peaked at nearly 200. I wish I would have been notified at the time of the event so I could have added a feed alert or something...and potentially driven up the number of listeners further.

So I whipped up a python script to do just that. Here it is if anyone else wants to implement the same feature. This runs on a Raspberry Pi that supplies my feed.
 

Raspberry Pi 3 - Stream directly from a USB sound card

Stream directly from a USB sound card

  • Plug your scanner's headphone jack into the mic jack on the USB sound card dongle
  • Start alsamixer
pi@raspberrypi:~# alsamixer
  • press F6, choose the "USB Headphone Set" entry
  • press your tab key to select the "Capture" device volume control
  • use your "up arrow" key to adjust the level to it's lowest level possible (6)
  • press escape to exist alsamixer
  • run the following command to save the volume settings
sudo alsactl store
 

Install darkice with MP3 support on Raspberry Pi

Install darkice with MP3 support on Raspberry Pi

darkice-install-pi.sh
echo "deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libmp3lame-dev
apt-get source darkice
cd darkice-1.2/
./configure --prefix=/usr --sysconfdir=/usr/share/doc/darkice/examples \
--with-lame --with-lame-prefix=/usr/lib/arm-linux-gnueabihf \
--with alsa --with-alsa-prefix=/usr/lib/arm-linux-gnueabihf
make
sudo make install


Raspberry Pi - USB 2.0 I tried changing it to 1.1

Thanks for the tips... It was a problem with the USB 2.0 I tried changing it to 1.1 originally (by adding that 1 line) The problem was, I added it into a new line (not in the same line) So I guess that was the difference. The sound quality is great now!

My next problem is:
I have the script to trim all the dead sound from the recording and save it. The problem is that when you listen to the broadcast, the sound is never 100% silent. There is like a slight static. As a result, there is never any dead time to trim out. Is there a way to set it up so it either doesn't pick up that slightly static, or a way for the recording to trim all that out?


Scanner feed using Rasberry Pi

Scanner feed using Rasberry Pi

Just an update, running 2 simultaneous feeds successfully on one Rasberry Pi. No overclocking necessary, or slowing of the USB port necessary, and it's staying cool and happy. Running 2 Griffin I-mic USB cards with line inputs and it sounds great.

Just create 2 different config files each with it's own filename, (such as darkice-feed1.cfg) unique sound card inputs, mountpoints and passwords, ect.


audio input for my 1st feed:
device = plughw:1,0

audio input for my 2nd feed:
device = plughw:0,0

open 2 shells, then run the feeds like this:

sudo nano /etc/darkice-feed1.cfg
sudo nano /etc/darkice-feed2.cfg

How wonderful it was to shut down my Windows XP machine after running it 24/7 after all these years!


Broadcastify Radioreference feed

Are you trying to run a RR/Broadcastify feed? If so, a couple simple things to check for starters:

1. If the feed is presently being run from another computer, you will need to stop that feed before trying to connect with darkice.

2. In your credentials the mount point is show in Technical Details like this /1234567. When you enter it in the darkice configuration you need to omit the leading /


Raspberry Pi Broadcastify Build

Raspberry Pi Broadcastify Build

Raspberry Pi Broadcastify Feed Appliance
These instructions show you how to purchase and setup a completely self contained Raspberry Pi to broadcast a live audio feed to Broadcastify.com

These instructions have been verified and tested as working on a Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU. Also installed and working on a Raspberry Pi 3 Model B (1 GB RAM - 1.2GHz 64 bit Quad-Core CPU - built in 802.11n wireless).

BROADCASTING A FEED TO RADIOREFERENCE.COM / BROADCASTIFY.COM WITH A RASPBERRY PI MINI-COMPUTER

BROADCASTING A FEED TO RADIOREFERENCE.COM / BROADCASTIFY.COM
WITH A RASPBERRY PI MINI-COMPUTER

scannerfeed disk image For a limited time (basically until it is outdated) I am providing an image of the 4 GB SD card I am using in a Raspberry Pi to stream live scanner radio audio to Broadcastify.com

Please note that this image is being used on an original Model-B along with the other hardware listed on this site. It has not been tested by myself on any other models, but I do have a report that it worked fine on a Raspberry Pi 2. Also, it did work with either Ethernet or WiFi. It supports one audio channel (mono) and does not support alpha-tags.


This operating system is the "jessie" release and is up to date as of 05 Dec 2015.

Raspberry Pi streaming to broadcastify #1

Note that I have provided a working disk image for streaming scanner audio to Broadcastify.com which you can download. See this page.

Using a Raspberry Pi Micro-Computer for a Broadcastify Feed

This guide outlines the steps I went through to set up a $35 Raspberry Pi (RasPi) computer and “darkice” software to stream scanner audio to broadcastify.com. A companion guide covers recording and archiving the audio which can be done independently from the darkice streaming.

One benefit of doing this is the power savings. The RasPi uses about 5 watts. In contrast, the old laptop I was using to feed scanner audio used almost ten times the energy and put out a lot of heat. It also had a loud fan. I was paying $42 (US) a year in electric just to run the laptop 24/7. One year of running the silent and cool running RasPi will cost me about $4.40.

The Debian based Linux operating system that is used here is very stable. If you use an Uninterruptable Power Supply and if you have a good internet connection then your feed should have a very solid up-time.

What you need Raspberry Pi Model B with Raspbian OS, a USB sound card/stick connected to an audio source such as a public safety scanning radio and network connection with a second system for both setup and playback of audio. The USB Sound stick that I am using was only a couple of dollars on amazon.ca:

DTOL 5.1 External USB Audio Sound Card Adapter For PC Notebook 

Setting up your Broadcasting Station

Setting up your Broadcasting Station


This is the official Broadcastify.com Live Audio suggested method to connecting your radio and computer for a reliable and good quality audio feed. There may be other connection methods but some of them do not work reliably and may deliver poor results over time.

These instructions assume that the radio has a mono 1/8’ mini connector for the line or headphone output and the computer has a standard sound card with stereo 1/8’ mini connectors.

Best audio from the scanner to the computer is via a line or record output and with this use of correct cable types.

The radio will most likely have a mono 1/8” mini jack for either line (Record) out or headphone out.

Raspberry Pi streaming to broadcastify #2 disk image

Raspberry Pi streaming to broadcastify scannerfeed disk image

For a limited time (basically until it is outdated) I am providing an image of the 4 GB SD card I am using in a Raspberry Pi to stream live scanner radio audio to Broadcastify.com

Please note that this image is being used on an original Model-B along with the other hardware listed on this site. It has not been tested by myself on any other models, but I do have a report that it worked fine on a Raspberry Pi 2. Also, it did work with either Ethernet or WiFi. It supports one audio channel (mono) and does not support alpha-tags.

I have not modified this image in any nefarious way. Still, This image is provided "as-is" without any guarantees or warranty. I am not responsible for any damage or losses of any kind caused by the use or misuse of the software and I am under no obligation to provide support, service, corrections, or upgrades to the software.

Download a zip of the SD card image HERE. If you have trouble downloading the file it is also available in 34 parts with ten additional ".par" recovery files. All can be downloaded from HERE.