stopsoftwarepatents.eu petition banner
  • Login
Site map
  • about
  • documents
  • homebrew
    • linux media system
    • car audio
    • wireless printserver gateway
  • howtos
  • legacy
  • patches
  • playground
  • repository
  • software
  • tips and tricks
  • user
  • wiki
Table of Contents
    • My Car Audio System
      • Problems and Solutions
        • Unit needs adaptor to connect to the wheel commands/dashboard display
        • USB connection doesn't provide enough juice to connect an external 2,5" hard drive.
        • Managing ACDrive in Linux
Buy me a BEER
  • Recent changes
  • Source
  • XHtml
Table of Contents
    • My Car Audio System
      • Problems and Solutions
        • Unit needs adaptor to connect to the wheel commands/dashboard display
        • USB connection doesn't provide enough juice to connect an external 2,5" hard drive.
        • Managing ACDrive in Linux

My Car Audio System

Some time ago, while looking for an mp3 capable car stereo, after doing some serious searching, i finally decided to get myself a KDC-W6534U Kenwood receiver. Besides being a Kenwood, a brand that i appreciate in car audio systems, there were three things that caught my attention. An USB connector in the back of the unit, the possibility to reuse the car dashboard LCD display, and wheel commands, and the ACDrive functionality.

Problems and Solutions

Unit needs adaptor to connect to the wheel commands/dashboard display

Had to order an adapter from the guys at JustKenwood.

USB connection doesn't provide enough juice to connect an external 2,5" hard drive.

I got myself a cheap car lighter charger, for USB chargeable devices, and removed the electronics inside AFTER making sure it had the right output voltage, 5V. I then put it inside a nice new little black box and hid it under the dashboard, getting power directly from ignition. I'm not using the neutral connector, making the circuit is closing automatically when i plug the external drive, thus only consuming power if the drive is pluged in and in use.

Managing ACDrive in Linux

ACDrive is manageable through some Windows software called PhatNoise Media Manager. Although it does lot's of things, it's main goal is to keep a media database, which seems to be an sqlite db, on the physical media that you are going to attach to the unit. Another main operation is to generate voice index tags for the main information, such as folder names, artist names, album names, etc, so that you can navigate through some hundreds or thousands of songs, seamlessly, without taking your eyes of the road.
Guess what!? I don't use windows. I first tried using that manager under wine, but no luck. Then i came across a page at PhatHack.com which solved my problem of basic index creation. No voice index though.
After a quick watch and learn session i realized that, for my basic needs of folder navigation, i might had found the solution and all i needed was a TTS solution for linux and a simple bash script.

#!/bin/bash
# phatdb-voiceidx.sh by Hugo Monteiro <hm@hmonteiro.net>
# This software is proviced AS IS, with any kind of warranty whatsoever!
# Use it at your own risk. You have been warned!
#
# This will, hopefully, create the needed TTS files so you can enjoy your
# ACDrive enabled car stereo without having to use the PhatNoise Media Manager.
# NOTE: This script will need a working installation of festival and ffmpeg.
# You will also need to build the index databse files with phatdb (http://phatdb.sourceforge.net)
# More info on phatdb on the project website or at the phathack wiki page
# http://wiki.phathack.com/ACDrive

##################
# Speech options #
##################
# Playlist - cur0.mw
PLST_TXT="Now Browsing Playlist"
# Album - cur1.mw
ARTT_TXT="Now Browsing Artist"
# Genre - cur2.mw
GNRE_TXT="Now Browsing Genre"
# Album - cur3.mw
ALBM_TXT="Now Browsing Album"
# Folder - cur4.mw
FOLD_TXT="Now Browsing Folder"
# Invalid Track - Corrupt Track.mw
NVLD_TXT="Invalid Track"
# # - num.mw
NMBR_TXT="Number"
# Other - oth.mw
OTHR_TXT="Other"
# Root Folder - Root.mw
ROOT_TXT="Root Folder"

# Get specified path
BASE_PATH=$1

# MP3 Path
MP3_PATH=$2

################################
# Temp folder for wav creation #
################################
TEMP=${BASE_PATH}/phatdb-voiceidx

#######################
# Program definitions #
#######################
# I use text2wave, but there are others
T2W="/usr/bin/text2wave"

#ffmpeg
FF=/usr/bin/ffmpeg

# phatdb
PHATDB=/usr/bin/phatdb

me=`basename $0`

usage() {
        if [ "$1" -ne 2 ]
        then
                echo -e "\nusage: ${me} <media base path> <mp3 base path>\n"
                echo -e "Example:\n${me} /media/usbdisk /media/usbdisk/mp3\n"
                exit 1
        fi
}

create_dirs() {
        for dir in "$@"
        do
                if [ ! -d "$dir" ] ; then
                        echo -n "$dir doesn't exist. Should i create \"$dir\" (y/n)? "
                        read answer
                        case "$answer" in
                                [nN])   echo "Aborting."
                                                exit 2
                                ;;
                                *)              echo "Creating \"$dir\"."
                                                mkdir -p "$dir"
                                ;;
                        esac
                fi

                if [ ! -w ${dir} ]
                then
                        echo -e "\nCannot write to ${dir}. Check directory permissions.\n"
                        exit 3
                fi
        done
}

check_deps() {
        for file in "$@"
        do
                if [ ! -x ${file} ]
                then
                        echo -e "\nCannot execute ${file}. Do you have `basename ${file}` installed?.\n"
                        exit 3
                fi
        done
}

usage $#
check_deps $T2W $FF $PHATDB
create_dirs ${BASE_PATH}/mcd

# Build db using phatdb
$PHATDB -g ${BASE_PATH}

########################
# Array initialization #
########################

ALPHA="a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9"


echo -n "Scanning folders... "
FOLDERS=`find ${MP3_PATH} -mindepth 1 -type d | egrep -v "/mcd" | sed 's@.*\/@@g' | tr '[:punct:]' ' '`
echo "Done."


echo "Generating temporary WAV speech files... "
rm -rf ${TEMP}
rm -rf ${BASE_PATH}/mcd/tts/*
mkdir -p ${TEMP}

echo -n "Processing"

for i in ${ALPHA} ; do
    echo -n " $i"
        echo $i | ${T2W} -scale 5 > ${TEMP}/alpha.$i.wav
done
echo

echo "Processing ${PLST_TXT}"
echo "${PLST_TXT}" | ${T2W} -scale 5 > "${TEMP}/cur0.wav"
echo "Processing ${ARTT_TXT}"
echo "${ARTT_TXT}" | ${T2W} -scale 5 > "${TEMP}/cur1.wav"
echo "Processing ${GNRE_TXT}"
echo "${GNRE_TXT}" | ${T2W} -scale 5 > "${TEMP}/cur2.wav"
echo "Processing ${ALBM_TXT}"
echo "${ALBM_TXT}" | ${T2W} -scale 5 > "${TEMP}/cur3.wav"
echo "Processing ${FOLD_TXT}"
echo "${FOLD_TXT}" | ${T2W} -scale 5 > "${TEMP}/cur4.wav"
echo "Processing ${NVLD_TXT}"
echo "${NVLD_TXT}" | ${T2W} -scale 5 > "${TEMP}/Corrupt Track.wav"
echo "Processing ${NMBR_TXT}"
echo "${NMBR_TXT}" | ${T2W} -scale 5 > "${TEMP}/num.wav"
echo "Processing ${OTHR_TXT}"
echo "${OTHR_TXT}" | ${T2W} -scale 5 > "${TEMP}/oth.wav"
echo "Processing ${ROOT_TXT}"
echo "${ROOT_TXT}" | ${T2W} -scale 5 > "${TEMP}/Root.wav"

echo "Done."

IFS='
'

echo "Processing Folder names... "
for i in ${FOLDERS} ; do
        echo ">> $i"
        echo "$i" | ${T2W} -scale 5 > "${TEMP}/$i.wav"
done

echo -n "Creating necessary folders... "
mkdir -p $BASE_PATH/mcd/tts/{pr,an}
echo "Done."

echo -n "Installing WAV files as ASF... "

IFS='
 '

for i in ${ALPHA} ; do
        cat "${TEMP}/alpha.$i.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/alpha.$i.mw" 2>&1 > /dev/null
done

cat "${TEMP}/cur0.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/cur0.mw" 2>&1 > /dev/null
cat "${TEMP}/cur1.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/cur1.mw" 2>&1 > /dev/null
cat "${TEMP}/cur2.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/cur2.mw" 2>&1 > /dev/null
cat "${TEMP}/cur3.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/cur3.mw" 2>&1 > /dev/null
cat "${TEMP}/cur4.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/cur4.mw" 2>&1 > /dev/null
cat "${TEMP}/Corrupt Track.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/Corrupt Track.mw" 2>&1 > /dev/null
cat "${TEMP}/num.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/num.mw" 2>&1 > /dev/null
cat "${TEMP}/oth.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/pr/oth.mw" 2>&1 > /dev/null
cat "${TEMP}/Root.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/an/[f]Root.mw" 2>&1 > /dev/null

IFS='
'

echo -n "Folder names... "
for i in ${FOLDERS} ; do
        cat "${TEMP}/$i.wav" | ${FF} -i - -vn -f asf "${BASE_PATH}/mcd/tts/an/[f]$i.mw" 2>&1 > /dev/null
done
echo "Done."

echo -n "Cleaning temp files.. "
rm -rf "${TEMP}"
echo "Done."

exit 0

 
  • homebrew/car_audio.txt · Last modified: 2009/02/02 12:51 by hmmm