Thread Subject: strange noise in sound card aquired data

Subject: strange noise in sound card aquired data

From: Adam Chapman

Date: 8 Dec, 2008 19:30:31

Message: 1 of 3

Hi,

This is the first time I've tried to obtain data from a soundcard, or
even use the data aquisition toolbox. Basically. Whilst playing music
on Itunes or windows media player, I ran the following code to get and
plot 20 seconds of audio data:

ai = analoginput('winsound');
Fs=8000;
time=20;
set(ai,'SamplesPerTrigger',Fs*time)
addchannel(ai, 1);
tic; start(ai); toc
pause(time)
data = getdata(ai);
data=data/max(data);

stop(ai)
pause(5)
sound(data, Fs)

plot((1:length(data))/Fs,data)


I put a picture of the output at
http://personalpages.manchester.ac.uk/student/Adam.Chapman/soundcard_data.fig

As you can see, every now and again the data seems to oscilate around
-1. I would have thought that the data couldn't take values <-1,
because the "addchannel" command shows:


Index: ChannelName: HwChannel:
   1 'Mono' 1

InputRange: SensorRange: UnitsRange: Units:
[-1 1] [-1 1] [-1 1] 'Volts'


Can anybody see something that I've done wrong? I wouldn't think it's
a hardware problem, as the sound from my speakers is fine.

Thanks for any help offered,
Adam

Subject: strange noise in sound card aquired data

From: Adam Chapman

Date: 8 Dec, 2008 23:43:41

Message: 2 of 3

On Dec 8, 7:30=A0pm, Adam Chapman
<adam.chap...@student.manchester.ac.uk> wrote:
> Hi,
>
> This is the first time I've tried to obtain data from a soundcard, or
> even use the data aquisition toolbox. Basically. Whilst playing music
> on Itunes or windows media player, I ran the following code to get and
> plot 20 seconds of audio data:
>
> ai =3D analoginput('winsound');
> Fs=3D8000;
> time=3D20;
> set(ai,'SamplesPerTrigger',Fs*time)
> addchannel(ai, 1);
> tic; start(ai); toc
> pause(time)
> data =3D getdata(ai);
> data=3Ddata/max(data);
>
> stop(ai)
> pause(5)
> sound(data, Fs)
>
> plot((1:length(data))/Fs,data)
>
> I put a picture of the output athttp://personalpages.manchester.ac.uk/stu=
dent/Adam.Chapman/soundcard_...
>
> As you can see, every now and again the data seems to oscilate around
> -1. I would have thought that the data couldn't take values <-1,
> because the "addchannel" command shows:
>
> Index: =A0ChannelName: =A0HwChannel:
> =A0 =A01 =A0 =A0 =A0 'Mono' =A0 =A0 =A0 =A0 =A0 =A0 1
>
> InputRange: =A0SensorRange: =A0UnitsRange: =A0Units:
> [-1 1] =A0 =A0 =A0 =A0 =A0 =A0[-1 1] =A0 =A0 =A0 =A0 =A0 =A0 =A0 [-1 1] =
=A0 =A0 =A0 =A0 =A0 'Volts'
>
> Can anybody see something that I've done wrong? I wouldn't think it's
> a hardware problem, as the sound from my speakers is fine.
>
> Thanks for any help offered,
> Adam

I've just ran the same code with speakers outputting no sound at all
and still get the noise. The data I aquired before did have the music
data in it, although when playing back it was distorted by this funny
noise signal.

Here's what I get from right-clicking the object "ai" in my workspace
and selecting "display hardware info":

   AdaptorName: 'winsound'
                       Bits: 16
                   Coupling: {'AC Coupled'}
                 DeviceName: 'Microphone (SoundMAX Integrated'
            DifferentialIDs: []
                      Gains: []
                         ID: '0'
                InputRanges: [-1 1]
              MaxSampleRate: 96000
              MinSampleRate: 5000
             NativeDataType: 'int16'
                   Polarity: {'Bipolar'}
                 SampleType: 'SimultaneousSample'
             SingleEndedIDs: [1 2]
              SubsystemType: 'AnalogInput'
              TotalChannels: 2
    VendorDriverDescription: 'Windows Multimedia Driver'
        VendorDriverVersion: '6.0'

I'm not sure about the fact that the device name is "microphone",
maybe that's default for an audio device. Also I dont know the
hardware info is aquired from the device drivers or if they are merely
default values.

I've also put online the data plot with no sound at:
http://personalpages.manchester.ac.uk/student/Adam.Chapman/no_sound_playing=
.fig
Also plotted the data in uint16 format after seeing above the native
data type for the sound card is uint16. Again, not sure if this is
actual or default.

Hope this is useful
Adam

Subject: strange noise in sound card aquired data

From: Adam Chapman

Date: 9 Dec, 2008 12:54:38

Message: 3 of 3

On Dec 8, 11:43=A0pm, Adam Chapman
<adam.chap...@student.manchester.ac.uk> wrote:
> On Dec 8, 7:30=A0pm, Adam Chapman
>
>
>
>
>
> <adam.chap...@student.manchester.ac.uk> wrote:
> > Hi,
>
> > This is the first time I've tried to obtain data from a soundcard, or
> > even use the data aquisition toolbox. Basically. Whilst playing music
> > on Itunes or windows media player, I ran the following code to get and
> > plot 20 seconds of audio data:
>
> > ai =3D analoginput('winsound');
> > Fs=3D8000;
> > time=3D20;
> > set(ai,'SamplesPerTrigger',Fs*time)
> > addchannel(ai, 1);
> > tic; start(ai); toc
> > pause(time)
> > data =3D getdata(ai);
> > data=3Ddata/max(data);
>
> > stop(ai)
> > pause(5)
> > sound(data, Fs)
>
> > plot((1:length(data))/Fs,data)
>
> > I put a picture of the output athttp://personalpages.manchester.ac.uk/s=
tudent/Adam.Chapman/soundcard_...
>
> > As you can see, every now and again the data seems to oscilate around
> > -1. I would have thought that the data couldn't take values <-1,
> > because the "addchannel" command shows:
>
> > Index: =A0ChannelName: =A0HwChannel:
> > =A0 =A01 =A0 =A0 =A0 'Mono' =A0 =A0 =A0 =A0 =A0 =A0 1
>
> > InputRange: =A0SensorRange: =A0UnitsRange: =A0Units:
> > [-1 1] =A0 =A0 =A0 =A0 =A0 =A0[-1 1] =A0 =A0 =A0 =A0 =A0 =A0 =A0 [-1 1]=
 =A0 =A0 =A0 =A0 =A0 'Volts'
>
> > Can anybody see something that I've done wrong? I wouldn't think it's
> > a hardware problem, as the sound from my speakers is fine.
>
> > Thanks for any help offered,
> > Adam
>
> I've just ran the same code with speakers outputting no sound at all
> and still get the noise. The data I aquired before did have the music
> data in it, although when playing back it was distorted by this funny
> noise signal.
>
> Here's what I get from right-clicking the object "ai" in my workspace
> and selecting "display hardware info":
>
> =A0 =A0AdaptorName: 'winsound'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Bits: 16
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Coupling: {'AC Coupled'}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DeviceName: 'Microphone (SoundMAX Inte=
grated'
> =A0 =A0 =A0 =A0 =A0 =A0 DifferentialIDs: []
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Gains: []
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ID: '0'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputRanges: [-1 1]
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 MaxSampleRate: 96000
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 MinSampleRate: 5000
> =A0 =A0 =A0 =A0 =A0 =A0 =A0NativeDataType: 'int16'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Polarity: {'Bipolar'}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SampleType: 'SimultaneousSample'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0SingleEndedIDs: [1 2]
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 SubsystemType: 'AnalogInput'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 TotalChannels: 2
> =A0 =A0 VendorDriverDescription: 'Windows Multimedia Driver'
> =A0 =A0 =A0 =A0 VendorDriverVersion: '6.0'
>
> I'm not sure about the fact that the device name is "microphone",
> maybe that's default for an audio device. Also I dont know the
> hardware info is aquired from the device drivers or if they are merely
> default values.
>
> I've also put online the data plot with no sound at:http://personalpages.=
manchester.ac.uk/student/Adam.Chapman/no_sound_p...
> Also plotted the data in uint16 format after seeing above the native
> data type for the sound card is uint16. Again, not sure if this is
> actual or default.
>
> Hope this is useful
> Adam- Hide quoted text -
>
> - Show quoted text -

The large jumps to -1 appear to occur when int16(data)~-0. Could I
just add 1 to any data?
Im so confused, as I can't see any reason why this is happening!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
data aquisition Adam Chapman 9 Dec, 2008 07:55:55
sound card Adam Chapman 9 Dec, 2008 07:55:55
noise Adam Chapman 9 Dec, 2008 07:55:55
daq Adam Chapman 9 Dec, 2008 07:55:55
analog Adam Chapman 9 Dec, 2008 07:55:55
rssFeed for this Thread

Contact us at files@mathworks.com