Audio Project Guidence

Hi All,

To start with, I'm VERY much a beginner. So sorry for any stupid questions. Anyways...

I run a fishing boat and I'd like to play music through speakers on deck. However, when somebody calls me on the radio, I would like that to play instead of the music.

If that doesn't make sense, the following situation is analogous. I have two ipods and one set of speakers. I want to play music from iPod 1 through my speakers most of the time. However, if I press play on iPod 2, I want to hear that regardless of what iPod 1 is doing.

I haven't purchased a board for this project yet. I'm wondering if one model would work better than another. Any thoughts?

For now let's not worry about stereo audio. I can just set up two boards (one for left, one for right) if I can get one working for mono. Or maybe there's a clever way to do it with one board (I'm all ears).

Since sound signals are basically just voltage fluctuations, I'm thinking of doing something like the following (based soley on the examples in the tutorial section).

Thanks for the help!

int music = 1 //the music input is on pin 1
int radio = 2 //the radio input is on pin 2
int speakers = 3 //the speakers are connected to pin 3
const int threshhold = 50 //the threshhold value the radio feed must reach to cut in

void setup() {

pinMode(speakers, OUTPUT); //initialize the speakers as output
pinMode(music, INPUT); //initialize the music as input
pinMode(radio, INPUT); //initialize the radio as input
}

void loop() {

int radioValue = analogRead(2); //read the radio input value
int musicValue = analogRead(1); //read the music input value

if (radioValue<threshhold){
analogWrite(speakers, musicValue * (255/1023)) //send the music voltage value to the speakers

}
else{
analogWrite(speakers, radioValue * (255/1023)) //send the music voltage value to the speakers

}

I think I would do that by using the Arduino to switch some relays when it detects a signal from the Radio.

The Arduino is not fast enough to process sound except at very low quality.

I presume you will have a separate speaker permanently connected to the radio in case your Arduino arrangement fails. Otherwise you may run foul of the coastguard.

...R

You need to get an analogue switch to switch from one audio stream to the other.
Then you need to monitor the radio stream with an envelope follower between it and the Arduino analogue input, and use that to control the audio switch.

But this is not a beginners project, get some learning in first.

In future read the forum rules about how to post code and ask a question.

Sorry for not posting the code correctly. I guess I'm a beginner in the code forum world as well. :confused:

I think I'll give a relay a shot! I'm not sure why I didn't think of that before. Now it's just a matter of waiting for the parts to get to Alaska.

The marine VHF radios we use all have integrated speakers so this isn't a life-or-death thing. Just a convenience thing.

Thanks!